Post by gmoussa73 » Fri Oct 01, 2010 2:52 am

i need some help, i installed the latest opencart version v1.4.9.1 problem is ..admin timeout is so rediculously short! my host is ipage they said:
On our platform, the maximum session time out limit is set to 60 sec. Unfortunately, it is not possible to increase this limit.
that is so not practical...i have been working on some parts for 10 and 15 minutes..then boom! logged out and all the work is lost....there should be some solution around this...i have zero knowledge of programming and php things....i just search the forum for answers of my questions and follow what the ppl instruct to do......can anyone help plz? at least if there is any solution to re-log into the same page i was working on to continue working and NOT loose all the efforts spent on it?
opencart is a very good shopping cart...i had scored some progression towards publishing my shop and start operating...we sell books...we need to spend time filling info and reviews....not fare to be kicked out and loose the work!!
Last edited by i2Paq on Wed Oct 13, 2010 11:28 pm, edited 2 times in total.
Reason: Title adjusted

New member

Posts

Joined
Fri Oct 01, 2010 2:39 am

Post by JAY6390 » Fri Oct 01, 2010 8:18 am

It's possible to set a timeout in javascript that would run an AJAX call to your admin area say every 30 seconds. This would mean every 30 seconds you would keep the session alive. The best advice however that I can give you is move hosts if they have such a ridiculous time limit. Also, you have to remember that you will need to also do this on the front end, otherwise your customer orders will disappear after 60 seconds of inactivity!

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by gmoussa73 » Sat Oct 02, 2010 6:27 am

maaaaan thats so stupid...very annoying ,i cannot complete work on the shop this way???? there should be a way around it....can you explain your suggested way please? how can i do it??

New member

Posts

Joined
Fri Oct 01, 2010 2:39 am

Post by gmoussa73 » Sun Oct 03, 2010 6:39 am

dear jay...how to do this javascript thing? i want to try......

New member

Posts

Joined
Fri Oct 01, 2010 2:39 am

Post by i2Paq » Wed Oct 13, 2010 11:29 pm

Ask you host, it is their system that causes this.

If they cannot solve it for you: CHANGE HOST.

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by justinv » Sat Jul 30, 2011 11:59 am

I used this with success:

Code: Select all

<script type="text/javascript">
function pingServer() {
    $.ajax({ url: location.href });
}
$(document).ready(function() {
    setInterval('pingServer()', 20000);
});
</script>
Put it in admin/view/template/common/header.tpl, right before the closing head tag:

Code: Select all

</head>
It calls the page you're on and discards the result every 20000 milliseconds. Change the 20000 to whatever you need - every 60000 should be enough for even the worst web host (once a minute).

Documentation: OpenCart User Guide
Mods: Total Import PRO | CSV Import PRO | Ecom Tracking | Any Feed | Autosuggest | OpenCart CDN
Image


Active Member

Posts

Joined
Tue Oct 12, 2010 1:24 pm

Post by shiokguy » Tue Aug 30, 2011 7:52 pm

I am using V1.5.1.1 with default Template

I would like my Admin to auto logout after said 30 min of inactivity. How can I do that?
My admin is logon forever, and I like it to logout automatically

Regards
ShiokGuy

New member

Posts

Joined
Wed Jul 13, 2011 3:28 pm

Post by obd1965 » Tue Sep 20, 2011 11:12 pm

I'm looking for the same in 1.4.8

Newbie

Posts

Joined
Tue Sep 20, 2011 11:11 pm

Post by DrunkMunki » Tue Oct 11, 2011 4:30 pm

where exactly on the server side do we change this?
is it in the php.ini file ? whats the variable?

Newbie

Posts

Joined
Sun Jul 17, 2011 6:02 pm

Post by ruslyrossi » Tue Dec 06, 2011 11:59 am

thanks @justinv..its work for me...simple

User avatar
New member

Posts

Joined
Mon Feb 28, 2011 12:28 pm

Post by nzplayer » Mon May 14, 2012 2:13 pm

justinv wrote:I used this with success:

Code: Select all

<script type="text/javascript">
function pingServer() {
    $.ajax({ url: location.href });
}
$(document).ready(function() {
    setInterval('pingServer()', 20000);
});
</script>
Put it in admin/view/template/common/header.tpl, right before the closing head tag:

