A PHP script for converting between different datetimes

This script converts a Unix timestamp (Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)) to the International Standard ISO 8601 date and time notation (YYYY-MM-DD hh:mm:ss) and vice versa. I find it useful for verifying datetimes.
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en” lang=”en”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ [...]

Protecting a download using a unique URL

A client asked me to develop a simple method for protecting a download (or digital product) by generating a unique URL that can be distributed to authorized users via email. The URL would contain a key that would be valid for a certain amount of time and number of downloads. The key will [...]

A PHP script for testing a MySQL database connection

A simple page for testing the connection to a MySQL database. The PHP script will test the server address, username and password. If the database field is left empty, it will return a list of available databases. Testing a specific database is optional, but if a database name is supplied, it will [...]

Using timestamps to reduce WordPress comment spam

In this post, I’ll explain how to reduce the amount of comment spam your WordPress blog receives by using an unobtrusive ‘handshake’ between the two files necessary for a valid comment submission to take place. I’ve written a few different articles on reducing comment spam by means of a challenge response test that the [...]

A collection of PHP code snippets

This is a collection of php code snippets that seem to come in handy rather often. They are assembled here more for my own organization than anything else.
String: trim and convert to lowercase
A very straightforward but useful snippet. A string is first trimmed of any leading or trailing white space, and then converted [...]

Defeating WordPress comment spam

Comment spam comes from humans who are paid to post it and robots/scripts that do it automatically. The majority of spam comes from the bots. There’s very little one can do to defend against a determined human being, but bots tend to behave predictably, and that allows us to develop countermeasures.
From my observations, [...]

Plogger 3 theme: Broadway

This is a rough beta of a new, dark, Plogger 3 theme. It takes elements from the Yahoo! Broadway page of 2007.

Download the beta version (v0.1 beta)
Download the beta version of the Plogger 3 Broadway theme here. I still need to clean up the code and the CSS, and check it more thoroughly [...]

Fixing warnings in the WordPress Sociable plugin

I’ve fixed some errors that I was experiencing with version 2.0 (dated 2007-02-02) of the Sociable WordPress plugin by Peter Harkins. Specifically, when running WordPress 2.2+, I would get the following warnings when saving changes:
Warning: implode() [function.implode]: Bad arguments. in PATH\wp-content\plugins\sociable\sociable.php on line 651

Warning: Invalid argument supplied for foreach() in PATH\wp-content\plugins\sociable\sociable.php on line 762

For [...]

Correcting for line descent in Firefox

I was working on a theme for the image gallery Plogger when an old problem cropped up again. I was adding links to thumbnail images, and had given the anchor a padding of 3 pixels and a 1 pixel border so that the link formed a sort of picture frame around the image. [...]

Centering the thumbnails in Plogger

This post illustrates a method of centering the thumbnails in the album view of the PHP image gallery Plogger. The method automatically adjusts for thumbnails of varying widths and pages containing less than a full row of images.
This method is implemented in the Plogger 3 theme: Air, but it should work in any theme [...]