Advertisement
Guest User

Untitled

a guest
Sep 18th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.53 KB | None | 0 0
  1. <form method="post" action="">
  2. <h4><center>Account Information</center></h4>
  3. Username: <input type="text" name="username" value="" /><br/>
  4. Password: <input type="password" name="pass" value="" /><br/>
  5. Repeat Password: <input type="password" name="pass2" value=""/><br/>
  6. Secret Phrase: <input type="code' name="code" value=""/><br><br>
  7. <input type="submit" name="submit" value="Submit" />
  8.  
  9. </form>
  10.  
  11. <?php
  12. $username = 0;
  13. $pass = 0;
  14. $code = 0;
  15. $conn = mysql_connect("localhost", "root", "pepsi3");
  16. $db = mysql_select_db("cq");
  17.  
  18. $username = $_POST['username'];
  19. $pass = $_POST['password'];
  20. $code = $_POST['code'];
  21.  
  22. if(isset($_POST['submit']))
  23. {
  24.      if ($pass != "")
  25.      {
  26.           if($_POST['pass'] == $_POST['pass2'])
  27.           {
  28.                if(strlen($_POST['pass']) > 3 && strlen($_POST['pass']) < 32)
  29.                {  
  30.                     if(strlen($_POST['code']) > 3 && strlen($_POST['code']) < 14)
  31.                     {
  32.                     $sql = "INSERT INTO `accounts` (`username`, `password`, `state`, `code`) VALUES ('$username', '$pass', '1', '$code";
  33.                     $sql = mysql_query($sql) or die(mysql_error());
  34.                     echo "Registered Successfully";
  35.                    
  36.                     } else {
  37.                     die("Your pass phrase fails");
  38.                     }
  39.                } else {
  40.                     die("Your password must be between 3 and 32 characters.");
  41.                }
  42.           } else {
  43.                die("Your passwords do not match.");
  44.           }
  45.      } else {
  46.           die("Please enter in a password.");
  47.      }
  48. }
  49. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement