Advertisement
Guest User

Untitled

a guest
Jul 7th, 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_destroy()
  3. error_reporting(E_ALL); ini_set('display_errors', 1);
  4. //login.php
  5. session_start();
  6. require_once 'includes/global.inc.php';
  7. $error = "";
  8. $username = "";
  9. $password = "";
  10. //check to see if they've submitted the login form]
  11. if(isset($_POST['submit-login'])) {
  12. $username = $_POST['username'];
  13. $password = $_POST['password'];
  14. $userTools = new UserTools();
  15. if($userTools->login($username, $password)){
  16. //successful login, redirect them to a page
  17. //header("Location: index.php");
  18. }else{
  19. $error = "Incorrect username or password. Please try again.";
  20. }
  21. }
  22. ?>
  23. <html>
  24. <head>
  25. <title>Login</title>
  26. </head>
  27. <body>
  28. <form action="login.php" method="post">
  29. Username: <input type="text" name="username" value="<?php echo $username; ?>" /><br/>
  30. Password: <input type="password" name="password" value="<?php echo $password; ?>" /><br/>
  31. <input type="submit" value="Login" name="submit-login" />
  32. </form>
  33. </body>
  34. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement