| 1234567891011121314151617181920212223242526 |
- <?php
- /**
- * File for the logout action.
- *
- * Implements an action function to be called from the {@see Controller}.
- *
- * @author Iñigo Valentin <i@inigovalentin.com>
- * @license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License V3
- * @package SWDB
- */
- /**
- * Logs the user out and redirects to the login page.
- *
- * Invalidates cookies and session variables.
- *
- * @category Action
- */
- function action(){
- setcookie("user_id", null, time() - 3600);
- setcookie("user_token", null, time() - 3600);
- session_regenerate_id();
- $_SESSION['session'] = false;
- $_SESSION['user_id'] = "";
- header("Location: /");
- }
|