Excuse me, your session has expired please re-login

Source: Internet
Author: User
Ask, your session has expired please re-login?
This post was last edited by u010572351 on 2013-06-29 18:34:28

I do a simple user login system to realize that your session has expired please re-login this feature:

1. Landing page, the user first login, I'm sure there's no hint .。

2. The user login success, the corresponding page, and soon the session expired, forced to jump to the landing page, but also prompted a word to the user: your session has expired please re-login, how does this come true?

Share to:


------Solution--------------------
$_seesion
------Solution--------------------
Http://hi.baidu.com/liang_1989/item/89706bc7068d3274ced4f8d5
------Solution--------------------
You can set the length of time the cookie expires.
------Solution--------------------
Session sets the expiration time of the user ID. Setting a cookie to fail is often used to determine user page jumps
------Solution--------------------
http://fushidian.blog.163.com/blog/static/567656992010102522713846/
------Solution--------------------
Upstairs set sesion time should not be able to achieve the landlord's purpose, because the value is not the same as no login status, and can not be detected, you may set a variable in the SESSION to save time, such as $_session[' exptime '] = Now () +3600 To specify a time-out after 3,600 seconds, and then check the login status to determine if $_session[' exptime ' is greater than now () to make a judgment!
------Solution--------------------
I think it should not be detected in the login location. Should be detected at the next operation,
Log in after completion of the next time, such as 10 minutes to deposit $_session[' Exptime ' =now () +600
Then each action is to detect whether the login status
Like what

if (!isset ($_session[' username '))
------Solution--------------------
$_session[' username ']) {

$_session[' tips ']= "";
。。。 Jump Login Page
}else{
if ($_session[' Exptime ') <>
$_session[' username ']= "//Clear off the original state
$_session[' tips ']= "Your session has expired please re-login";
。。。 Jump Sign-in page: and output $_session[' tips ']
}

}
$_session[' Exptime ']= finish () +600;
Reset $_session[' Exptime ' after detection is complete
  • 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.