| 12345678910111213141516171819202122232425262728293031323334353637 |
- <?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
- */
- require_once(PATH::ACTION . "Action.php");
- /**
- * Logs the user out and redirects to the login page.
- *
- * Invalidates cookies and session variables.
- *
- * @category Action
- */
- class Logout_Action extends Action{
-
- /**
- * Executes the action.
- */
- function execute(){
- setcookie("user_id", null, time() - 3600);
- setcookie("user_token", null, time() - 3600);
- session_regenerate_id();
- $_SESSION['session'] = false;
- $_SESSION['user_id'] = "";
- $this->code = 204;
- $this->message = "No content.";
- header("Location: /");
- return;
- }
- }
|