Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
Prev Previous Post   Next Post Next
  #5  
Old 01-25-2010, 03:39 PM
TheSupportForum TheSupportForum is offline
 
Join Date: Jan 2007
Posts: 1,158
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
This line doesn't look correct:
PHP Code:
    $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';
    
    
// check query response
    
$result explode'.'gethostbyname($lookup));
    
    if (
$result[0] == 127) {
        
// query successful !
        
$activity $result[1];
        
$threat $result[2];
        
$type $result[3];
        
        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 >= && $threat 0// Comment spammer with any threat level
            
||
        (
$type && $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;
}

not sure how to corect it
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:10 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04768 seconds
  • Memory Usage 2,830KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_code
  • (6)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (12)post_thanks_box
  • (12)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (12)post_thanks_postbit_info
  • (12)postbit
  • (12)postbit_onlinestatus
  • (12)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_threadedmode.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete