...

View Full Version : Cookie Redirection problem



Athmaus
03-06-2008, 07:30 PM
i am trying to make a "back" feature on a web site where the user can go back to a previous page. The problem is that when the user goes back to the page, the cached version of the page is coming up and not running the php again. is there a code i can put inside a page that will enable it to reload every time a user lands on a page?

also, I am having a problem with a php script writing and retrieving cookies. is there something i

am missing in code below?

this is on the first page (setting the cookies)


<?php
setcookie("onDemandExitTab", "news");
setcookie("onDemandExitTabID", 2);
?>

this is on the second page (reading the cookie)


<?php

if ($_COOKIE['onDemandExitTab'])
{
$startTab = $_COOKIE['onDemandExitTab'];
$startTabID = $_COOKIE['onDemandExitTabID'];
}
else
{
$startTab = "networks";
$startTabID = 0;
}
?>

Any help would be greatly apprecaited

mlseim
03-06-2008, 08:28 PM
Try this ... in the <head> section of your page.


<head>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="-1">
</head>

Athmaus
03-06-2008, 10:42 PM
thanks for the reply

that didnt work.

Rohan_Shenoy
03-06-2008, 10:58 PM
^try putting it at the bottom of the page. So you could would look something like:



<html>
<head>
//1st set of headers
</head>
<body>
</body>
<head>
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="-1">
</head>
</html>


This is some logic which I remember reading. It says that the no cache and pragma commands will work only if atleast 64K data has been sent to the browser. I don't remember exactly what it was.

aah, got the link: http://www.htmlgoodies.com/beyond/reference/article.php/3472881

mlseim
03-07-2008, 03:49 AM
I have another thing for you to try ...

When you redirect back to the first page,
use the WHOLE URL in the redirect.
Example: http://www.mysite.com/pageone.php

That might force a refresh ...
Something I seem to remember from way back.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum