JavaScript Editor Ajax software     Free javascripts 



Main Page

if ($wildcard_value) {
$wildcard_value = mysql_escape_string($wildcard_value);
$q .= “ AND ‘$wildcard_value’ LIKE CONCAT(value, ‘%‘) “;
}
// Connect to MySQL server
$dbLink = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD)
or die(“Could not connect: “ . mysql_error());
// Connect to the seophp database
mysql_select_db(DB_DATABASE) or die(“Could not select database”);
// execute the query
$tmp = mysql_query($q);
// close database connection
mysql_close($dbLink);
// return the results as an associative array
$rows = array();
while ($_x = mysql_fetch_assoc($tmp)) {
$rows[] = $_x;
}
return $rows;
}
// updates the entire database with fresh spider data, but only if our data is
// more than 7 days old, and if the online version from iplists.org has changed
function updateAll()
{
// Connect to MySQL server
$dbLink = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD)
or die(“Could not connect: “ . mysql_error());
// Connect to the seophp database
mysql_select_db(DB_DATABASE) or die(“Could not select database”);
// retrieve last update information from database
$q = “SELECT cloak_update.* FROM cloak_update”;
$tmp = mysql_query($q);
$updated = mysql_fetch_assoc($tmp);
$db_version = $updated[‘version’];
$updated_on = $updated [‘updated_on’];
// get the latest update more recent than 7 days, don’t attempt an update
if (isset($updated_on) &&
(strtotime($updated_on) > strtotime(“-604800 seconds”)))
{
// close database connection
mysql_close($dbLink);
// return false to indicate an update wasn’t performed
return false;
}
227
Chapter 11: Cloaking, Geo-Targeting, and IP Delivery
c11.qxd:c11 11:01 227


JavaScript Editor Ajax software     Free javascripts