DarkendSoul Posted August 18, 2006 Share Posted August 18, 2006 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? :( Link to comment https://forums.phpfreaks.com/topic/17899-checking-username-for-bad-characters/ Share on other sites More sharing options...
ToonMariner Posted August 18, 2006 Share Posted August 18, 2006 $string = $_POST['usrnm'];if (preg_match('/[^0-9a-zA-Z]/',$sting) === true){ // no you can't boyo!!!!} Link to comment https://forums.phpfreaks.com/topic/17899-checking-username-for-bad-characters/#findComment-76533 Share on other sites More sharing options...
DarkendSoul Posted August 18, 2006 Author Share Posted August 18, 2006 thank you :) but by quick look at it it doesnt look like your aloud to use underscores :\ Link to comment https://forums.phpfreaks.com/topic/17899-checking-username-for-bad-characters/#findComment-76534 Share on other sites More sharing options...
ToonMariner Posted August 18, 2006 Share Posted August 18, 2006 ok ....preg_match('/[^0-9a-zA-Z_]/' Link to comment https://forums.phpfreaks.com/topic/17899-checking-username-for-bad-characters/#findComment-76537 Share on other sites More sharing options...
DarkendSoul Posted August 18, 2006 Author Share Posted August 18, 2006 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 Link to comment https://forums.phpfreaks.com/topic/17899-checking-username-for-bad-characters/#findComment-76565 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.