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!
Client-side APIs on mobile and desktop devices are quickly providing the same APIs. Of course our mobile devices got access to some of these APIs first, but those APIs are slowly making their way to the desktop. One of those APIs is the getUserMedia API,...
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...
One thing I love doing is duplicating OS functionalities. One of the things your OS allows you to do easily is move from one item to another. Most of the time you're simply trying to get to the next or the previous item....
Last week we created a very simple MooTools slideshow script. The script was very primitive: no events and no next/previous controls -- just cross-fading between images. This tutorial will take the previous slideshow script a step further by:
Adding "Next" and "Previous" controls.