php - Validation of not allowed username string in input form -



php - Validation of not allowed username string in input form -

i have collection of string stored in database table separated comma.

table "not_allowed" content :

admin,administrator,register,email,password,username,database,computer,... etc. (as admin defind)

in user registration, want collection of string "not allowed" username input.

how create validation in php in relation database table content?

manual scipt have :

$notallowed = array('admin','administrator','register','email','password','username','database','computer',... etc); if (in_array($username, $notallowed, true)) { $errors[] = 'the selected username not allowed! '; }

create table in db called not_allowed. utilize store not allowed strings. when user signs in, query table not allowed strings. store result in variable , utilize in same way utilize now.

depending on programme construction can done in different ways, here's basic thought using mysqli:

$query = $mysqli->query("select * not_allowed"); $not_allowed = $query->fetch_array(); if (in_array($username, $not_allowed, true)) { $errors[] = 'the selected username not allowed! '; }

php mysql

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -