nigerian ip addresses |
| Database | Search | PHP / ASP Code Sample | Report an IP Address |
Below is some sample code to take advantage of the 215,753 Nigerian IP addresses in our database.
Take Note:
You will notice that although we have 215,753 Nigerian IP addresses in our database, there are 4358 rows in the database. This was done on purpose to increase speed.
When an entire C block can be blocked, the class will be one. When only a specific IP address can be blocked, the class will be two.
Sample Query Code:
Understanding that when an entire C block is being blocked that the class will be one and that when only a specific IP address can be blocked that the class will be two, here is a sample query code for PHP and ASP.
Please note, the scripts below sets cookie. The cookie expires after 1 hour. It is suggested that a cookie be set so you only query the database once per user per hour. If the person is from Nigeria, then the script will redirect the user to google.com. If the person is not from Nigeria, then nothing happens.
The sample query code is available in both PHP and ASP.
PHP Sample Code:
<?
// Checking to see if a cookie has been setting
identifying whether or not this user has been queried before.
// See the end of the script to see where the cookie has been set
if ($nigeria_cookie
!= "yes")
{
// Get the IP address and then split the IP address into the blocks
$ip = $_SERVER["REMOTE_ADDR"];
$array = explode(".",
$ip);
$a = $array[0];
$b = $array[1];
$c = $array[2];
$d = $array[3];
// Try 1 checks only the C block
$try1 = "$a.$b.$c";
// Try 2 checks the entire IP address
$try2 = "$ip";
// Searching the C block first. This saves time. If positive, no need to search the entire IP address
$one = "SELECT number FROM nigeria WHERE class = 'one' AND number =
'$try1'";
// Return result set to PHP
$first = mysql_query
($one, $link) or
die (mysql_error());
// If the entire C block is from Nigeria, $num_rows1 will be 1
$num_rows1 = mysql_num_rows(
$first );
if ($num_rows1 ==
"1") $nigeria
= "yes";
// If the entire C block is not from Nigeria, let's search the full IP address
if ($num_rows1 ==
"0")
{
$two = "SELECT * FROM nigeria WHERE class = 'two' AND number =
'$try2'";
// return result set to PHP
$second = mysql_query
($two, $link) or
die (mysql_error());
// If the IP address is from Nigeria, $num_rows2 will be 1
$num_rows2 = mysql_num_rows(
$second );
if ($num_rows2 <
"1") $nigeria
= "no";
if ($num_rows2 >
"0") $nigeria
= "yes";
}
// If Nigeria is yes, then redirect to Google or any other site you want.
if ($nigeria ==
"yes") echo
"<meta http-equiv=\"refresh\"
content=\"0;url=http://www.google.com/\">";
// Setting a cookie. This allows us to only query the user's IP address once.
// Remember to change your-domain-name.com
below
if ($nigeria ==
"yes") {
setcookie ("nigeria_cookie",
$nigeria, time()+3600,
"/", "your-domain-name.com",
0);
}
}
?>
ASP Sample Code:
ASP code is available upon request. Send me an email to get the code.
The ASP script was provided by The Code Writer at Country Wide Dating.
Send us an if:
| Nigerian IP Addresses dot com is professionally designed and
maintained by Jai Dee Marketing. All Rights
Reserved. All text that is intellectual property is ©Copyright 2005 - 2010
by Jai Dee Marketing. Legal action will be taken against violators. Your use of this web site and database indicates acceptance of our legal disclaimer. |