Guest User

Untitled

a guest
May 26th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. <?php
  2.  
  3. ob_start();
  4.  
  5. $host="localhost"; // Host name
  6.  
  7. $username="terryw000"; // Mysql username
  8.  
  9. $password="peterw000"; // Mysql password
  10.  
  11. $db_name="db_data"; // Database name
  12.  
  13. $tbl_name="tb_animewatch"; // Table name
  14.  
  15. $salt="t3*\86I";
  16.  
  17. // Connect to server and select databse.
  18.  
  19. mysql_connect("$host", "$username", "$password")or die("cannot connect");
  20.  
  21. mysql_select_db("$db_name")or die("cannot select DB");
  22.  
  23.  
  24.  
  25. $username=$_POST['username'];
  26.  
  27. $password=md5($salt.$_POST['password'].$salt);
  28.  
  29. if ($_POST['e-mail'] == $_POST['ree-mail'])
  30.  
  31. {
  32.  
  33. $email=$_POST['e-mail'];
  34.  
  35. }
  36.  
  37.  
  38.  
  39. $check= "SELECT * FROM `$tbl_name` WHERE email = '$email' OR username = '$username'";
  40.  
  41. $result = mysql_query($check);
  42.  
  43. $count = mysql_num_rows($result);
  44.  
  45.  
  46.  
  47. if (0 == $count)
  48.  
  49. {
  50.  
  51. $sql="INSERT INTO `$tbl_name` ( `username`, `password`, `email`) VALUES ('$username', '$password', '$email')";
  52.  
  53. $result=mysql_query($sql);
  54.  
  55.  
  56.  
  57. header("location:index.html");
  58.  
  59. }else {
  60.  
  61. echo "this username or email has already been used";
  62.  
  63. }
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71. ob_end_flush();
  72.  
  73. ?>
Add Comment
Please, Sign In to add comment