Jump to content

Session Virus or worm?


bakbai

Recommended Posts

hello all,

please kindly assist me, i have a site that has been running well for over a year now till last week. the session fluctuate presenting the access denied page, like the session are unset, if one clicks another link, it might open as if the session are set. it goes back and front like that. the site is hosted somewhere, not locally. my hosted suggested that setenv TIMEOUT 300, setenv CPULIMIT 100 which i guest is not the case, cos, if it really unset the session due to time, how can it automatically set the session again?

 

 

please does anyone has an idea

Link to comment
Share on other sites

Check your PHPinfo to find what the current time-out is,

 

In any case, try this

 

Let's say your have index.php in your public_html folder

 

now first create a folder called "session" in the folder that contains "public_html" and make sure you have write access(777),

 

i.e.

root

|

|--public_html

|----+index.php

|--session

 

 

Now in index.php


//path to Session dir
$sessdir = dirname(__FILE__).'/../session';
//Create folder is it doesn't exist
if (!is_dir($sessdir)) { mkdir($sessdir, 0777); }
//change save location to the sessions path
session_save_path($sessdir));

ini_set('session.gc_probability', 1); //force on

// 2*60*60 = 2 hours
$sessionExpireTime=2*60*60;

//Change Garbage Collection to new life time
ini_set('session.gc_maxlifetime', $sessionExpireTime);

//Set cookie life time
session_set_cookie_params($sessionExpireTime);
session_start(); //as normal

//Update Cookie ExpireTime
if (isset($_COOKIE[session_name()])){
setcookie(session_name(), $_COOKIE[session_name()], time() + $sessionExpireTime, "/");
}

 

(please note theirs probably a ton of typos in the above but i hope it helps)

 

-MadTechie

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.