Vancouver Web Consultants

July 10, 2009

Validating a URI with PHP

Filed under: PHP — Tags: , — Nelson @ 4:34 pm

If you find yourself needing to validate a URI, not just checking that it’s well formed with a regular expression like this:

/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i

…but actually verifying that the URI points to a functioning web page, the following code will do the trick. (more…)

June 5, 2009

Secure Javascript Form Validation with Mootools

Filed under: Mootools, Tutorials, Usability — Tags: , , , — Nelson @ 8:33 am

Did I get you with the title? That’s right, it’s not possible to securely validate a form with Javascript. That is, you can’t prevent invalid data from being submitted to the server by using Javascript for validation. We’ve all seen Javascript-based form validation classes (and classes for Javascript libraries like Mootools, which is my favourite, so I’ll be making reference to it here), but it’s all too often not made clear enough to those who might use such classes that javascript validation alone provides no security against invalid data being sent to your back-end processing script and making it into your database.

(more…)

March 13, 2009

Mootools Function for Limiting Number of Checkboxes Checked

Filed under: Mootools, Tutorials — Tags: , , , , — Nelson @ 1:33 pm

Here’s a handy function for controlling how many boxes can be checked in a group of checkboxes. (more…)

Powered by WordPress