Advertisement
Guest User

Untitled

a guest
Jun 4th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. <?php
  2. echo "<h1>Register</h1>";
  3.  
  4. $submit = $_POST['submit'];
  5.  
  6. //form data
  7. $fullname = strip_tags($_POST['fullname']);
  8. $username = strip_tags($_POST['username']);
  9. $password = strip_tags($_POST['password']);
  10. $repeatpassword = strip_tags($_POST['repeatpassword']);
  11. $date = date("Y-m-d");
  12.  
  13. if ($submit)
  14. {
  15.  
  16. //check for existance
  17. if ($fullname&&$username&&$password&&$repeatpassword)
  18. {
  19.  
  20. //encrypt password
  21. $password = md5($password);
  22. $repeatpassword = md5($repeatpassword);
  23.  
  24. if ($password==$repeatpassword)
  25. {
  26. //register the user!
  27.  
  28. echo "Success!!";
  29.  
  30. }
  31. }
  32. }
  33. else
  34. echo "Your passwords do not match!";
  35.  
  36. }
  37. else
  38. echo "Please fill in <b>all</a> fields!";
  39.  
  40.  
  41. }
  42.  
  43. ?>
  44.  
  45. <html>
  46. <p>
  47. <form action='register.php' method='POST'>
  48. <table>
  49. <tr>
  50. <td>
  51. Your full name:
  52. </td>
  53. <td>
  54. <input type='text' name='fullname' value='<?php echo $fullname; ?>'>
  55. </td>
  56. <td>
  57. Choose a username:
  58. </td>
  59. <td>
  60. <input type='text' name='username' value='<?php echo $username; ?>'>
  61. </td>
  62. </tr>
  63. <tr>
  64. <td>
  65. //check password length
  66. if (strlen($password)>25||strlen($password)<6)
  67. {
  68. echo "Password must be between 6 and 25 characters";
  69. }
  70. else
  71. {
  72. //register the user!
  73.  
  74. echo "Success!!";
  75.  
  76. }
  77.  
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement