Offer Rotating Double Meta W/ Referrer Check

Diabolik

Newbie
Apr 11, 2011
0
243
Ok, I mashed up a bunch of code from another thread and made a nice little script.

Keep in mind, I am not a programmer...I can just put things together and test until it seems to work. Much like how Edison worked; Trial and Error...

Ok, so here's what I've come up with:

The challenge...

I wanted a script that could hide traffic from affiliate networks by checking if a blank referrer was being passed along during a double meta refresh and would boot the redirect if it passed along a referrer, but I also wanted to be able to alternate offers and mix up the traffic a little.

This way there isn't just one offer converting at a super high % and you could rig it with another offer that you KNOW will never convert and keep the numbers down....

Here we go -

First create a text file called "offers.txt" in notepad and just list a few urls for testing purposes (you can change these to you affiliate urls later)

List them like this, one on top of the other:

Code:
www.google.com
www.myspace.com
www.badgerbadgerbadger.com
(Note: Don't put the http:// part in there.)

Ok, that part's done...upload to server.

Now create a text file called "vip.php" in notepad and copy and paste this into it...

Code:
<?php

echo "<meta http-equiv=\"refresh\"content=\"0;url=go.php\">";

?>
Ok, that part's done...upload to server.

Now create a text file called "go.php" in notepad and copy and paste this into it...

Code:
<?php

// Open the File with offers to rotate
$sites = array_map("trim", file("offers.txt"));

// Choose a random site to shows
$redirect = $sites[array_rand($sites)];

$referer = $_SERVER['HTTP_REFERER']; if($referer == "")

//make the meta refresh to the random site in variable redirect
echo "<meta http-equiv=\"refresh\"content=\"0;url=http://".$redirect."\">";    

?>
Ok, that part's done...upload to server.

Now you're done. To test it, just go to the first link in the chain...

Code:
http://www.yourdomain.com/vip.php
That's it! If anybody more knowledgeable wants to clean up the code or add anything special - you're welcome to it.

Love,
D

P.S. Special thanks to Genjutsu, Foxler, and Gestserver.
 
Last edited by a moderator:
handy... thanks.

One thing where does the script kick the visitor to if the referer is not scrubbed ?
Would be handy if you could redirect the non-scrubbed traffic to another url.. somewhere that will still make a few $ but your not worried if the referers there..:)

Just a thought..
 
Good question and I think they get hung in limbo. Maybe someone could add something to the code so we have a say in it...like they could get sent to gay porn for being so stupid as to not use the browser we want them to.
 
thanks I'm going to try using this. Do you know if this can be combned with any geotargeting script?
 
Hey Diabolik,

Is there anyway to use the script to open up multiple domains, so just instead of opening up randomly, you can open up all of them???
 
I am also not a programmer but I like the look and feel of this

It would be great to be able to get something from the clicks that are really just going away nowhere

good work Diabolic

what would also be good would be a way to have the traffic go from one domain to the next always checking the referer was blank and this way we would get a click on every offer in the list, kinda like out own traffic generation program ... or is this asking too much

oscar
 
Hi,

Is that why this forum is so great, here we can see how someone catch some code lines and 5 days later is posting an explained post.

Good Job.

About geo tracking i use this database:
hxxp://software77.net/cgi-bin/ip-country/geo-ip.pl

You can create an ip2country database and then check the country using the IP.


Example:

<?
// Retrieve visitor IP
$ipaddress = getenv(REMOTE_ADDR);

// Replace this MYSQL server variables with actual configuration
$mysql_server = "localhost";
$mysql_user_name = "YourDatabase Username";
$mysql_user_pass = "YourDatabase Password";

// Convert IP address to IP number for querying database
$ipno = Dot2LongIP($ipaddress);

// Connect to the database server
$link = mysql_connect($mysql_server, $mysql_user_name, $mysql_user_pass) or die("Could not connect to MySQL database");

// Connect to the IP2Location database
mysql_select_db("Your Server Database", $link) or die("Could not select database");

// SQL query string to match the recordset that the IP number fall between the valid range
$query = "SELECT * FROM ip2country WHERE $ipno <= ipto AND $ipno>=ipfrom";

// Execute SQL query
$result = mysql_query($query, $link) or die("IP2Location Query Failed");

// Retrieve the recordset (only one)
$row = mysql_fetch_object($result);

// Keep the country information into two different variables
$countrySHORT = $row->ctry;
$countryLONG = $row->country;

// Free recordset and close database connection
mysql_free_result($result); mysql_close($link);

// Function to convert IP address (xxx.xxx.xxx.xxx) to IP number (0 to 256^4-1)
function Dot2LongIP ($IPaddr) {
if ($IPaddr == "")
{
return 0;
} else {
$ips = split ("\.", "$IPaddr");
return ($ips[3] + $ips[2] * 256 + $ips[1] * 256 * 256 + $ips[0] * 256 * 256 * 256);
}
}
?>
 
Last edited:
Back
Top
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features and essential functions on BlackHatWorld and other forums. These functions are unrelated to ads, such as internal links and images. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock