Guest User

Untitled

a guest
Jun 24th, 2018
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. <?php
  2. include "includes/connect.php";
  3. $username = $_POST['username'];
  4. $email = $_POST['email'];
  5. $location = $_POST['location'];
  6. $userchecker=mysql_query("select * from users where username='". mysql_real_escape_string($username) ."'");
  7. $userchecker2 = mysql_num_rows($userchecker);
  8. ?>
  9. <form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="POST">
  10. Username:
  11. <input type="text" name="username" value="<?php echo $username; ?>" />
  12. <br>
  13. Email:
  14. <input type="text" name="email" value="<?php echo $email; ?>" />
  15. <br>
  16. Password:
  17. <input type="password" name="password1" />
  18. <br>
  19. Password(again):
  20. <input type="password" name="password2" />
  21. <br>
  22. Location:
  23. <input type="text" name="location" value="<?php echo $location; ?>" />
  24. <br />
  25. <?php
  26. $ip=$_SERVER['REMOTE_ADDR'];
  27. ?>
  28. Ip: <strong><?php echo "$ip" ?></strong><br />
  29. <br />
  30. <input name="terms" type="checkbox">
  31. I agree the Terms and Conditions <br />
  32. <br />
  33.  
  34. <input type="submit" name="submit" value="Register!" />
  35. </form>
  36. <?php
  37. $username = $_POST['username'];
  38. $email = $_POST['email'];
  39. $password1 = $_POST['password1'];
  40. $password2 = $_POST['password2'];
  41. $location = $_POST['location'];
  42. $terms = $_POST['terms'];
  43.  
  44. $namelength = strlen($username);
  45.  
  46. if(isset($_POST['username']))
  47. {
  48. if($password1 != $password2)
  49. {
  50. echo "Your passwords do not match!";
  51. }
  52. elseif($terms != on)
  53. {
  54. echo "You must agree before you can continue!";
  55. }
  56. elseif($namelength < 3)
  57. {
  58. echo "Your Username must be longer than 3 characters!";
  59. }
  60. elseif($userchecker > 0)
  61. {
  62. echo "Username is taken!";
  63. }
  64. else
  65. {
  66. }
  67. }
  68. $password= md5($password1);
  69. $sql = "INSERT INTO users (username, password, email, location) VALUES ($username, $password, $email, $location);";
  70. mysql_query($sql);
  71. ?>
Add Comment
Please, Sign In to add comment