faqts : Computers : Programming : Languages : PHP : Common Problems : Cookies

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

8 of 16 people (50%) answered Yes
Recently 4 of 10 people (40%) answered Yes

Entry

There is a problem if you use the session in the PHP it send the session ID as a cookie if one wants not to except the cookie than what is the alternative

Mar 2nd, 2001 06:03
Mike Boucher, Harwant Grewal, http://www.php.net/manual/en/ref.session.php


This is straight from the PHP Manual:
There are two methods to propagate a session id: 
*	Cookies 
*	URL parameter 
The session module supports both methods. Cookies are 
optimal, but since they are not reliable (clients are not bound to 
accept them), we cannot rely on them. The second method 
embeds the session id directly into URLs. 
PHP is capable of doing this transparently when compiled with 
--enable-trans-sid. If you enable this option, relative URIs will be 
changed to contain the session id automatically. Alternatively, you 
can use the constant SID which is defined, if the client did not 
send the appropriate cookie. SID is either of the form 
session_name=session_id or is an empty string. 
The following example demonstrates how to register a variable, 
and how to link correctly to another page using SID. 
Example 3 (http://www.php.net):
<php?
# the <?=SID?> is necessary to preserve the session id
# in the case that the user has disabled cookies
?>
To continue, <A HREF="nextpage.php?<?=SID?>">click here</A>
-----------------------------------------------------
I am still searching on it......
Harry