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 [...]

Resolving transaction concurrency issues in a PHP+MySQL multi-user environment

I’ve been developing a PHP/MySQL web application that involves multiple users opening and editing records in the database. There is a very real possibility that two or more people will open the same record, make changes, and attempt to save these changes.
The most common concurrent execution problem that I expect to see is the [...]

How to Geolocate Visitors Using an IP-to-Country Database

In this post, I’ll illustrate how to use the IP-to-Country database available from http://ip-to-country.webhosting.info/ to identify the real-world geographic location of visitors to a web page (geolocate) based on their IP addresses. Once you know where a visitor is physically located, you can do all sorts of nifty things, such as send them location-aware [...]

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 [...]

500 error with GoDaddy’s form mail

I was getting a 500 error when trying to submit a form mail from my web site via GoDaddy’s gdform.cgi. I turned on error logging and this is what showed up:
SoftException in Application.cpp:624: Could not execute script “/home/content/a/r/d/ardamis/html/cgi/gdform.cgi”
Caused by SystemException in API_Linux.cpp:430: execve() for program “/home/content/a/r/d/ardamis/html/cgi/gdform.cgi” failed: Permission denied
[Sun Dec 2 01:34:05 2007] [...]

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 [...]