Strict Standards: Declaration of action_plugin_dlcount::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/dlcount/action.php on line 14

Strict Standards: Declaration of action_plugin_indexmenu::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/indexmenu/action.php on line 169

Strict Standards: Declaration of action_plugin_ipban::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/ipban/action.php on line 67

Strict Standards: Declaration of action_plugin_loglog::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/loglog/action.php on line 82

Strict Standards: Declaration of action_plugin_navi::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/navi/action.php on line 46

Strict Standards: Declaration of action_plugin_uparrow::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/uparrow/action.php on line 69

Strict Standards: Declaration of action_plugin_userspagecreate::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /home/www/wiki/lib/plugins/userspagecreate/action.php on line 97

Strict Standards: Declaration of cache_instructions::retrieveCache() should be compatible with cache::retrieveCache($clean = true) in /home/www/wiki/inc/cache.php on line 289

Warning: Cannot modify header information - headers already sent by (output started at /home/www/wiki/lib/plugins/dlcount/action.php:14) in /home/www/wiki/inc/auth.php on line 312

Strict Standards: Only variables should be passed by reference in /home/www/wiki/doku.php on line 71

Warning: Cannot modify header information - headers already sent by (output started at /home/www/wiki/lib/plugins/dlcount/action.php:14) in /home/www/wiki/inc/actions.php on line 154
Gästebuch IP-Sperre [phpwcms-HowTo:wiki]

Strict Standards: Declaration of syntax_plugin_code::render() should be compatible with DokuWiki_Syntax_Plugin::render($format, &$renderer, $data) in /home/www/wiki/lib/plugins/code/syntax.php on line 41

Strict Standards: Declaration of syntax_plugin_tip::render() should be compatible with DokuWiki_Syntax_Plugin::render($format, &$renderer, $data) in /home/www/wiki/lib/plugins/tip/syntax.php on line 38

Gästebuch IP-Sperre

Eine kleine Erweiterung um im Gästebuch die bisher vorgesehene aber noch fehlende Sperrung von IPs zu ermöglichen.

Docu: –
Forum: –

Autor: K.Heermann (flip-flop) http://planmatrix.de
CMS Version: >= 1.4
Version: V1.0

Tag (in der Vorlage): <!–BAN_IP_START–> xxx.yyy.zzz.uuu xxx.yyy.zzz.* xxx.yyy.*.* <!–BAN_IP_END–>

  • Die letzten beiden Stellen der IP können durch den Platzhalter * maskiert werden.
  • Siehe zu IP auch IP-Adresse
  • Trenner der IPs ist ein Leerzeichen oder Zeilenumbruch

Beispiel:

<!--BAN_IP_START//-->
192.168.0.0
92.241.154.*
125.116.*.*
91.191.*.*
<!--BAN_IP_END//-->

Dateiname: cnt18.article.inc.php

Ort: include/inc_front/content/

Erweiterung der Datei include/inc_front/content/cnt18.article.inc.php etwa ab Zeile 330 direkt vor

    // Captcha check
    if(empty($guestbook['captcha'])) { ........

diesen

Codeschnipsel

einfügen:

Banned IP

    // Banned IP ================= +kh 24.10.09
    if( !empty($guestbook['ban_ip']) ) {
 
        $_ip      = getRemoteIP();
 
        $_ipex    = explode('.', $_ip);
 
        //exampl.IP  123.456.678.901
        //   $_ipex  [0] [1] [2] [3]
 
        $_ipex[3] = '*';                      // 123.456.678.*
        $_ip01    = implode ('.',$_ipex);
        $_ipex[2] = '*';                      // 123.456.*.*
        $_ip02    = implode ('.',$_ipex);
 
 
        if ( strpos($guestbook['ban_ip'], $_ip01) OR // xxx.yyy.zzz.*
             strpos($guestbook['ban_ip'], $_ip02) OR // xxx.yyy.*.*
             strpos($guestbook['ban_ip'], $_ip) )
        {
            $guestbook['flooding']    = 1;
            $guestbook['readform']    = 1;
//        $guestbook['spamalert']    = '<div class="spamFormAlert">Your IP '.getRemoteIP().' is not allowed to send form (Blacklist)!</div>';
            $guestbook['spamalert']    = '<div class="spamFormAlert"><br /><hr><strong>Sorry, your are not allowed to send form!</strong><hr><br /></div>';
        }
    }
    // ===============================


Vorlage

Nun ist in der Vorlage der Ausschluss von einzelnen IPs oder auch einfachen IP-Bereichen möglich:

Z.B.:

<!--BAN_IP_START//-->
192.168.0.0
92.241.*.*
125.116.15.*
91.191.*.*
<!--BAN_IP_END//-->

Seien sie vorsichtig bei der Verwendung des Platzhalters an der dritten Position (xxx.yyy.*.*)!!! Die beiden ersten Stellen der IP werden oft von mehreren Ländern verwendet.


Dokumentation

Die Datei PATCH-DOC.php im Verzeichnis include/inc_front/content/ ablegen. (Oder an einem anderen Ort und/oder mit anderem Namen - aber immer mit der Endung *.php)

include/inc_front/content/PATCH-DOC.php

<?php
/* ========================================================
// 24.10.09 KH
 
// Banned IP
// Around line 331, before Captcha check
// Insert the following snipped:
 
 
 
 
    // Banned IP ================= +kh 24.10.09
    if( !empty($guestbook['ban_ip']) ) {
 
        $_ip      = getRemoteIP();
 
        $_ipex    = explode('.', $_ip);
 
        //exampl.IP  123.456.678.901
        //   $_ipex  [0] [1] [2] [3]
 
        $_ipex[3] = '*';                      // 123.456.678.*
        $_ip01    = implode ('.',$_ipex);
        $_ipex[2] = '*';                      // 123.456.*.*
        $_ip02    = implode ('.',$_ipex);
 
 
        if ( strpos($guestbook['ban_ip'], $_ip01) OR // xxx.yyy.zzz.*
             strpos($guestbook['ban_ip'], $_ip02) OR // xxx.yyy.*.*
             strpos($guestbook['ban_ip'], $_ip) )
        {
            $guestbook['flooding']    = 1;
            $guestbook['readform']    = 1;
//        $guestbook['spamalert']    = '<div class="spamFormAlert">Your IP '.getRemoteIP().' is not allowed to send form (Blacklist)!</div>';
            $guestbook['spamalert']    = '<div class="spamFormAlert"><br /><hr><strong>Sorry, your are not allowed to send form!</strong><hr><br /></div>';
        }
    }
    // ===============================
 
 
    // Captcha check
    if(empty($guestbook['captcha'])) { ...........
 ======================================================== */
?>


Whois Abfrage

Z.B.

deutsch/andere-erweiterungen/hacks/gaestebuch-ip-sperre.txt · Last modified: 2009/10/27 09:20 by Knut Heermann (flip-flop)
www.planmatrix.de www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0

Strict Standards: Only variables should be passed by reference in /home/www/wiki/doku.php on line 79