In general, our management background is the use of frameset to layout, so if we set the login session time in the background, then after the expiration of the session, then we must be in the PHP file to determine processing.
After you have determined that the session is invalid, you should go to the landing page and let the user log back in again.
If we use the header of PHP directly to achieve the jump, then the code is:
<? PHP if (......) {// session is invalid $url = ' login.php '; Header (' Location: '. $url );}? >
In the process of use, I found that the login.php page that was reloaded after this jump will only appear in the frame id= "mainframe", see:
The background page layout is as follows:
<Framesetrows= "70,*"cols="*"frameborder= "No"Border= "0"framespacing= "0"> <Framesrc= "Index.php?action_type=top"name= "Topframe"scrolling= "No"noresize= "Noresize"ID= "Topframe"title="" /> <Framesetcols= "225,*"frameborder= "No"Border= "0"framespacing= "0"> <Framesrc= "Index.php?action_type=menu"name= "Menuframe"scrolling= "No"noresize= "Noresize"ID= "Menuframe"title="" /> <Frameclass= "Framebordertop"src= "Index.php?action_type=login-info"name= "mainframe"scrolling= "Auto"noresize= "Noresize"ID= "mainframe"title="" /> </Frameset></Frameset><noframes><Body></Body></noframes>
I should check the usage of the header (' Location: ... ') in PHP manual, http://hk2.php.net/manual/zh/function.header.php.
Later I used the code that StackOverflow someone else to solve the problem:
<? PHP if ($_session[' admin_id ']== ') { //header (' Location:login.php '); die ("<script> if (typeof (parent)! = ' undefined ') { parent.window.location = ' login.php '; } else{ window.location.href = ' login.php '; } </script>");}? >
[FRAMESET] [PHP] Frameset below use Php-header (' Location: ... ') redirect link