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!
For maximum performance, we all know we must put our assets on CDN (another domain). Along with those assets are custom web fonts. Unfortunately custom web fonts via CDN (or any cross-domain font request) don't work in Firefox or Internet Explorer (correctly so, by spec) though...
With CSS border-radius, I showed you how CSS can bridge the gap between design and development by adding rounded corners to elements. CSS gradients are another step in that direction. Now that CSS gradients are supported in Internet Explorer 8+, Firefox, Safari, and Chrome...
One of the plugins I'm most proud of is Dotter. Dotter allows you to create the typical "Loading..." text without using animated images. I'm often asked what a sample usage of Dotter would be; form submission create the perfect situation. The following...