Advertisement
Guest User

Untitled

a guest
Jun 11th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.89 KB | None | 0 0
  1. <?php
  2.  
  3.     require ('settings/connect.php');
  4.  
  5.     $query = "INSERT INTO users (username, password) VALUES ('$_POST[username]', 'sha1($_POST[password])'";
  6.     $username = $_POST['username'];
  7.  
  8.     if(($_POST['username'] != "" && $_POST['password'] != "") && $_POST['password'] == $_POST['vpassword']) {
  9.         if($query) {
  10.             header("Location: index.php");
  11.             session_start();
  12.             $_SESSION['user'] = $username;
  13.         } else {
  14.             echo "Failed to register";
  15.         }
  16.     } else {
  17.         if($_POST['password'] != $_POST['vpassword']) {
  18.             echo "Your passwords do not match! <br /><br />";
  19.         }
  20.     }
  21. ?>
  22.  
  23. <html>
  24.     <body>
  25.         <form action='register.php' method='post'>
  26.             Username: <input type='text' name='username' /><br />
  27.             Password: <input type='password' name='password' /><br />
  28.             Verify Password: <input type='password' name='vpassword' /> <br />
  29.             <input type='submit' value='register' />
  30.         </form>
  31.     </body>
  32. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement