youngcoder
Technical User
Please, can somebody help me with this script?
This redirect script takes the number from the end of link and assigns to URL from array.
Number 1 is second element (yahoo), number 2 is third element (google) etc.
I would like to change number at the end of URL with keyword and put pairs in array like:
array (
"yahoo" => ""google" => "http:// google.com"
);
So, when somebody come on page via URL "domain.com/?mn=yahoo" I would like to redirected him to
This redirect script takes the number from the end of link and assigns to URL from array.
Number 1 is second element (yahoo), number 2 is third element (google) etc.
I would like to change number at the end of URL with keyword and put pairs in array like:
array (
"yahoo" => ""google" => "http:// google.com"
);
So, when somebody come on page via URL "domain.com/?mn=yahoo" I would like to redirected him to
PHP:
<?php
//Standalone CPA Redirector v2.1 with multioffers
//Settings [URL unfurl="true"]http://dexony.com/insurance2/?mn=google[/URL]
//put in your desired offers in the array below , you can add as many as you want , but make sure
to enclose them with ""
// to match the desired domain you wonna link to , set the magicnumber to the position in the array
below
// to use your desired offer use [URL unfurl="true"]http://www.yourdomain.com/?mn=offernumber[/URL]
$offers = array (
"", // must be empty
"[URL unfurl="true"]http://www.yahoo.com/",[/URL] // ?mn=1
"[URL unfurl="true"]http://www.google.com/"[/URL] // ?mn=2
);
//you can specify a safenumber here, what it does it sets the magicnumber of the offer you would
like + it's value
//you normally don't need this, but if you don't want your magic numbers to start at 1 you can
change it here
// example if you set this to 50 and you want to use your first number it would be index.php?mn=51
$safemode = 0;
//Don't edit below this line unless you know what you are doing.
$PHP_SELF = preg_replace( "/index.php/", "", $_SERVER['PHP_SELF'] );
if (isset($_GET['mn'])) {
$magic_number = $_GET['mn'] - $safemode;
$cpa_offer_url = $offers[$magic_number];
setcookie("mnval",$magic_number,time()+10,"/");
setcookie("cpaval",$cpa_offer_url,time()+10,"/");
echo '<html><head><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"></head><body><form
action="' . '[URL unfurl="true"]http://'.$_SERVER[/URL]['HTTP_HOST'].$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']== $_COOKIE['mnval']) && (isset($_COOKIE['mnval']))) {
$magic_number = $_COOKIE['mnval'];
echo '<html><head><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"></head><body><form
action="' . '[URL unfurl="true"]http://'.$_SERVER[/URL]['HTTP_HOST'].$PHP_SELF. '" method="post" id="form1">
<input type="hidden" name="mn" value="' . $magic_number . $magic_number . '" /></form>
<script language="JavaScript">
document.getElementById(\'form1\').submit();</script></body></html>';
return true;
exit();
}
$dom = preg_replace( "/^[URL unfurl="true"]www\./",[/URL] "", $_SERVER[ 'HTTP_HOST' ] ) ;
$ref= $_SERVER['HTTP_REFERER'];
if (((strpos($ref, $dom)!=FALSE) || (trim($ref)=="" ) ) && (!isset($_GET['mn'])) &&
($_POST['mn']==$_COOKIE['mnval'].$_COOKIE['mnval']) && (isset($_COOKIE['mnval']))){
$cpa_offer_url = $_COOKIE['cpaval'];
header( 'Location: ' . $cpa_offer_url);
exit();
setcookie("mnval","",time()-60);
setcookie("cpaval","",time()-60);
}
?>
<html>
<head>
<title>your fake landing page</title>
</head>
<body>
<br><br><br><br>
<center><h1>text</h1></center>
</body>
</html>