A Useful Error Controller Class For Zend Framework Applications
Tue, 12/23/2008 - 15:58 | by philipnorton42One useful function of any application is to report on any errors that occurred. Zend Framework comes with a nice error controller system that you can activate by creating an ErrorController class.
The following is an ErrorController class that I use. It detects what sort of error occurred and displays a message to the user. It will also email a detailed report of the error to the server admins.
Mask Email With ASCII Character Codes In PHP
Mon, 04/28/2008 - 14:26 | by philipnorton42Hiding your email address in an image is the best way of encrypting your email, but if your server doesn't support the GD2 library, or if you don't want to use it, then you might want to look at a different way of doing this.
Common Regular Expressions
Mon, 03/24/2008 - 10:32 | by philipnorton42Here are some of the regular expressions that I frequently use.
Find a blank line
^$
Spaces
[ \t]+
You can use this to break a text string apart into words.
Date
\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}
This will match anything in the format mm/dd/yyyy, or even dd/mm/yyyy.
Simple PHP Script To Hide An Email Address In An Image
Tue, 03/04/2008 - 14:43 | by philipnorton42Spam is a problem. You want to allow people who genuinely want to get in touch to see your email address, but doing this invariably leads to you getting thousands of spam emails.
One solution is to hide your email address in an image, but it can be a pain to create an image for every email address you need. A better solution is to use the PHP GD functions to create an image at runtime so that your email address is displayed, but is completely unreadable to spammers.
To to this you will need to create an image tag on your website, here is an example.
PHP Email Validation Function
Thu, 02/07/2008 - 15:07 | by philipnorton42Every time you accept any input from a use you should attempt to validate it. This is to stop users trying to break the site and also corrects silly mistakes that users might introduce to their input.
Before sending off an email to a new user congratulating them on signing up it is best to validate that email address. Here is function that does this.