{{indexmenu_n>10}} ====== Guestbook ban IP ====== A small enhancement for the guest book to make the the still missing "banned IP feature" possible. Docu: -- \\ Forum: -- **Autor:** K.Heermann (flip-flop) http://planmatrix.de \\ **CMS version:** >= 1.4 \\ **Version:** V1.0 \\ **Tag** (in guestbook template): **** xxx.yyy.zzz.uuu xxx.yyy.zzz.* xxx.yyy.*.* **** \\ * The last two places of the IP can be masked by the substitute symbol * * Siehe zu IP auch [[http://en.wikipedia.org/wiki/IP_address|IP-address]] * Decollator of the IPs is a blank or a line-feed. Example: 192.168.0.0 92.241.154.* 125.116.*.* 91.191.*.* **file name:** cnt18.article.inc.php **location:** include/inc_front/content/ Enhancement of the file include/inc_front/content/cnt18.article.inc.php for instance starting from line 330 directly forwards // Captcha check if(empty($guestbook['captcha'])) { ........ insert this ==== Code 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'] = '
Your IP '.getRemoteIP().' is not allowed to send form (Blacklist)!
'; $guestbook['spamalert'] = '


Sorry, your are not allowed to send form!

'; } } // ===============================
\\ ==== Template ==== In template now the exclusion of individual IPs or IP ranges is also possible: E.g.: 192.168.0.0 92.241.*.* 125.116.15.* 91.191.*.* Be carefull by using a placeholder in the third position (xxx.yyy.##*##.*)!!! Often the two first places of the IP are used from several countries. \\ ==== Documentation ==== Place the file PATCH-DOC.php into the folder include/inc_front/content/. //(Or at another place and/or with other name - however always with the extend ***.php**) // Your IP '.getRemoteIP().' is not allowed to send form (Blacklist)!'; $guestbook['spamalert'] = '


Sorry, your are not allowed to send form!

'; } } // =============================== // Captcha check if(empty($guestbook['captcha'])) { ........... ======================================================== */ ?>
\\ ==== Whois call ==== E.g. * [[http://cqcounter.com/whois/]] (//also wildcard possible)// * [[http://www.ipaddresslocation.org/]] (//Get and find IP address ranges corresponding for each country//) * [[http://www.heise.de/netze/tools/whois-abfrage]]