Forum Moderators: coopster
function saveToLog ($query, $elapsed, $results) {
global $mysql_table_prefix;
mysql_query("insert into ".$mysql_table_prefix."query_log (query, time, elapsed, results) values ('$query', now(), '$elapsed', '$results')");
echo mysql_error();
}
As I only know the first sections of some of the ip addresses I put that in with xx's. This is my attempt belwo but it errors for fun. Can anyone rework it? Thanks for your efforts - really appreciated.
function saveToLog ($query, $elapsed, $results)
$ip = $_SERVER['REMOTE_ADDR'];
if (substr($ip, 0, 8)!="#*$!.#*$!.") or (substr($ip, 0, 3)!="xx.") or (substr($ip, 0, 12)!="xxx.xxx.xxx.") or (substr($ip, 0, 12)!="xxx.xxx.xxx.") {
global $mysql_table_prefix;
mysql_query("insert into ".$mysql_table_prefix."query_log (query, time, elapsed, results) values ('$query', now(), '$elapsed', '$results')");
echo mysql_error();
}
if(ereg("^xxx.xxx", $REMOTE_ADDR))
{
// This is your IP so do nothing
}
else
{
// Log the search
}