Jump to content

PHP Validation


pranshu82202

Recommended Posts

I have a form validation script which is written in php..

 

I want to add a validation (in registration form) that if the desired username contains either admin or owner keyword user will have to change his user name..

 

I made the following code but it does not work..

 

if(strpos($user_name, "admin")>=0 || strpos($user_name, "moderator")>=0 || strpos($user_name, "owner")>=0)

{

$error=$error."You are not allowed to take such Username<br>";

$bool=false;

 

}

 

 

In this code i am not able to enter any username..

 

And if i change >= to > then "admin123" username is going to be valid...

 

I am troubled .... help me out guyzzz

 

[email protected]

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