Blocking users based on IP address from your website

Heres a really quick method of blocking users from accessing your website using the common mod_rewrite and .htaccess. For this method to work, you need to have FTP access to your website and be able to put this file in your main webpage directory or sub-directory that you want to limit access too.


Convert time (hr:min:secs) into seconds

I wrote this snippet to convert ffmpeg’s information output time into seconds, i can then determine the 25, 50 and 75 percentages to create 3 different thumbnails of a movie (using ffmpeg also). Heres the snippet: function time2seconds($time=’00:00:00′){ list($hr,$m,$s) = explode(’:', $time); return ( (int)$hr*3600 ) + ( (int)$m*60 ) + (int)$s; } Hope you [...]


Benchmark your PHP code

As a developer I often question myself when I have many occurrences of a function that could be replaced by something else. There are often many ways of achieving the same thing and only opinion standing in the way of a decision. To solve this problem, I often benchmark certain peices of code multiple times [...]


Advanced Navigation using Includes

A very simple way of doing the index.php?page=page_here. Includes a few configuration options. Written in php4, works in php5, mostly so you can view the source and attempt at understanding how it works.