session lost(SOLVED)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mr00047
Forum Newbie
Posts: 14
Joined: Fri May 12, 2006 1:01 pm

session lost(SOLVED)

Post 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
Last edited by mr00047 on Mon Jan 22, 2007 5:40 am, edited 1 time in total.
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Post your code to we can maybe spot errors/give advice.

(Moving this to PHP - Code)
mr00047
Forum Newbie
Posts: 14
Joined: Fri May 12, 2006 1:01 pm

Post 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
Post Reply