Reading cookie values?
Posted: Sun Dec 12, 2004 5:19 pm
I'm writing a MySQL user system as part of administration of a larger script. My problem here is setting a cookie or using sessions to make sure that the user can only view the 'protected' pages once they have logged in.
I know how to set cookies, but I do not know how to read cookies and can't seem to find any instructions on how to.
I'm guessing its somewhere along the lines of
Would using sessions be a better bet? I'd preferably use sessions but I'm a little intimidated.
I know how to set cookies, but I do not know how to read cookies and can't seem to find any instructions on how to.
I'm guessing its somewhere along the lines of
Code: Select all
<?php
$page = include("path/to/the/content.php");
$token = $_COOKIE["signedin"];
$cookie_on = "yes"
if ($token==$cookie_on)
{
echo $page;
} else {
header("Location:http://nobodycares.info/xmasfaces/admin/index.php");
}
?>