No errors... in the logs or shown. Errors is turned on.
Here is what I'm using and how i have it setup on a working page.
Code: Select all
<?php
$var1="empty";
if (isset($var1=$_COOKIE["il8"])){
$var1=="45";
}else{
header("location:http://login.php");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Ivy League Compliance</title>
<link href="../ivy0808.css" rel="stylesheet" type="text/css" />
<link href="../menu.css" rel="stylesheet" type="text/css" />
</head>
<body>
Some text is here and the rest of the pages information.
</body>
</html>
If I put the script on a blank page and I run it as readcookie.php it finds the cookie and will does nothing. It will echo out the cookie info when i put 'echo' in the script so I know the script works.
Once the code is on this page it redirects, in essence; not see the cookie and sends the user to another page. Even though the cookie is there.
If I remove the script the page functions fine. I know I don't have anything wrong with the page. I know the script works by itself. How do I get the two to work together?
All I want to do is verify the cookie is there, if not send them back to the login page. Can this be done? Or can someone show me how to do it correctly.
I have even modified the script more to see if this might work. But this too has failed to find the cookie.
Code: Select all
<?php
if (!isset($_COOKIE["il8"])){
header("location:http://login.php");
}
?>
Just as above; this will always send me to the login.php even if the cookie is there.