Is a PHP redirect as effective as a double meta refresh?

Here is the code for the type of php double meta refresh I do--only requires 1 page. (You can name it whatever you want--it looks itself up for the first bounce.)

Code:
<?php
//Grab arguments from the GET string
$SEC = $_GET['S'];

//If on second bounce SEC = 1
if ( $SEC == '1' )
{
 //Validate (make sure the referer cleared)
 if ( $_SERVER['HTTP_REFERER'] == '' )
 {
   //Landing page
   $bounce_loc='referer.php';
 }
 else //Bad! dump them somewhere!
 {
   //Dump location (for metas that didn't clear)
   $bounce_loc="http://www.google.com";
 }
}
else //First time through--bounce them back!
{
 $self = $_SERVER['SCRIPT_NAME'];
 $bounce_loc="$self?S=1";
}
?>

<html>
<head>
<?php
print("<meta http-equiv=refresh content='0;url=$bounce_loc'>");
?>
</head>
<body>

</body>
</html>

Enjoy! Hope this helps :)

What you said would work fine--but I find this way very elegant ;-)

you are one smart human being :)
one file solution, didnt think of that, really
 
Nice script...thanks sent. This is much more concise than what I have been using. Appreciate the share.
 
this is better
PHP:
<?php
 $self = $_SERVER['SCRIPT_NAME'];

//Grab arguments from the GET string
$SEC = $_GET['S'];

//If on second bounce SEC = 1
if ( $SEC == '1' )
{
 if ( $_SERVER['HTTP_REFERER'] != $self )
 {
   //Landing page
   $bounce_loc='referer.php';
 }
 else //Bad! dump them somewhere!
 {
   //Dump location (for metas that didn't clear)
   $bounce_loc="http://www.google.com";
 }
}
else //First time through--bounce them back!
{

 $bounce_loc="$self?S=1";
}
?>

<html>
<head>
<?php
print("<meta http-equiv=refresh content='0;url=$bounce_loc'>");
?>
bye
 
this all sounds great but I don't want to lose any visitors, they are $$ to me. I don't know the best way to do that...anybody have any other ways? I'm trying to prevent networks from seeing my source
 
Back
Top