<?php /*********** Includes ***********/ include_once "../utils/session.php"; $oSession = new sessionUtil("acceso"); $active = $oSession->isActiveSession(); if (!$active) { header("Location: ../index.php?message='Su session ha expirado.'"); exit; }
<?php /*********** Errors reporting ***********/ error_reporting(E_ALL ^ E_NOTICE); error_reporting(E_ERROR | E_PARSE); /*********** Includes ***********/ include_once "database/conexion.php"; include_once "utils/constants.php"; include_once "utils/session.php"; $sss = new sessionUtil("acceso"); $sss->destroySession(); if (isset($_REQUEST["message"])) { $message = $_REQUEST["message"]; } else { $message = LOGIN_INFO; } ?> <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title><?php echo "Inicio de sesión"; ?> </title> <link href="vendor/sweetalert-master/lib/sweet-alert.css" rel="stylesheet" type="text/css"/> <link href="css/css_mainstyles.css" rel="stylesheet"> <link href="css/css_login.css" rel="stylesheet"> </head>
/*********** Includes ***********/ include_once "../dao/acceso.php"; include_once "../utils/json.php"; include_once "../models/acceso.php"; include_once "../utils/session.php"; if (isset($_REQUEST["password"]) and isset($_REQUEST["user"])) { $pass = $_REQUEST["password"]; $user = $_REQUEST["user"]; $oAccess = new AccesoDAO(); $access = $oAccess->sendCredentials($pass, $user); $oJson = new JsonUtil(); if ($access != false) { /*Json parse*/ $json_access = $oJson->getJsonData($access, false); $jsonDecode = (array) json_decode($json_access); $accesoDecode = (array) $jsonDecode['data'][0]; /*Store model acceso*/ $oAccModel = new accesoModel(); $oAccModel->setUser($user); $oAccModel->setName($accesoDecode["acc_name"]); /*Store my session acceso*/ $oSession = new sessionUtil("acceso"); $oSession->storeMySession(serialize($oAccModel)); } else { $json_access = $oJson->getJson($oAccess->getMessage()); } echo $json_access; } else { // echo "ok"; return false; }