Guest User

Untitled

a guest
Jan 24th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.66 KB | None | 0 0
  1. <?php
  2.  
  3. session_start();
  4. require_once("includes/connect.php");
  5.  
  6. ?>
  7.  
  8. <html>
  9. <body>
  10.  
  11. <form action="" method="POST">
  12.  
  13. <h2> Login: </h2>
  14.  
  15. User Name: <input type="text" name="user" />
  16. Password: <input type="text" name="pass" />
  17. <input type="submit" name="login" />
  18.  
  19. </form>
  20.  
  21. <?php
  22.  
  23. if(isset($_POST['login']))
  24. {
  25.     $user = $_POST['user'];
  26.     $pass = $_POST['pass'];
  27.    
  28.     $results = mysql_query("SELECT userName, password FROM users WHERE userName='$user' && password='$pass'");
  29.    
  30.     if(!$results)
  31.     {
  32.         echo "Invalid username and/or password";
  33.     }
  34.    
  35.     else
  36.     {
  37.         $_SESSION['user'] = $user;
  38.         header("Location:welcome.php");
  39.     }
  40. }
  41.  
  42. ?>
  43.  
  44. </body>
  45. </html>
Add Comment
Please, Sign In to add comment