Page 1 of 1

session lost(SOLVED)

Posted: Sun Jan 21, 2007 9:06 am
by mr00047
Hi

i have a page that take some user input and save the data to the mysql database. every user identified by the userid that i bind into a session variable $_SESSION['userid'] after successful login. the page i get after a successful login, i have couple of fields to give input. i am posting the form to the same page i am taking the user input and then storing that into the database with the session userid. my problem is if i do the same activitiy several time on the page, posting the form several time, then suddenly it lost the session data i.e, $_SESSION['userid'].

any solution/advise will be highly appreciated!

Thanks.

Hassan

Posted: Sun Jan 21, 2007 12:05 pm
by m3mn0n
Post your code to we can maybe spot errors/give advice.

(Moving this to PHP - Code)

Posted: Mon Jan 22, 2007 5:49 am
by mr00047
Hi

hey, I have solved the problem. The reason was my server was a shared hosting. I have just added two line of code to my configure file before starting my session.

Code: Select all

ini_set("session.gc_maxlifetime","3600"); 
session_save_path("my/own/sesfiles"); 
session_start();
the session_save_path did the trick. it changed the session file saving directory to my own pointed directory so that my session data doesnt get messed up with others.

Thanks. :D