Contact Form to E-mail script validates e-mails and checks against e-mail header injection
November 23, 2006
Contact forms aren't hard to code, and the PHP mail() function is pretty simple - and yet, implementing such a form, handling the POSTed information, error-checking, and providing basic security, can quickly seem a daunting task.
and still, sometimes, the spambots win.
Ars Informatica provides a very simple, easy-to-modify script to generate your own feedback form. It provides all the functionality mentioned in the opening sentence.
You provide two lines of code, total, and you're off. Though you may wish, and are free, to change this code as much as you like.
[ Read more ... ]
E-mail address validation using PHP preg_match
November 13, 2006
For PHP or Regular Expression (regex) newcomers, a single line of code used to validate e-mail addresses submitted by visitors to your site.
Regular expression matching can seem very daunting; the code certainly isn't self-explanatory. By way of introduction to the subject, we dissect this single line of code. We also explain the preg_match function in its simplest form, contrast PERL- and POSIX-compatible regex functions, and give you references so you can dig deeper.
[ Read more ... ]
PHP Script Timer finds the code that's choking you ...
May 17, 2006
Code choking your server's CPU? Site visitors clicking away because your page is taking too long to respond? Do you know?
Some code just plods. Retrieving and parsing remote files, image manipulations, multiple complex SQL queries, etc. grind down your site. Our PHP Script Timer identifies these bottlenecks.
For example, you want to retrieve and parse a remote RSS news feed. Do you use a locally cached file copy if it's current enough? Do you not bother, and just use the remote feed each time? Does it matter? Using our walRuSS.php RSS feed reader gives us the following script execution times:
xml_parser-based RSS feed reader, non-cached: 1.554 secs [ Read more ... ]
xml_parser based feed reader, cached: 0.0444 secs