Code: Select all

</head>
It calls the page you're on and discards the result every 20000 milliseconds. Change the 20000 to whatever you need - every 60000 should be enough for even the worst web host (once a minute).
I have written a VQmod with your code above in it (Thanks I needed it as well).

Newbie

Posts

Joined
Fri May 11, 2012 5:33 am

Post by mrspeakers » Thu May 17, 2012 3:00 pm

I can't actually get into the header (or footer) to edit using ipage as a host. They say it's an opencart problem, but it is obviously an issue with their ftp filemanager. Anyone know any solutions?

Newbie

Posts

Joined
Thu May 17, 2012 2:25 pm

Post by Ampeter » Thu Feb 06, 2014 2:48 am

I just checked your vqmod. Why did you use location.url instead of location.href? (I think location.url does not exist, at least in javascript). ???

User avatar
New member

Posts

Joined
Thu Jan 13, 2011 5:01 pm

Post by BionicBill » Sun Jun 18, 2017 1:43 am

I too was having this admin timeout issue and spent 2hours with my hosting provider that was looking around the web and found this tidbit
Just add this to you admin php.ini file: This set the cookie timeout to as long as the browser is open! and looks to have fixed my timeout issue,
You might also add it to your main php.ini file.

session.cookie_lifetime = 0;

New member

Posts

Joined
Tue Dec 04, 2012 4:08 am

Post by TomB » Mon Nov 01, 2021 4:47 am

I'm using version 3.0.3.8 and changed my customer and admin timeouts from 24 minutes to 1 hour by doing the following:
Note:
Changed the "Expire" timeout as kept in the database table "oc_session".
It was defaulting to 24 minutes and I changed to 3600 seconds (1 hour).

Changed (int)$this->maxlifetime)) to 3600 in the following section of code, which is in "system/library/session/db.php"
public function write($session_id, $data) {
if ($session_id) {
$this->db->query("REPLACE INTO `" . DB_PREFIX . "session` SET `session_id` = '" . $this->db->escape($session_id) . "', `data` = '" . $this->db->escape(json_encode($data)) . "', `expire` = '" . $this->db->escape(date('Y-m-d H:i:s', time() + (int)$this->maxlifetime)) . "'");
}

It becomes:
public function write($session_id, $data) {
if ($session_id) {
$this->db->query("REPLACE INTO `" . DB_PREFIX . "session` SET `session_id` = '" . $this->db->escape($session_id) . "', `data` = '" . $this->db->escape(json_encode($data)) . "', `expire` = '" . $this->db->escape(date('Y-m-d H:i:s', time() + 3600)) . "'");
}

I verified the change works by tracking the "expire" column in the oc_session table.

Newbie

Posts

Joined
Mon Dec 14, 2015 12:53 am

Post by straightlight » Mon Nov 01, 2021 7:26 am

TomB wrote:
Mon Nov 01, 2021 4:47 am
I'm using version 3.0.3.8 and changed my customer and admin timeouts from 24 minutes to 1 hour by doing the following:
Note:
Changed the "Expire" timeout as kept in the database table "oc_session".
It was defaulting to 24 minutes and I changed to 3600 seconds (1 hour).

Changed (int)$this->maxlifetime)) to 3600 in the following section of code, which is in "system/library/session/db.php"
public function write($session_id, $data) {
if ($session_id) {
$this->db->query("REPLACE INTO `" . DB_PREFIX . "session` SET `session_id` = '" . $this->db->escape($session_id) . "', `data` = '" . $this->db->escape(json_encode($data)) . "', `expire` = '" . $this->db->escape(date('Y-m-d H:i:s', time() + (int)$this->maxlifetime)) . "'");
}

It becomes:
public function write($session_id, $data) {
if ($session_id) {
$this->db->query("REPLACE INTO `" . DB_PREFIX . "session` SET `session_id` = '" . $this->db->escape($session_id) . "', `data` = '" . $this->db->escape(json_encode($data)) . "', `expire` = '" . $this->db->escape(date('Y-m-d H:i:s', time() + 3600)) . "'");
}

I verified the change works by tracking the "expire" column in the oc_session table.
Those changes are for DB sessions but won't rectify the issue with file sessions.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 26 guests