May 2010
1 post
6 tags
[apache] [security] Apache Bot filtering with...
Fail2ban scan log files like /var/log/apache/error_log and bans IP that makes too many bad request. Fail2ban block bruteforcers, scanners and many other… For more information about fail2ban see : www.fail2ban.org Fail2ban can also be used to ban bad bots on apache. The blocking list is fetched from www.user-agents.org. To block spam or bad robot who visit your...
May 5th
2 notes
March 2010
1 post
2 tags
[php] htmlentitiesnotag
function htmlentitiesnotag($strIn){ $arrEntities = array('&lt;','&gt;','&quot;','&amp;'); $arrTag = array('<','>','"','&'); $strOut = htmlentities($strIn); $strOut = str_replace($arrEntities,$arrTag,$strOut); return $strOut; }
Mar 2nd
3 notes
February 2010
1 post
7 tags
[php-cli] [mysqldump] [cron] auto backup mysql...
You need to automatise the backup of your mysql databases on a linux system with php-cli, mysqldump and bzip2 ? So this script is for you ^^ I use this script on my servers to backup my databases every nigth. All Databases of the 15 last days and 2 by month are stored in bzip2 format in separate files (one file by database). Set your preferences in this script, add it in...
Feb 5th
January 2010
5 posts
3 tags
[shell] string replace in all file recursively
Replace all occurrences of the EXPR_SEARCH expression with the EXPR_REPLACE expression in all files of DIRECTORY_PATH recursively sed -i -e 's/EXPR_SEARCH/EXPR_REPLACE/g' `grep -lR 'EXPR_SEARCH' DIRECTORY_PATH` Note : don’t forget to escape special characters in your expression (ie : ‘images/site’ will be ‘images\/site’ )
Jan 21st
1 note
3 tags
[php] [ubuntu] Install APC on ubuntu
Install APC (Alternative PHP Cache) to increase server performance. On Ubuntu 9.10 : sudo apt-get install php-apc sudo /etc/init.d/apache2 restart On Ubuntu 8.04 : Install pre-required packages sudo apt-get install php-pear php5-dev apache2-threaded-dev make Install APC with PECL sudo pecl install apc If succeed, add extension=apc.so to your...
Jan 19th
1 tag
Jan 15th
3 notes
1 tag
[php] rglob
if (!function_exists('rglob')){ function rglob($sDir,$sPattern, $nFlags = NULL) { $sDir = escapeshellcmd($sDir); $aFiles = glob("$sDir/$sPattern", $nFlags); foreach (glob("$sDir/*", GLOB_ONLYDIR) as $sSubDir) { $aSubFiles = rglob($sSubDir, $sPattern, $nFlags); $aFiles = array_merge($aFiles, $aSubFiles); } return $aFiles; } }
Jan 15th
2 notes
Hello World
Chef de projet developpeur web lyonnais #geek #apero #ski #sun #php #linux #shell #dev #web Follow me at http://twitter.com/rauxbenoit
Jan 15th
1 note