Simple Username Creation Validation with PHP
When I create login areas (mostly intranets) for small websites, I'm always asked by the customer to keep
usernames to letters and numbers. That means no email addresses as usernames
and special characters like "_", "-", and ".". This, in my customer's mind,
keeps the login easy for their users and limits the number of support calls
they will receive. While I don't recommend disallowing common username
characters like the ones cited above, I do understand their need for simplicity.
Here's how, using PHP, I validate that a username is only letters and numbers.
function validate_username($input,$pattern = '[^A-Za-z0-9]')
It's as easy as that. I don't go as far as using this for passwords, but you could if you wanted to. I'll also mention that if I want to allow non-alphanumeric characters, I just need to change the function's pattern. Easy enough!
My trip to Mozilla Summit 2013 was incredible. I've spent so much time focusing on my project that I had lost sight of all of the great work Mozillians were putting out. MozSummit provided the perfect reminder of how brilliant my colleagues are and how much...
I was recently working on a project which featured tables that were keyboard navigable so obviously using cell outlining via traditional
tabIndex=0 and element outlines was a big part of allowing the user navigate quickly and intelligently. Unfortunately I ran into a Firefox 3.6 bug...