Hello, I'm currently making a website where Users can register. I'm trying to cover my own backside by maing it so users are limited to what they may and may no have in their usernames.
Here's my code:
CODE
<?
$pattern = '/^[^0-9][A-z0-9_]+([A-z0-9_]+)$/';
$User = $_POST['User'];
$Err = new Array();
if(!preg_match($pattern,$User))
{
$Err[] = 'The <b>username</b> you\'ve selected has invalid characters.';
}
?>
...
...
What does that allow or disallow. I figured that out reading through a tutorial just putting bit and bobs in random places, then moving it about because it didn't work. I would dearly appreciate it if someone could write a tutorial on
DreamInCode if no one has already.
Any help greatly appreciated, Mark.
This post has been edited by huzi8t9: 19 Sep, 2008 - 11:45 AM