note 61430 added to ref.mail

From: Date: Fri, 03 Feb 2006 07:05:48 +0000
Subject: note 61430 added to ref.mail
Groups: php.notes 
Request: Send a blank email to php-notes+get-102913@lists.php.net to get a copy of this message
If you would also like to completely blacklist a person trying to perform injection, here is a useful method which exploits the inheritance behavior of .htaccess. The htaccess file should contain nothing else. This is useful on hosted sites, where you cannot alter firewall rules on the fly. function DenyIP($ip) { $htaccess = "/path/to/some/.htaccess" /* Make sure we have write access to the files */ if (is_writable($htaccess)) { /* Read in current deny list */ $cur_lst = trim(file_get_contents(HTACCESS)); /* Appending to the list */ if (!empty($cur_lst)) { $arr = explode("\n",$cur_lst); foreach ($arr as $str) trim($str); $arr[count($arr) - 1] = "deny from " . $ip; } else { /* Blank htaccesss case */ $arr = Array(); $arr[] = "order allow,deny"; $arr[] = "deny from " . $ip; } /* Our implicit allow all */ $arr[] = "allow from all"; $new_lst = implode("\n",$arr); $hand = fopen($htaccess,"wb"); if (!$hand) return; fwrite($hand, $new_lst); fclose($hand); } } ---- Server IP: 64.71.164.2 Probable Submitter: 69.22.121.210 ---- Manual Page -- http://www.php.net/manual/en/ref.mail.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61430 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61430&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61430&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61430&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61430&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61430&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61430&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61430&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61430&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#102913) next »