logout.php 711 B

1234567891011121314151617181920212223242526272829303132
  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. global $UID;
  20. $UID = null;
  21. setcookie("uid", null, time() - 3600);
  22. session_regenerate_id();
  23. $_SESSION['session'] = false;
  24. $_SESSION['name'] = "";
  25. $_SESSION['uid'] = "";
  26. header("Location: /");
  27. die();
  28. return 0;
  29. }
  30. ?>