Jump to content

php username validations


Nandini

Recommended Posts

Hi

i am designing php aurthentication script. I want to validate username field while create useraccount. I want to validate username as same as gmail username.

 

That means

 

only letters (a-z), numbers (0-9), and periods (.) are allowed. and

 

username cannot contain consecutive periods (.),  like this.

 

i have used the following line of code. But i did not get complete solution.

 

eif(!eregi("^[a-z0-9.]{4,16}$",$_POST['username']))

{

$errmsg='Only letters (a-z), numbers (0-9), and periods (.) are allowed for username.';

}

 

Can anyone give me solution

Link to comment
https://forums.phpfreaks.com/topic/141577-php-username-validations/
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.