📄 ipisp.php
字号:
<HTML>
<HEAD><TITLE>
IP - Country - ISP Database Demo in PHP Hypertext Preprocessor
</TITLE></HEAD>
<BODY bgcolor="#FFFFFF">
<h1><b><u>Lookup Country & ISP by IP Address</u></h1></b>
Enter a dotted IP address (xxx.xxx.xxx.xxx) between <b>202.181.128.0</b> and <b>203.99.71.255</b>.<br>
<?php
//---------------------------------------------------------------------------
// Title : Lookup Country and ISP by IP Address
// Description : This script lookup the ISP by IP address.
// Things that we can do with this script.
// 1. Display native language and currency
// 2. Redirect based on country
// 3. Digital rights management
// 4. Prevent password sharing and abuse of service
// 5. Reduce credit card fraud
// 6. Web log stats and analysis
// 7. Auto-selection of country on forms
// 8. Filter access from countries you do not do business with
// 9. Geo-targeting for increased sales and click-thrus
// 10. And much, much more!
// Requirements : PHP 4+ and MS-ACCESS 2000+ COM
// Installation : a. Copy this php file (ipisp.php) and mdb database file (ipisp.mdb)
// into a web directory.
// b. Browse this webpage (ipisp.php) using http protocol. Example, http://localhost/demo/ipisp.php
// c. Enter an IP address range between 202.181.128.0 and 203.99.71.255 and submit the form.
//
// Author : Hexa Software Development Center
// URL : http://www.location.com.my
// Copyright (c) 2002 by Hexa Software Development Center
//---------------------------------------------------------------------------
$ipaddress = $HTTP_POST_VARS["ipaddress"];
echo " <form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"POST\">\n";
echo " <input type=\"text\" name=\"ipaddress\">\n";
echo " <input type=\"submit\" name=\"submit\" value=\"submit\">\n";
echo " </form>\n";
if (isset($HTTP_POST_VARS["ipaddress"])) {
$ipno = Dot2LongIP($ipaddress);
if (($ipno < 3400892416) || ($ipno > 3412281343)) {
echo "IP address " . $ipaddress . " is not supported in demo version.<br>\n";
} else {
// getcwd() required >= PHP4
$accesspath = getcwd() . "\\ipisp.mdb";
$conn = new COM("ADODB.Connection") or die("Cannot start ADO");
// Microsoft Access connection string.
$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . $accesspath);
// SQL statement to build recordset.
$rs = $conn->Execute("SELECT * FROM IPISP WHERE " . $ipno . " BETWEEN ipFROM AND ipTO");
echo "<p>";
echo "<h1><u>Lookup Result</u></h1>";
echo "<table>";
echo "<tr><td>IP Address :</td><td> <b>" . $ipaddress . "</b></td></tr>\n";
if (!$rs->EOF) {
$fv = $rs->Fields("countrySHORT");
echo "<tr><td>Country Name (Short) :</td><td> <b>" . $fv->value . "</b></td></tr>\n";
$fv = $rs->Fields("countryLONG");
echo "<tr><td>Country Name (Long) :</td><td> <b>" . $fv->value . "</b></td></tr>\n";
$fv = $rs->Fields("ispNAME");
echo "<tr><td>ISP Handler :</td><td> <b>" . $fv->value . "</b></td></tr>\n";
} else {
echo "<tr><td>Country Name (Short) :</td><td> <b> - </b></td></tr>\n";
echo "<tr><td>Country Name (Long) :</td><td> <b> - </b></td></tr>\n";
echo "<tr><td>ISP Handler :</td><td> <b> - </b></td></tr>\n";
}
$rs->Close();
echo "</table>";
echo "</p>";
}
}
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);
}
}
?>
<BR>
[<A HREF="https://www.regsoft.net/purchase.php3?productid=51029">Click here to purchase full database</A>]
<BR>
<BR>
Copyright (c) 2002 by <a href="http://www.location.com.my">Hexa Software Development Center</a>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -