Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4. * @author Jason
  5. * @copyright 2010
  6. */
  7.  
  8. $submit = $_POST['submit'];
  9.  
  10. $fullname = strip_tags($_POST['fullname']);
  11. $username = strip_tags($_POST['username']);
  12. $password = md5($_POST['password']);
  13. $repeatpassword = md5($_POST['repeatpassword']);
  14.  
  15. $date = date("Y-m-d");
  16.  
  17. if ($submit)
  18. {
  19.  
  20. $connect = mysql_connect("localhost","root","jason");
  21. mysql_select_db("usersystem");
  22.  
  23. $namecheck = mysql_query("SELECT * FROM users WHERE username='$username'");
  24. $count = mysql_num_rows($namecheck);
  25.  
  26. if ($count!=0)
  27. {
  28. die ("Username already taken");
  29. }
  30.  
  31. if ($fullname&&$username&&$password&&$repeatpassword)
  32. {
  33.  
  34. if ($password==$repeatpassword)
  35. {
  36.  
  37. if(strlen($username)>25||strlen($fullname)>25)
  38. {
  39. echo "Username and Full name have to be under 25 characters.";
  40. } else
  41.  
  42. if (strlen($password)>25||strlen($password)<6)
  43. {
  44. echo "Password must be between 6 to 25 characters!";
  45. } else
  46.  
  47. {
  48.  
  49. $password = md5($password);
  50. $repeatpassword = md5($repeatpassword);
  51.  
  52. $connect = mysql_connect("localhost","root","jason");
  53. mysql_select_db("usersystem");
  54.  
  55. $queryreg = mysql_query("
  56.  
  57. INSERT INTO users VALUES('','$fullname','$username','$password','$date')
  58.  
  59. ");
  60.  
  61. die ("You have been registered!");
  62.  
  63. }
  64.  
  65. } else
  66. echo "Passwords don't match!";
  67.  
  68. } else
  69. echo "Fill in all fields!";
  70.  
  71. }
  72.  
  73. ?>
  74.  
  75. <html>
  76.  
  77. <form action="register.php" method="POST">
  78.  
  79. Full Name: <input type="text" name="fullname"/><br />
  80. Username: <input type="text" name="username"/><br />
  81. Password: <input type="password" name="password"/><br />
  82. Repeat Password: <input type="password" name="repeatpassword"/><br />
  83.  
  84. <input type="submit" name="submit" value="Register"/>
  85.  
  86. </form>
  87.  
  88. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement