More session handling questions

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
umcookeg
Forum Newbie
Posts: 10
Joined: Mon Dec 22, 2003 10:16 am
Location: Winnipeg, Canada

More session handling questions

Post by umcookeg »

Hi

Do you need to have cookies enabled in order to use php sessions. I was under the impression that session data is stored server side and that users do not need to have cookies enabled is this true?
Today I was working at work, working in my site and everything was working fine. I was able to move through the site no problem in a browser with cookies disabled and cache set to 0.

Note: The web server is also on my machine used for testing.

I get home today want to work on the site and I can't log in because I don't have cookies enabled. Now I haven't touched my code at all I just wanted to see if I could use it from home.

So I am guessing that since I was using the site from the web server perhaps that is why everything was fine could this be true?

What can I do, besides URL re-writing, to allow users without cookies enabled to get access to my site?

Dave
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Do you need to have cookies enabled in order to use php sessions
Nope.
umcookeg
Forum Newbie
Posts: 10
Joined: Mon Dec 22, 2003 10:16 am
Location: Winnipeg, Canada

re sessions

Post by umcookeg »

if not then why am I getting this

Code: Select all

suv: Object
Survey object is set in the session variable suv
The usrs current question number will be:

Fatal error: Unknown(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition <b>survey</b> of the object you are trying to operate on was loaded _before_ the session was started in /srv/www/htdocs/Survey/processTrans.php on line 50
I only seem to get this after I have enabled

Code: Select all

session.use_trans_sid to 1
After I do this am I supposed to take out all my session-start functions at the top
of all my pages?

This afternoon I was working on this at work with cookies disabled on my browser the above configuration was set to 0 and I had no problems working
through the survey. I get home disable cookies on one of my browsers and I can't get into the site because it isn't maintaining my session data. So I get
kicked out. So I tried to enable the above configuration in php.ini and I
I get a nasty gram.

My computer at work that I was working on has the web server on it, I am using it for testing. Could that be why it worked at work but not at home?

Hellllp


PS I just wish the users that were going to go through the survey were allowed to use cookies.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

in every script where u want to get an object out the session, you need to include/require the class definition of that object.

if i remember well, you have to (un)serialize objects if you store/retrieve in a $_SESSION
Post Reply