I have a page that I don't want anyone to be able to link directly to. The
page should only be accessed from gatepage.php. I tried this code, but keep
getting errors - "header info already sent", or something like that... Am I
missing something, or is there a better way to do this?
<?php
$ref = $_SERVER["HTTP_REFER ER"];
//echo $ref;
if ( $ref == 'http://www.mydomain.co m/gatepage.php' )
{
//record visit
}
else
{
//send to gatepage.php
header("Locatio n:http://www.somegatepag e.com");
exit;
}
?>
Thanks.
page should only be accessed from gatepage.php. I tried this code, but keep
getting errors - "header info already sent", or something like that... Am I
missing something, or is there a better way to do this?
<?php
$ref = $_SERVER["HTTP_REFER ER"];
//echo $ref;
if ( $ref == 'http://www.mydomain.co m/gatepage.php' )
{
//record visit
}
else
{
//send to gatepage.php
header("Locatio n:http://www.somegatepag e.com");
exit;
}
?>
Thanks.
Comment