[FRAMESET] [PHP] Frameset below use Php-header (' Location: ... ') redirect link

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.