This topic is locked
[SOLVED]

 Redirect on Session Timeout

2/24/2019 4:56:09 AM
PHPRunner General questions
A
acpan author

Hi,
I need to redirect the page to another custom page when session timeout, instead of the default login screen.

Reason being, i use a custom page for login at a seperate php file than the default login.php.
Any idea would be greatly appreciated!
ACP

Admin 2/24/2019

Probably using a custom login page is a bad idea compared to adding extra functionality to your existing login page.
Anyway, you can try something like this in AfterAppInit event:

if (!isset($_SESSION["UserID"]) || $_SESSION["UserID"]=="" )

{

header("Location: custom_login.php");

exit();

}
A
acpan author 2/25/2019

Thanks you,
It works!
You gave a best practice followed by a solution to my problem! Really thoughtful support!
ACP



Probably using a custom login page is a bad idea compared to adding extra functionality to your existing login page.
Anyway, you can try something like this in AfterAppInit event:

if (!isset($_SESSION["UserID"]) || $_SESSION["UserID"]=="" )

{

header("Location: custom_login.php");

exit();

}