Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.55 KB | None | 0 0
  1. <?php
  2. error_reporting(E_ALL);
  3.  
  4. echo "<h1>Register</h1>";
  5.  
  6. $submit = $_POST['submit'];
  7.  
  8. $fullname = strip_tags($_POST['fullname']);
  9. $username = strip_tags($_POST['username']);
  10. $password = strip_tags($_POST['password']);
  11. $repeatpassword = strip_tags($_POST['repeatpassword']);
  12. $date = date("Y-m-d");
  13.  
  14. if($submit)
  15. {
  16.     if($username&&$password&&$repeatpassword&&$fullname)
  17.     {
  18.         $password = md5($password);
  19.         $repeatpassword = md5($repeatpassword);
  20.         if ($password==$repeatpassword)
  21.         {
  22.             if (strlen($username)>25||strlen($fullname)>25)
  23.             {
  24.                 echo "Max length of username/fullname 25 chars";
  25.             }
  26.             else
  27.             {
  28.                 //password length
  29.                 if (strlen($password)>25)||strlen($password)<6)
  30.                 {
  31.                     echo "Password must be between 6 and 25 chars";
  32.                 }
  33.                 else
  34.                 {          
  35.                     //  register user
  36.                     echo "Success";
  37.                 }
  38.             }
  39.         }
  40.         else
  41.         {
  42.             echo "You passwords do not match";
  43.         }
  44.     }
  45.     echo "Please fill in all all fields.";
  46. }
  47.  
  48. ?>
  49.  
  50.  
  51. <html>
  52. <form action='register.php' method='POST'>
  53. <table summary="" >
  54.  
  55. <tr>
  56.  
  57.     <td>
  58.     Your full name:
  59.     </td>
  60.  
  61.     <td>
  62.     <input type='text' name='fullname'>
  63.     </td>
  64.  
  65. </tr>
  66.  
  67. <tr>
  68.  
  69.     <td>
  70.     Choose a username:
  71.     </td>
  72.  
  73.     <td>
  74.     <input type='text' name='username'>
  75.     </td>
  76.  
  77. </tr>
  78.  
  79. <tr>
  80.  
  81.     <td>
  82.     Choose a password:
  83.     </td>
  84.  
  85.     <td>
  86.     <input type='password' name='password'>
  87.     </td>
  88.  
  89. </tr>
  90.  
  91. <tr>
  92.  
  93.     <td>
  94.     Repeat password:
  95.     </td>
  96.  
  97.     <td>
  98.     <input type='password' name='repeatpassword'>
  99.  
  100. </tr>
  101.  
  102.  
  103. </table>
  104.  
  105. <p>
  106.  
  107.  
  108. <input type="submit" name="submit" value="Register"
  109. </form>
  110.  
  111. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement