This contact form uses a clock captcha, I thought it was a rather fun idea, and anyway a lot less annoying than those barely readable random strings so many sites use. Source code for this clock captcha can be found here (in German, but the PHP code is clean and easily understandable:)
Checking a few WordPress Feeds
Today I felt like tidying a bit Planet WordPress, an unofficial aggregation of feeds about WordPress I've been maintaining for about 2 years now. The thing was fetching about 80 feeds, of which about a half were… dead, missing in action, or just inactive. It quickly appeared to me than manually reviewing 80 feeds would be tedious. And it quickly…
How-to: PHP Script for Honey Pot’s http:BL
A few days ago, Project Honey Pot introduced a new service : http:BL, a blacklist of all the suspicious IPs they are gathering through all the honey pots, and an API allowing anyone to use this blacklist. Their API is very easy to use, and I believe a number of projects (hint) should use it any time soon. For the…
PHP GD : imagecolorallocate() Limitation
Did you know it ? PHP GD's imagecolorallocate() can only allocate 255 colors in a palette based image created by imagecreate() (no such limitation when you use function imagecreatetruecolors() by the way). This sounds pretty stupid as well as rather undocumented, but anyway, here is a new version of my GD Gradient Fill PHP class, which now produces correct colors…
PHP : Variables vs Constants
I thought, and had been told, that using constants instead of variables in PHP was mostly a matter of speed : at run time, the engine replaces every occurrence of a constant with its hard-coded value, making code presumably faster than using variables that must be evaluated each time they are encountered. Or something like this. Wondering how big or…
How to Add a Custom Function to MediaWiki
Create your own complex functions in your wiki.
PHP5 Benchmarks: for vs while, count vs sizeof, md5 vs sha1 and other speed comparisons like these for those who really need an extra millisecond of optimisation. I like this.
Plugin Debugging : Hooks and Filters Flow
Basically, a plugin for WordPress creates a PHP function (called a filter or an action) which is triggered when a particular event (called a hook) occurs. When several filters are supposed to be triggered by the same hook, you can define their priority. When you're writing a plugin and you're facing unexpected behavior, it may be a priority issue :…
PHP Bitwise Operators Example of Use
In my neverending amateur journey through the wonders of coding, here is something I've learnt in PHP today : how to conveniently store a set of flags into one value, with bitmask comparisons made easy thanks to PHP bitwise operators. Sounds greek to you ? Read on, it's this kind of things that are piece of cake to use while…
Speeding Things with PHP Output Buffer
While playing a bit with Xdebug (a profiling tool for PHP), I've come across something I didn't know and that I frankly found a bit odd : how to use output buffering (PHP function ob_start()) to speed up some stuff. In a few words, just so you know if this is obvious noob stuff for you and you can skip…