Guest User

Untitled

a guest
Mar 5th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include ('include/config.php');
  4. if(isset($_POST['login'])) {
  5.  
  6. $username = $_POST['username'];
  7. $password = $_POST['password'];
  8. $blowfish = md5($password);
  9.  
  10.  
  11. $sql = "SELECT * FROM members where username=:username AND password=:password ";
  12. $stmt = $dbconnect->prepare($sql);
  13. $stmt->execute(array(':username' => $username, ':password' => $blowfish));
  14. if($stmt->rowCount() == 1)
  15. {
  16. $_SESSION['username'] = $username;
  17. $_SESSION['LoggedIn'] = TRUE;
  18. header("location:index.php");
  19. }
  20. else
  21. {
  22. echo "Incorrect username or password.";
  23. }
  24. }
  25. ?>
  26.  
  27. <html>
  28. <head>
  29. <title></title>
  30. </head>
  31. <body>
  32. <form method="POST" action="" >
  33. <table border="0">
  34.  
  35. <tr><td>Username </td><td><input type="text" name="username" size="20" /></td></tr>
  36.  
  37. <tr><td>Password </td><td><input type="password" name="password" size="20" /></td></tr>
  38.  
  39. <tr><td></td><td><input type="submit" value="Login" name="login" /></td></tr>
  40.  
  41. </table>
  42. </form>
  43. </body>
  44. </html>
Add Comment
Please, Sign In to add comment