Advertisement
Guest User

Untitled

a guest
May 18th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. <?php require_once "includes/header.php"; ?>
  2.  
  3. <?php
  4.  
  5. if($session->is_signed_in()) {
  6. redirect("index.php");
  7. }
  8.  
  9. if(isset($_POST['submit'])) {
  10. $username = trim($_POST['username']);
  11. $password = trim($_POST['password']);
  12.  
  13. $user_found = User::verify_user($username, $password);
  14.  
  15. if($user_found) {
  16. $session->login($user_found);
  17. redirect("index.php");
  18. } else {
  19. $the_message = "Your password or username is incorrect";
  20. }
  21. } else {
  22. $username = NULL;
  23. $password = NULL;
  24. $the_message = NULL;
  25. }
  26.  
  27. ?>
  28.  
  29. <div class="col-md-4 col-md-offset-3">
  30. <h4 class="bg-danger"><?php if (isset($the_message)) {echo $the_message;} ?></h4>
  31. <form id="login-id" action="" method="post">
  32. <div class="form-group">
  33. <label for="username">Username</label>
  34. <input type="text" class="form-control" name="username" value="<?php echo htmlentities($username); ?>" >
  35. </div>
  36.  
  37. <div class="form-group">
  38. <label for="password">Password</label>
  39. <input type="password" class="form-control" name="password" value="<?php echo htmlentities($password); ?>">
  40. </div>
  41.  
  42. <div class="form-group">
  43. <input type="submit" name="submit" value="Submit" class="btn btn-primary">
  44. </div>
  45. </form>
  46. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement