note 90007 deleted from function.session-start by peehaa
| From: | peehaa@php.net | Date: | Fri, 09 Dec 2016 22:24:10 +0000 |
| Subject: | note 90007 deleted from function.session-start by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208356@lists.php.net to get a copy of this message | ||
Note Submitter: Gravis
----
If you want to check if a session has already been activated, you can check
$_COOKIE["PHPSESSID"] for a value before reactivating that session.
Example code:
== login.php ==
<?php
session_start();
$_SESSION["data"] = "you have an active session!";
echo "<a href=\"page.php\">go</a>";
?>
== page.php ==
<?php
if(isset($_COOKIE["PHPSESSID"]))
{
session_start();
echo $_SESSION["data"];
}
else
{
echo "no cookies required!";
}
?>
This can prevent forcing a cookie on someone (very annoying in lynx) that doesnt intend to login on
your site.