Advertisement
Guest User

Untitled

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