pluginbaby Posted November 15, 2006 Share Posted November 15, 2006 Hi,I want to allow only a-z,A-Z,0-9 in a username when anyone registers on my website, all other characters are not allowed, but I can't find a function to check it. Maybe I'm overlooking a function or so. Can someone help me? Link to comment https://forums.phpfreaks.com/topic/27332-check-username-for-characters/ Share on other sites More sharing options...
Orio Posted November 15, 2006 Share Posted November 15, 2006 You can easily do that using [b]regular expressions[/b]:[code]<?phpif(!ereg("^[a-zA-Z0-9]+$", $username)) die("Invalid user!!");?>[/code]Orio. Link to comment https://forums.phpfreaks.com/topic/27332-check-username-for-characters/#findComment-124976 Share on other sites More sharing options...
pluginbaby Posted November 15, 2006 Author Share Posted November 15, 2006 thank youI never thought of that easy solution, I feel so dumb ;D ;D Link to comment https://forums.phpfreaks.com/topic/27332-check-username-for-characters/#findComment-124986 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.