Okay, Here's my problem. I want to use a two page validation sequence in my site. PAGE1 checks to make sure the user is coming from within the website. PAGE2 checks to make sure it's coming from PAGE1.
The source I use on PAGE1.PHP looks like this.
<script language="php">
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
if (substr_count(getenv("HTTP_REFERER"),"www.mysite.com") != 1)
{
exit;
}
// Redirect to PAGE2 allowing PAGE2 to see it came from PAGE1
// [Code needed here!]
</script>
The source I use on PAGE2.PHP looks like this.
<script language="php">
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
if (substr_count(getenv("HTTP_REFERER"),"www.mysite.com/page1.php") != 1)
{
exit;
}
// Render the actual page
</script>
And just for the record, PAGE0.HTM looks like this
<html>
<body>
<a href='http://www.mysite.com/page1.php">Click Here</a>
</body>
</html>
I need code to redirect to PAGE2 and I've tried using the "header ("Location: www.mysite.com/page2.php") but then PAGE2 doesn't know that PAGE1 redirected. It assumes the calling page (PAGE0) is the referring page. If I use a "<meta http-equiv="refresh" content="0;URL=www.mysite.com/page2.php"> then the getenv("HTTP_REFERER") is BLANK, and thus failes the validation check!
Can a PHP Guru please help. I imagine this is a really simply problem, but for some reason I can't seem to make the magic happen!