Jul 10

Need a quick and dirty captcha?

session_start();
        $str = str_shuffle(‘abcdefghijklmnopqrstuvwxyz0123456789′);
        $substr = substr($str, 0, 6);
        $im = imagecreate(60, 25);
        // white background and blue text
        $bg = imagecolorallocate($im, 255, 255, 255);
        $textcolor = imagecolorallocate($im, 0, 0, 0);
    [...]

Jul 9
format size
icon1 SpikeZ | icon2 PHP, snippets | icon4 07 9th, 2008| icon32 Comments »

PHP Snippet for formatting byte size.

Jul 9
debugger function
icon1 SpikeZ | icon2 PHP, snippets | icon4 07 9th, 2008| icon3No Comments »

Debugger Function:

Wrote this for a small CMS to return a nicel formatted error string.
Accepts either a string or Array as the argument and cn debug superglobals as well

(POST, SESSION, GET, COOKIE et al)