Advertisement
Guest User

Untitled

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