Jump to content

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

 

-pranshu.a.11@gmail.com

Link to comment
https://forums.phpfreaks.com/topic/245417-php-validation/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.