Tag: php

  • PHP: Avoiding “Headers already sent by…” errors

    Just a quick post inspired by Techgirl, here’s how to avoid the annoying PHP errors “Headers already sent by…” when working with multiple files. Basically, a PHP script usually looks like: <?php include “my.lib.php”; include “otherstuff.php”; …. ?> however, if my.lib.php (for example) looks like: <?php …. … ?> (do you see the hidden “new […]

  • Coding: Password Security in Cookies

    Via boren.nu, I came across a nice detailed section on how to create a secure cookie and password system (which will be implemented in WordPress 2.4): Cookies will be based on the secure cookie protocol described here. The cookie is structured like so: user name|expiration time|HMAC( user name|expiration time, k) where k = HMAC(user name|expiration […]

  • Techy: Discontinuation of PHP4

    I’ve already blogged about 13 facts about Friday the 13th which is paraskevidekatriaphobia or just triskaidekaphobia if you only fear the number 13. But Friday the 13th of July 2007 will go down as a “notable date” for some web developers – it’s the day that the End of Life of PHP4 was announced. PHP4 […]

  • Techy: Background Processes In PHP

    From What You’re Doing Is Rather Desperate is a very nice way of running a background task in PHP. I’ve implemented compression of a .tar file in the following method using this code: $ps=runinbackground(“gzip -v $tarfile -c 1> “.$tmp.”download.tar.gz 2>”.$tmp.”download.tar.log”); $count=0; while (isprocessrunning($ps)) { sendupdate(3,’overall’,’Compressing’.str_repeat(‘.’,$count).$lastline); $count++; if ($count>8) { $count=0; } sleep(1); } function runinbackground($command) […]