Firefox PHP

[register] How to limit format of username?

Posted by hkbb 
[register] How to limit format of username?
August 29, 2004 08:14AM
How do I restrict the username entered during user registration?

e.g. only /^[a-z][a-z0-9_]/, maximum 10 characters?
Re: [register] How to limit format of username?
August 29, 2004 09:43AM
you'd need to hack register.php for that.


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: [register] How to limit format of username?
August 29, 2004 10:03AM
Done.

In register.php:

----------------------------------------------------
if(count($_POST)){
if(!isset($_POST["username"]) || empty($_POST['username']) ){
$error = $PHORUM["DATA"]["LANG"]["ErrUsername"];

--- add the following ---
}elseif (!ereg("^[a-z][a-z,0-9,_]",$_POST["username"]) || strlen($_POST["username"])<3) {
$error = "Invalid Username. Your Username can only be
composed of letters (a-z, lower case letters only), numbers (0-9)
and underscores(_). Minimum 3 characters are required.";
--- add END --

}elseif(!isset($_POST["email"]) || !phorum_valid_email($_POST["email"])){
$error = $PHORUM["DATA"]["LANG"]["ErrEmail"];

----------------------------------------------------
Re: [register] How to limit format of username?
August 29, 2004 10:05AM
Please comment on my modification. I wonder if there are more efficient way to write that part. I'm not familiar with *new* PHP syntax...

Thanks.
Sorry, only registered users may post in this forum.

Click here to login