Solution to ecshop background logon timeout session expiration

Source: Internet
Author: User

Modify it in includescls_session.php

The code is as follows: Copy code

Var $ max_life_time = 1440;

// Number in the SESSION Expiration Time and unit: seconds. The unit of this number is seconds. Both the frontend logon and background logon call the time set here.

2 rows, let the page select this item by default! The new version is a bit more secure. It takes almost five minutes to log on to the backend. Is there a way to change it because it takes only three minutes, therefore, we often time out during the input process, so we need to increase the time-out period.

The modification method is as follows:

Schemdes/init. php
Api/init. php
Admin/shortdes/init. php
Wap/shortdes/init. php

Find the following code from the above files

The code is as follows: Copy code

@ Ini_set ('session. cache_expire ', 180); // unit: Seconds

Of course, in addition to the above method, we can also modify the php configuration file to operate it.

To continue with the Session topic in PHP, we mainly set session. gc_maxlifetime to set the Session lifecycle. For example:

The code is as follows: Copy code

<? Php
Ini_set ('session. Gc_maxlifetime', 3600); // Set the time
Ini_get ('session. Gc_maxlifetime'); // obtain the value set in ini.
?>

The following provides a function encapsulated by someone else, but I have not tested it. It is for reference only:

The code is as follows: Copy code

<? Php
Function start_session ($ expire = 0)
    {
If ($ expire = 0 ){
$ Expire = ini_get ('session. Gc_maxlifetime ');
} Else {
Ini_set ('session. Gc_maxlifetime', $ expire );
    }
    
If (empty ($ _ COOKIE ['phpsessid ']) {
Session_set_cookie_params ($ expire );
Session_start ();
} Else {
Session_start ();
Setcookie ('phpsessid ', session_id (), time () + $ expire );
    }
    }
?>

Usage:

Add start_session (600); // expire after 600 seconds.

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.