Hello everybody, I'm not a coder so please treat me like an idiot and put everything into the simplest terms you can.
Basically I have a php page on my site which is designed to redirect to another location based on the url of the surfer:
i.e.
So as you can see it works on a magic number.http://www.mydomain.com/page.php?mn=1234 goes to location a
http://www.mydomain.com/page.php goes to location b
But when I use it without the magic number everything works fine, but when used with the magic number it just sits there trying to load a page. I've tried changing the location to google and still the same so I assume it's a code or server problem.
Any help would be appreciated:
Code: Select all
<?php
//Settings
$magic_number = 1; // Any number you choose except ZERO!
$cpa_offer_url = 'http://www.google.com';
$red_method = 0; // 0 = JS Form, 1 = JS, 2 = Meta Refresh
$form_method = 0; // 0 = POST, 1 = GET
//Don't edit below this line unless you know what you are doing.
if (isset($_GET['mn']) && $_GET['mn']==$magic_number){
echo '<html><head></head><body><form action="' . 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'] . '" method="post" id="form1">
<input type="hidden" name="mn" value="' . $magic_number . '" /></form>
<script language="JavaScript">
document.getElementById(\'form1\').submit();</script></body></html>';
return true;
exit();
}
if ($_POST['mn']==$magic_number){
if($red_method==0) {
if($form_method==0)
$formmethod = "POST";
else
$formmethod = "GET";
echo '<html><head></head><body><form action="' . $cpa_offer_url . '" method="' . $formmethod . '" id="form1"></form>
<script language="JavaScript">
document.getElementById(\'form1\').submit();
</script></body></html>';
}
else if($red_method == 1)
echo '<HEAD>
<SCRIPT language="JavaScript">
<!--
window.location="' . $cpa_offer_url . '";
//-->
</SCRIPT>
</HEAD>';
else echo '<meta http-equiv="refresh" content=0;url=' . $cpa_offer_url . '>';
exit();
}
?>
<html>
<head>
<title>page 1</title>
</head>
<body>
<br><br><br><br>
<center><h1>page 1</h1></center>
</body>
</html>
Thank you all in advance.