Trouble baking a cookie with a redirect.
Posted: Sat Dec 02, 2006 1:24 pm
When a user gets redirected for not having yet logged in I want to pass the page they where trying to access so when correctly authenticate I can send them back to where they came, but I cant seem to set a cookie this cookie.
I really appreciate any guidance. Also if you think I should be doing this all different then please let me know what you suggest.
Page 1
Try to display the cookie here and it appears not to be set. As it does not echo the cookie value.
Page 2
I really appreciate any guidance. Also if you think I should be doing this all different then please let me know what you suggest.
Page 1
Code: Select all
<?php
$value = "https://www.web.com/office/admin/queries.php";
setcookie("TestCookie", $value);
//Only Allows Authenticated users to access the page
$Techs = $_COOKIE["Techs"];
if(!isset($Techs)) {
$page = "https://www.web.com/office/admin/queries.php";
setcookie("page",$page);
}
?>Page 2
Code: Select all
<html>
<head>
<meta http-equiv="refresh" content="2; URL=https://www.web.com/office/DB_authenticate.php">
</head>
<body>
<?php
echo "You must first login.";
echo $_COOKIE["TestCookie"]; //This just to see if the cookie is working
?>