Advertisement
Guest User

Untitled

a guest
Mar 30th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. <?php
  2. // Getting ssas class
  3. require_once("ssas.php");
  4. $ssas = new Ssas();
  5.  
  6. //Secure post
  7. $username = mysqli_real_escape_string($_POST['username']);
  8. $password = mysqli_real_escape_string($_POST['password']);
  9.  
  10. // If a POST occured, try to authenticate
  11. if(isset($username) && isset($password)){
  12. $result = $ssas -> login($username,$password);
  13. if($result === true) header("Location: login.php"); //Bugfix, otherwise the reditect to index is without cookies (for some reason!)
  14. }
  15.  
  16. // If the user is already logged in, redirect to index.php
  17. if($ssas -> isUserLoggedIn()){
  18. header("Location: index.php");
  19. echo "redicrect!";
  20. exit();
  21. }
  22. ?>
  23.  
  24. <?php include 'header.php'; ?>
  25.  
  26. <div class="row">
  27. <div class="col-sm-6 col-sm-offset-3">
  28. <form action="login.php" method="post">
  29. <div class="form-group">
  30. <label for="username">Username:</label>
  31. <input
  32. id="username"
  33. type="text"
  34. class="form-control"
  35. name="username"
  36. >
  37. </div>
  38. <div class="form-group">
  39. <label for="password">Password:</label>
  40. <input
  41. id="password"
  42. type="password"
  43. class="form-control"
  44. name="password"
  45. >
  46. </div>
  47. <button class="btn btn-success" type="submit">Login</button>
  48. </form>
  49.  
  50. <?php if(isset($result)){ ?>
  51. </br>
  52. <div class="alert alert-danger" role="alert">
  53. <strong>Ups!</strong> <?php echo $result; ?>
  54. </div>
  55. <?php } ?>
  56.  
  57. </div>
  58. </div>
  59.  
  60. <?php include 'footer.php'; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement