Forum Moderators: coopster
<?PHP
$a = $_GET['a'];
if ($a == "") {$link = "http://example.com/index2.php";} // Default Blank
if ($a == "topic") {$link = "http://example2.com/aff_link";}
header("refresh: 0; $link")¦;
exit();
?>
(pipe broken by forum)
The problem is it works perfectly in firefox (2.0.012) and has a blank
referrer at the affiliate end as intended, but in Internet Explorer
(7.0.6000) it 'loops' and tries to reload continuously.
Does anyone know how can this be modified to remedy the looping in IE please?
Thank you in advance,
popzzz
The pipe symbol does NOT belong in the code.
Correct code is:
<?PHP
$a = $_GET['a'];
if ($a == "") {$link = "http://example.com/index2.php";} // Default Blank
if ($a == "topic") {$link = "http://example2.com/aff_link";}
header("refresh: 0; $link");
exit();
?>
Sorry for any confusion and thanks again,
popzzz
Let me try to reclarify ...
I am trying to eliminate referrer from site A showing up on site C.
Would prefer site B as referrer or simply NO referrer at all.
as example:
A > B(redirect) > C = B or blank referrer
The php script above is for multi links. (php on site B)
.htaccess converts the 'topic' into a variable for the php to select the outgoing link to redirect to.
i.e. example.com/topic is rewritten to example.com/index.php?a=topic to be used by the php script above.
Net result ... one file to edit with multi links, and (hopefully) no reference back to site A on site C.
I hope this made sense.
my last post was directed to the fact that you mentioned IE was keeping the original referer even though you passed it through the script. I was saying that output may stop this.
put your script on B and keep echoing the referer on C. Play around with the script on B and see what makes a difference.
If someone enters a bogus or non-existent name that does not pre-exist in the file such as
example.com/index.php?a=bogus the script loops and trys to reload continuosly.
I've tested all my limited knowledge allows, but can't seem to come up with a solution.
Can anyone shed any light on this?
Thank you in advance,
popzzz
$a = $_GET['a'];
if ($a == "") {$link = "http://example.com/index2.php";} // Default Blank
[b]elseif[/b] ($a == "topic") {$link = "http://example2.com/aff_link";}
[b]else[/b] {
// do something.
}
header('refresh: 0; url="$link"'); // or whatever code you are using
exit();
$a = $_GET['a'];
if ($a == "topic") {$link = "http://example2.com/aff_link";}
else ($a == "") {$link = "http://example.com/index2.php";}
Also remember that the referer is part of the $_SERVER [uk.php.net] array, so you can alter it to whatever you like.
Hmmmmm ...
I took the
if ($a == "") {$link = "http://example.com/index2.php";} // Default Blank
from the top and moved it to the bottom just as you have it as
else ($a == "") {$link = "http://example.com/index2.php";} // Default Blank
and it returns
Parse error: syntax error, unexpected '{'
The parse error would indicate a mismatched pair from what I can determine but have checked closely and all pairs are matched.
Stuck again ....
For clarity the new code looks like:
$a = $_GET['a'];
if ($a == "topic") {$link = "http://example2.com/aff_link";}
else ($a == "") {$link = "http://example.com/index2.php";} // Default Blank
header("refresh: 0; $link");
exit();
Am I missing something?
Thank you in advance,
popzzz
$a = $_GET['a'];
if ($a == "topic") {
$link = "http://example2.com/aff_link";
}
else [b]/* ($a == "") */[/b] {
$link = "http://example.com/index2.php"; // blank page
}
header("refresh: 0; $link");
exit();
if (isset($_GET['a'])) { // check to see if a is set
$a = $_GET['a'];
}
else {
$a = ''; // if not set then set it to blank string
}
if ($a == "topic") {
$link = "http://example2.com/aff_link";
}
else {
$link = "http://example.com/index2.php"; // blank page
}
header("refresh: 0; $link");
exit('Testing, should not be shown');
Hope that works for you.
I take it that index2.php is the page where you are running this code? As if you redirect people who dont have $_GET['a'] = topic then you will get a continual loop of redirection. Try this as hopefully it will explain what is going wrong -
if (isset($_GET['a'])) { // check to see if a is set
$a = $_GET['a'];
}
else {
$a = ''; // if not set then set it to blank string
}
if ($a == "topic") {
header("refresh: 0; url=http://example2.com/aff_link");
}
else {
die('You dont have $a == "topic"...naughty boy');
// $link = "http://example.com/index2.php"; // blank page
}
// header("refresh: 0; $link");
exit('Testing, should not be shown');