Jump to content

Archived

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

DarkendSoul

Checking username for bad characters

Recommended Posts

Well when registering for an account I want it so your username can only have letters (caps/lower) and numbers along with _ (underscore) but i have no clue how i would do this... can someone help me out? :(

Share this post


Link to post
Share on other sites
$string = $_POST['usrnm'];

if (preg_match('/[^0-9a-zA-Z]/',$sting) === true){
// no you can't boyo!!!!
}

Share this post


Link to post
Share on other sites
lol i hate preg_* their mixed searches get me so confused, i dont know what will and wont work...

thanks for the help, i think it'll work. :D

Share this post


Link to post
Share on other sites

×

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.