Monthly Archives: May 2007

Akismet and PHP for your site

A few sites I administer have recently had the misfortune of having spambots visit their enquiry and contact pages. These pages usually have a contact form, where an enquirer can leave their name, e-mail, and request or comment. When they submit the form, a copy of the message is e-mailed to the site owner. The [...]

Timezones and UTC in PHP

If you are dealing with multiple users in different timezones or simply want to display times in a timezone other than your server's settings, it is best to store timestamps as their UTC (~ GMT) equivalents. When you read those timestamps later, you can convert them to local time. Local time to UTC time PLAIN [...]

HTTP Status Codes

The following is a list of HTTP Status Codes returned by a web server and what they mean. The information is summarised from RFC2616 Section 10. Informational 1xx Informational responses that contain no message bodies. 100 Continue - The client should continue with the request. Either the request is in a queue or the client [...]

Prevent caching of page on client’s end – PHP and HTML solutions

To prevent the caching of a web page on your client's end, use the following snippet of PHP to ensure that the appropriate HTTP headers are sent. PLAIN TEXT PHP: header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Tue, 03 Jul 1979 00:00:00 GMT");   // Date in the past The first header tells the client that the [...]