note 88731 added to function.session-start
| From: | yesmarklapointe at hotmail dot com | Date: | Thu, 05 Feb 2009 00:32:51 +0000 |
| Subject: | note 88731 added to function.session-start | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-150238@lists.php.net to get a copy of this message | ||
Here is some info about how to use SID with session_start().
Experiment run on WAMPserver, PHP version 5.2.6.
Using FireFox 3.0.
The definition found at http://www.php.net/manual/en/session.constants.php
describes SID is a âpre-defined constantâ containing either:
1). the session name and session ID in the form of "name=ID" .
This is the same name as would be returned by session_name(), and the same id as would be returned
by session_id().
2). Or an empty string, if the session ID was set in an appropriate session cookie.
Example code:
<?php
session_start();
echo '<a href="page2.php?' . SID . '">page2</a>';
?>
This code will yield in the browser one of the following:
a). âpage 2â (as a hyperlink, but mouseover shows the link is to something in the
form of
http://www.mysite.com/page2.php?PHPSESSID=e2bd7072....
)
b). âpage 2â (as a hyperlink, but mouseover shows http://www.mysite.com/page2.php? )
Which result is determined by whether or not the browser is sending a matching session cookie back
to the script. Result âaâ above always appears at least initially since the script
hasnât yet set a cookie and neither has it been done automatically yet by the php.ini setting
session.use_cookies. However, after refreshing or using the back button, the form in "b"
will appear because then the cookie exists (either you set it or session.use_cookies did it
automatically).
----
Server IP: 69.147.83.197
Probable Submitter: 72.223.19.167
----
Manual Page -- http://www.php.net/manual/en/function.session-start.php
Edit -- https://master.php.net/note/edit/88731
Del: integrated -- https://master.php.net/note/delete/88731/integrated
Del: useless -- https://master.php.net/note/delete/88731/useless
Del: bad code -- https://master.php.net/note/delete/88731/bad+code
Del: spam -- https://master.php.net/note/delete/88731/spam
Del: non-english -- https://master.php.net/note/delete/88731/non-english
Del: in docs -- https://master.php.net/note/delete/88731/in+docs
Del: other reasons-- https://master.php.net/note/delete/88731
Reject -- https://master.php.net/note/reject/88731
Search -- https://master.php.net/manage/user-notes.php