Advertisement
Guest User

Untitled

a guest
Feb 27th, 2016
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. <?php
  2.  
  3. if(isset($_POST['submit']))
  4. {
  5. $name = mysql_real_escape_string($_POST['name']);
  6. $username = mysql_real_escape_string($_POST['username']);
  7. $password = mysql_real_escape_string($_POST['password']);
  8. $password1 = mysql_real_escape_string($_POST['password1']);
  9.  
  10. $enc_password = md5($password);
  11.  
  12. if($name && $username && $password && $password1)
  13. {
  14. if(strlen($name)<30)
  15. {
  16. if(strlen($username)<10)
  17. {
  18. if(strlen($password)<30 || strlen($password)>6)
  19. {
  20. if($password == $password1)
  21. {
  22. require "dbc.php";
  23. $query = mysql_query("INSERT INTO users VALUES ('','$name','$username','$enc_password')");
  24. echo "Registration Complete! <a href='loginpage.php'>Click here to login</a>";
  25. }
  26. else
  27. {
  28. echo "Passwords must match";
  29. }
  30. }
  31. else
  32. {
  33. echo "Your password must be between 6 and 30 characters";
  34. }
  35. }
  36. else
  37. {
  38. echo "Your username is too long";
  39. }
  40. }
  41. else
  42. {
  43. echo "Your name is too long";
  44. }
  45. }
  46. else
  47. {
  48. echo "All fields are required";
  49. }
  50. }
  51.  
  52. ?>
  53.  
  54. <html>
  55.  
  56. <form action="register.php" method="POST">
  57. Name: <input type="text" name="name" value="<?php if(isset($_POST['submit'])){echo "$name";} ?>"> Max Length:30<p>
  58. Username: <input type="text" name="username" value="<?php if(isset($_POST['submit'])){ echo "$username";} ?>"> Max Length:15<p>
  59. Password: <input type="password" name="password"> Max length:30<p>
  60. Re-Enter Password: <input type="password" name="password1"><p>
  61. <input type="submit" name="submit" value="Register">
  62. </form>
  63.  
  64. </html>
  65.  
  66. if($name && $username && $password && $password1)
  67.  
  68. if(empty($name) && empty($username) && empty($password) && empty($password1))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement