Guest User

Untitled

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