Advertisement
Guest User

Untitled

a guest
Nov 9th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. <?php
  2. if (isset($_POST['username']) && isset($_POST['password'])) {
  3. $username = $_POST['username'];
  4. $password = $_POST['password'];
  5. } else {
  6. header('Location: login.php');
  7. }
  8. if (!empty($username) && !empty($password)) {
  9. $user = User::login($username, $password);
  10. if (!is_null($user)) {
  11. $_SESSION['currentUser'] = $user; // this is all that "being logged in" really is
  12. header('Location: index.php'); // success
  13. } else {
  14. header('Location: login.php'); // failure
  15. }
  16. }
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement