Need some PHP Cloaking scripting here

macbookpro

Registered Member
Joined
Sep 2, 2010
Messages
82
Reaction score
13
So my ads keep getting disapproved on Adcenter because of using direct linking to offer.

What i need is a PHP code that will check ips of visitors from Ip.txt file and if ip is not listed on txt , script will perform a redirect to offer url.

If ip is listed in ip.txt file then it will stay on the same page which is index.php.

P.S :
My Ip base has IP blocks such as 100.100.0.0
So Php code should understand its an ip block.

Any help is appreciated. Thanks.
 
Should be an easy script. You wanted it in PHP or a Plugin? Also, in regards to the IP's...you just wanted to be able to add the IP's manually?
 
Here is how you would redirect without a script and just using your .htaccess file:

Redirect based upon IP:
HTML:
# permanently redirect specific IP request for entire site 
Options +FollowSymlinks 
RewriteEngine on 
RewriteCond %{REMOTE_HOST} 22\.22\.22\.239 
RewriteRule \.php$ http://www.redirectsite.com/ [R=301,L]


Redirect based upon IP range:
HTML:
# permanently redirect specific IP request for entire site 
Options +FollowSymlinks 
RewriteEngine on 
RewriteCond %{REMOTE_HOST} 22\.22\.22\.239 
RewriteRule \.php$ http://www.redirectsite.com/ [R=301,L]
 
There you go. If you like it then you know what buttons to push.

Code:
<?php

/*************************************************************************\
Simple IP redirect

By Autumn@BHW

Created:  Fri Aug 12 12:13:44 NZST 2011
\*************************************************************************/

// File with IP list in it
$ip_file = '/path/to/ips.txt';

// Redirect to issue surfers
$redirect_url = 'http://myspammyredirect.com/';

// HTML to show to PPC reviewers
$content = '<html>
<head>
<title>Hi Reviewer</title>
</head>
<body>
<h1>Fucking blow me you prick</h1>
</body>
</html>
';


/*************************************************************************/
// Load list of IPs
$lines = file($ip_file);
foreach($lines as $line) {
	$ips[] = trim($line);
}

// Get surfer's IP
$remote_ip = $_SERVER['REMOTE_ADDR'];

// Issue redirect or show reviewer content
if(in_array($remote_ip, $ips)) {
	header("Location: $redirect_url", true, 301);
	exit;
} else {
	echo "$content\n";
}


?>
 
Should be an easy script. You wanted it in PHP or a Plugin? Also, in regards to the IP's...you just wanted to be able to add the IP's manually?

PHP better .. I will keep IPs in a seperate text file.

Here is how you would redirect without a script and just using your .htaccess file:

My hosting disa bled htaccess due to some abuse. Thanks anyway.

There you go. If you like it then you know what buttons to push.

I am going to try it tonight. Thanks...

How do you plan on getting all of adwords ip addresses?

Who saidsomething about adwords ? :)
In anyway I have all ip lists of most common PPC editors. I am doing this business for a long time. I just lost my access to my cloaking software for a few days.
 
I have the ultimate tool for you PM me for details and I am willing to sell it, its a supercloaker.
 
There you go. If you like it then you know what buttons to push.

Thanks for the code but thats not working for me...
I think you wrote if else variable opposite..
 
There you go. If you like it then you know what buttons to push.


Thank you for helping but this code work only for exact ips on ips.txt file. However i have ip c range such as :
24.228.0.0
24.228.0.0/16 (CIDR)
24.228.
24.228.*
24.228..*..*

This script dont recoginize block range :(
 
Sorry, I've got too much of my own work to do to write the regex right now. However the first thing you should do is standardize your list of IP ranges into a single consistent format. You're right, the if/else should be in the opposite order.
 
...............................................................................................................
 
Last edited:
Back
Top