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!
One of my favorite social APIs was the Open Graph API adopted by Facebook. Adding just a few META tags to each page allowed links to my article to be styled and presented the way I wanted them to, giving me a bit of control...
When you say or read "HTML5", you half expect exotic dancers and unicorns to walk into the room to the tune of "I'm Sexy and I Know It." Can you blame us though? We watched the fundamental APIs stagnate for so long that a basic feature...
GitHub seems to change a lot but not really change at all, if that makes any sense; the updates come often but are always fairly small. I spotted one of the most recent updates on the pull request page. Links to long branch...
jQuery is namespaced so the...