Jump to content

[SOLVED] validating username


ballouta

Recommended Posts

Hello

 

I have this expression to validate the username before registration:

 

<?php
if(!preg_match("!^[a-z0-9_~]{1,30}$!i", $uname))
{
        echo "You have entered an invalid username.";
} 
?>

 

It is very important for me that

-spaces are not allowed

-usernames can be only letters  or numbers or alphanumeric no special signs (# % & $ @ etc..)

 

does my expression do all this?!

Many thanks

Link to comment
https://forums.phpfreaks.com/topic/158876-solved-validating-username/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.