these are just some general questions.
1. i know i have to call session_id() before session_start(); but why? i read the php.net manual but just don't understand exactly why.
2. i can't use SID ( host issues i think ), so i always echo out the session id by using echo session_id();
is that perfectly fine?
3. why do most sites put the session id in the url? if you have session_id(); at the top of every page, won't it just use that one?
and uh... i think thats it for now. I got a few more, but maybe one of the answers here will fix what i'm doing
session_id() questions...
Started by coolaid, Sep 22 2006 09:04 PM
5 replies to this topic
#1
Posted 22 September 2006 - 09:04 PM
#2
Posted 22 September 2006 - 11:16 PM
I belive I read somewhere that if the user has cookies off, or you change something in PHP.INI (I don't know what part) it puts the id in the url. I have no clude for the rest of you questions
#3
Posted 23 September 2006 - 01:24 PM
i've always gotten that session_id() will be available at $_SESSION["PHPSESSID"].
#4
Posted 24 September 2006 - 03:12 PM
php.net said:
session_id() is used to get or set the session id for the current session.
php.net said:
If id is specified, it will replace the current session id. session_id() needs to be called before session_start() for that purpose.
2. Ya, but calling a function multiple times for no reason slows the server down. So cheat.
define('SESSION_ID', session_id());
3. php.net said:
Passing the Session ID
There are two methods to propagate a session id:
Cookies
URL parameter
The session module supports both methods. Cookies are optimal, but because they are not always available, we also provide an alternative way. The second method embeds the session id directly into URLs.
There are two methods to propagate a session id:
Cookies
URL parameter
The session module supports both methods. Cookies are optimal, but because they are not always available, we also provide an alternative way. The second method embeds the session id directly into URLs.
References:
http://php.net/manua....session-id.php
http://php.net/manua...ssion-start.php
http://php.net/manua...ssion.idpassing
Edited by rc69, 24 September 2006 - 03:13 PM.
#5
Posted 24 September 2006 - 07:07 PM
It's in the pnp.ini file that it's specified whether or not to put SID in the URL.
#6
Posted 25 September 2006 - 03:35 PM
Thats true, but that's not the problem.
The problem is, he can't use SID, he can use session_id() as a substitute for it. I recommended setting his own constant to save calling the same function multiple times.
But incase i misunderstood something, append_sid is the setting in the php.ini file.
coolaid, on Sep 22 2006, 08:04 PM, said:
2. i can't use SID ( host issues i think ), so i always echo out the session id by using echo session_id();
is that perfectly fine?
is that perfectly fine?
But incase i misunderstood something, append_sid is the setting in the php.ini file.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
