Page 1 of 1

Im quitting sessions!

Posted: Mon Dec 29, 2003 1:08 pm
by lazersam
I have redesigned a big project in favour of sessions to keep track of my variables. The thing is one variable (not all) is incrementing by 1 everytime I start a session.

I cant find any reason for it whatsoever! On every page I test, it increments it by 1. There is no code or counters going... nothing!

The variable is $aff_id - it also comes in via the URL but so do other variables but they do not increment.

Any ideas?

Lawrence.

ps I think it is related to me not destoying sessions as I test the script. I think it is keeping an old value.

Posted: Mon Dec 29, 2003 1:30 pm
by Derfel Cadarn
ps I think it is related to me not destoying sessions as I test the script. I think it is keeping an old value.
And? Were U right?
If not you could give some code here perhaps? :wink:

Posted: Mon Dec 29, 2003 2:42 pm
by Gen-ik
You must be increasing the variable somewhere... they don't change unless you tell them to!

When you destroy a session make sure you unset the variables before destroying it... session_unset(); session_destroy();

Don't forget you all need session_start() at the top of each page which you know will need to access the session variables.

Posted: Tue Dec 30, 2003 4:33 am
by lazersam
Its very hard to test as now it works ok despite not working correctly yestoday. I am trying to re-create the variables and the the order I tested it but now it annoyingly works like a charm.

I think im going to destroy_session using a sub-script before starting a session every single time now.

It would be nice to destroy_session when the user leaves the domain - anyone know how to do that?

Lawrence.