hello everybody. i am trying to set up a script where links are directed to a page for 5 seconds, then redirected to the original page. for example, if you click on a link to mysite.com/help.php you will be taken to ad.php then redirected back to help.php.
to do this i am using html redirects

<html>
<head>

<?php

if($_SERVER['HTTP_REFERER'] != 'http://www.mysite.com/ad.php')
{
echo '<META HTTP-EQUIV="Refresh" CONTENT="0;URL=http://www.mysite.com/ad.php">';
}
?>
</head>
<body>

and it redirects fine. the problem i have is getting it back to the refering page. on ad.php i have this

<html>
<head>
<META HTTP-EQUIV="Refresh" CONTENT="5;URL=<?PHP echo $_SERVER['HTTP_REFERER']; ?>"
</head>
<body>

which works if i click on a link directly to ad.php. but when i use a redirection like in the top example, ad.php just refreshes itself without ever going back to the refering page. i have tried adding

<?PHP
echo $_SERVER['HTTP_REFERER'];
?>

to the ad.php file which displays the refering page when it is linked to directly, but when the redirect is used the echo is not displayed and i can only assume that $_SERVER['HTTP_REFERER'] is not being set.

Here is an example of my problem if you need it http://www.tomyn.com/trill.php

sorry for the long explanation. Any ideas on why this would happen?
thanks

    Meta refresh doesn't send the referrer. Here's what I've found on another site:

    Just a technical note: A meta-refresh is not an http redirect. It is a client-side reload. Therefore, the referer header (an http header that may be sent with each request to the server) is not updated to reflect the URL of the page invoking the meta-refresh.

    source

      no worries. it seems that javascript page redirects work ok.

      <?php
      
      if(isset($_SERVER['HTTP_REFERER']))
      {
      echo "<script language=\"JavaScript\"><!--\n"; 
      echo "var time = null\n";
      echo "function move() {\n";
      echo "window.location = 'http://www.mysite.com/ad.php'\n";
      echo "}\n";
      echo "//-->\n";
      echo "</script>\n";
      }
      ?>
      </head>
      <body>
      <?PHP
      echo "referer = {$_SERVER['HTTP_REFERER']}";
      ?>
      <body  onload="timer=setTimeout('move()',0000)">
      <font size="36">original page</font>
      </body>
      

      and meta refreshes on the ad page so the referer wont be set. sweet

        Write a Reply...