Answer the question
In order to leave comments, you need to log in
AJAX session check. How to do?
There is a website and an admin panel. The admin panel is completely AJAX. If you enter the admin panel, and log out on the site, then the session remains in the admin panel. There is a script in the admin/ajax.php directory that handles requests from the admin area. It is necessary to terminate the session in the admin panel when exiting through the site. At the beginning of ajax.php I inserted the following code:
session_start();
require_once("../auth.php");
$auth = new AuthClass();
$access = $auth->isAdmin(); // проверка на авторизованного админа
if(!$access){
header("HTTP/1.1 301 Moved Permanently");
header("Location: ../index.php");
exit();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question