logout.php 701 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * File for the login action.
  4. *
  5. * Implements an action function to be called from the {@see Controller}.
  6. *
  7. * @category Action
  8. */
  9. /**
  10. * Logs the user out and redirects to the login page.
  11. *
  12. * Invalidates cookies and session variables.
  13. *
  14. * @return int 0.
  15. * @category Action
  16. * @global int The user id.
  17. */
  18. function action(){
  19. $GLOBALS["UID"] = null;
  20. setcookie("uid", null, time() - 3600);
  21. session_regenerate_id();
  22. $_SESSION['session'] = false;
  23. $_SESSION['name'] = "";
  24. $_SESSION['uid'] = "";
  25. header("Location: /");
  26. die();
  27. return 0;
  28. }
  29. ?>