Advertisement
Husam1093

Untitled

May 24th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. include_once('UUser.php');
  5. $error = "";
  6.  
  7. if(isset($_POST['login'])){
  8. $username = $_POST["username"];
  9. $password = $_POST["password"];
  10.  
  11. $object = new User();
  12. $object->username= $username;
  13. $object->password= $password;
  14.  
  15. if($object->isAuthenticated()){
  16. $_SESSION['username'] = $username;
  17. header("Location: Page.php"); exit();
  18. }
  19. else {
  20. $error = '<div>Login has failed!</div>';
  21. }
  22. echo $error;
  23. }
  24.  
  25. ?>
  26. <title>Login Form</title>
  27.  
  28.  
  29. <form action="" method="post">
  30. <h2>Please Log in</h2>
  31. <label>Username</label>
  32. <input type="text" name="username" placeholder="Username" value="" required autofocus>
  33. <label>Password</label>
  34. <input type="password" name="password" placeholder="Password" value="" required>
  35. <button name="login" type="submit">Log in</button>
  36.  
  37. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement