Topic: Help: Stricter duplicate user name checking
Hi there. I'm new to PunBB and php, SQL as well so please bear with me here
What'd I'd like is for PunBB to be a little stricter with new member registrations in making sure their user name isn't similar to an existing member's. Along with being case-insensitive, I want to it to filter out all non-alphanumeric characters from both the users DB's username field and the new registration's username variable, then check them again each other. So that for example "New Dude" or "New_Dude" wouldn't be able to register if there is already a "NewDude" member, and vice-versa.
I figure I should either change the code in register.php line 128
$result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE UPPER(username)=UPPER(\''.$db->escape($username).'\') OR UPPER(username)=UPPER(\''.$db->escape(preg_replace('/[^\w]/', '', $username)).'\')') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
or else add a username_filtered field to the users DB and check against that. Any suggestions as to which approach would be better? If it's the former, I would be uber grateful for an example of the code
BTW, this is probably a dumb question, but why is the users.username field 200 characters when new registrations are limited to 25?
Adam