1 (edited by Holmen 2005-07-14 21:47)

Topic: [A-Z][a-z] and [0-9] usernames only, need help with register.php

The thing I wanna do is to change so only usernames with [a-z][A-Z] and [0-9] are allowed.

Though my problem now is the register.php, I'm trying to find out where it exits if e.g. the username is already in use.
As I read the register.php now the user will be registered(inserted into the database) even if something is wrong. This is not the case
so if anyone can help, it would be appreciated.

///
Christoffer "Holmen" Holmstedt

Re: [A-Z][a-z] and [0-9] usernames only, need help with register.php

In register.php, there are a number of rows of code that check the validity of the username. The code starts after the comment:

// Validate username and passwords

In there, you could add something like this:

if (preg_match('/[^a-zA-Z0-9]/', $username))
    message('Usernames must only contain bla bla...');

I'm tired, so the regex might be broken smile

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: [A-Z][a-z] and [0-9] usernames only, need help with register.php

Thanks it works just fine, the regex aswell wink

I added another error message to the $lang_prof_reg array.