Advertisement
Guest User

Untitled

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