How you handle browsers that reject cookies depends on if your server has trans-sid on or off. You can check the status of trans-sid by using
<?
phpinfo();
?>
on a web page and searching for session.use_trans_sid. If it is 0 then it is off and you can skip the next section.
This option is off by default but if your server has trans-sid on, the session ID is appended to all relative links on you pages automatically. If the viewer is moved to another page by a header() function, or a form with a GET method, the ID is also appended. If the viewer is moved by a form with POST method, the session is passed in a hidden field. PHP uses a constant named PHPSESSID to name the session ID.
The session ID is only added to links that point to yuur own web pages using relative URL's. If the URL includes a server name, the session ID will not be appended. For example, if you add a link like:
<a href="index.php">Home</a>
PHP will automatically change it to something like
<a href="index.php?PHPSESSID=e25faed07430e449a1b628b4a3390889">Home</a>
If you use an absolute URL like
<a href="http://eclecticdjs.com/mike/tutorials/php/index.html">Home</a>
the session ID will not be appended.
If trans-sid is off and the browser rejects cookies, PHP will not automatically append the session ID so you must do it yourself. PHP provides a constant to make it easy. This constant is named SID and contains the PHPSESSID=value pair that you can add to a URL like this:
<?
<a href="index.php?<? echo SID?>">Home</a>
?>
For an example of this, I added it to the "^" lik on the top of this page. If you are a webtv user and use Ctrl-Cmd to see where the link goes, all you see on the end of the URL is a question mark. Now use a source code viewer which will not accept cookies and you'll see the PHPSESSID value pair appended.
|
|
|