$stamp = date('d-m-Y :: H-i$sql = "INSERT INTO `list` SET ";
i have now corrected the php plugin code to this
PHP Code:
/* Script Name: Simple PHP http:BL implementation Description: Simple script to check an IP against Project Honey Pot's database and let only legitimate users access your script */ if ($vbulletin->options['pro_honey_active']){ if ($_COOKIE['notabot']) { ozh_httpbl_logme(false, $_SERVER['REMOTE_ADDR']); } else { ozh_httpbl_check(); } } function ozh_httpbl_check() { global $vbulletin; $apikey = $vbulletin->options[pro_honey_api]; // IP to test $ip = "94.102.63.90"; // build the lookup DNS query // Example : for '127.9.1.2' you should query 'abcdefghijkl.2.1.9.127.dnsbl.httpbl.org' $lookup = $apikey . '.' . implode('.', array_reverse(explode ('.', $ip ))) . '.dnsbl.httpbl.org';
if ($type & 0) $typemeaning .= 'Search Engine, '; if ($type & 1) $typemeaning .= 'Suspicious, '; if ($type & 2) $typemeaning .= 'Harvester, '; if ($type & 4) $typemeaning .= 'Comment Spammer, '; $typemeaning = trim($typemeaning,', ');
// echo "$type : $typemeaning of level $threat ";
// Now determine some blocking policy if ( ($type >= 4 && $threat > 0) // Comment spammer with any threat level || ($type < 4 && $threat > 20) // Other types, with threat level greater than 20 ) { $block = true; }
if ($block) { ozh_httpbl_logme($block,$ip,$type,$threat,$activity); ozh_httpbl_blockme(); die(); }
} } function ozh_httpbl_logme($block = false, $ip='', $type='',$threat='',$activity='') { $sql = "INSERT INTO `list` SET "; $sql .= "`stamp`='" . sql_escape_string($stamp) . "', "; $sql .= "`ip`='" . sql_escape_string($ip) . "', "; $sql .= "`type`='" . sql_escape_string($type) . "', "; $sql .= "`threat`='" . sql_escape_string($threat) . "', "; $sql .= "`datetime`=now()"; $r = sql_command($sql); if ($r == 1) { ######################################## # good insertion, get record id number # ######################################## $id = sql_insert_id("list", "id"); return $id; } function sql_command ($sql) { if (mysql_query($sql)) return mysql_affected_rows(); return -1; } function sql_insert_id($table, $field) { return mysql_insert_id(); } function sql_escape_string ($string) { if (get_magic_quotes_gpc()) { $string = stripslashes($string); } $string = mysql_real_escape_string($string); return $string; }
// Some stuff you could log for further analysis $page = $_SERVER['REQUEST_URI']; $ua = $_SERVER["HTTP_USER_AGENT"];
if ($block) { fputs($log,"$stamp :: BLOCKED $ip :: $type :: $threat :: $activity :: $page :: $ua\n"); } else { fputs($log,"$stamp :: UNBLCKD $ip :: $page :: $ua\n"); } fclose($log); } function ozh_httpbl_blockme() { header('HTTP/1.0 403 Forbidden'); echo <<<HTML <script type="text/javascript"> function setcookie( name, value, expires, path, domain, secure ) { // set time, it's in milliseconds var today = new Date(); today.setTime( today.getTime() );
if ( expires ) { expires = expires * 1000 * 60 * 60 * 24; } var expires_date = new Date( today.getTime() + (expires) );
document.cookie = name + "=" +escape( value ) + ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + ( ( path ) ? ";path=" + path : "" ) + ( ( domain ) ? ";domain=" + domain : "" ) + ( ( secure ) ? ";secure" : "" ); } function letmein() { setcookie('notabot','true',1,'/', '', ''); location.reload(true); } </script> <h1>Forbidden</h1> <p>Sorry. You are using a suspicious IP.</p> <p>Your IP address has been listed at <a href="http://www.projecthoneypot.org">http://www.projecthoneypot.org</a></p> <p>If you <strong>ARE NOT</strong> a bot of any kind, please <a href="javascript:letmein()">click here</a> to access the page. Sorry for this !</p> HTML; }
the error i now get is
Fatal error: Call to undefined function sql_escape_string() in /public_html/includes/functions.php(6505) : eval()'d code on line 68
i think it refere to this
########################################
# good insertion, get record id number #
########################################
$id = sql_insert_id("list", "id");
return $id;
}