well actually it was between 3 and 12 letters long. You can actually do regular expression checking with javascript, which would be useful here.
Its always best to have PHP check it as well, just incase the user has javascript switched-off.
you want a reg expression something like:
if (ereg("^[a-z][a-z0-9\-_]{1,10}[a-z0-9]$", $var))
{
username OK
}
else
{
username not OK
}
Try here for a decent run down.
Javascript regular expressions match in a similar way, (the execution is slightly different though)
This is a slight modification on a reg - ex i currently use, i think it should work
function check_date(input)
{
var date_format = /^[a-z][a-z0\-9-_]{1,10}[a-z0-9]$/ ;
var matcharray = date_format.exec(input.value) ;
if (!matcharray)
{
return 0;
}
else
{
return 1;
}
}
Run the function as part of a validation script, it takes the input name as a variable, and outputs 0 if it doesn't match and 1 if it does.
Jamie