Hi,
I have developed an (PHP)application which has been tested on different development servers.
So when I login to the app and navigate to a specific page just after loggin-in, the app logs-out and I have to re-enter the user credentials. But after loggin-in again, it works fine(and doesn't shows the log-in screen until we log-out). I wonder why it works in such an unpredictable way.!!
I have used session for security reasons and am quite eager to know if this is something to do with cache.
I am using the below code on almost all the pages of the app.(so that the user just can't enter the URL of the page and start accessing the application)
---------------------
session_start();
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
/*
The app matches the current session-ID with the session ID which previous page has sent and if it doesn't matches, LOG-Out.
*/
try {
if(($_GET['session'])==(session_id())){
// do nothing
}else{
echo '<script type="text/javascript">parent.location="../index.php";</script>';
}
}catch(Exception $e){
echo '<script type="text/javascript">parent.location="../index.php";</script>';
}
---------------
I strongly feel that if the app performs well on one server then it shud work perfectly fine on the other system.
I, however have no idea of the php.ini file on the server which throws this issue of loggin-out. but I can certainly find out the details if it is something to do with php.ini file.
If there's any modification I need to do in the cache setting, lemme know.
Any help/suggestion would be appreciated.
Virendra Maloo.