ossipetz Posted September 21, 2009 Posted September 21, 2009 File Name: Restrict allowed chars in usernamesFile Submitter: ossipetzFile Submitted: 15 Jan 2006File Category: Modifications Hallooooo this small mod will prevent user to use chars for usernames when they register. import the settings file in admin panel. a new section 'Usernames' will appear. open the file: /sources/action_public/register.php search for: maybe its of some use for someone :-)Click here to download this file //----------------------------------------- // Check for errors in the input. //----------------------------------------- if ( ! $in_username OR strlen($len_u) < 3 OR strlen($len_u) > 32 ) { $form_errors['username'][] = $this->ipsclass->lang['reg_error_username_none']; } replace with: // additional username checks: $in_usr_minlength = (int)$this->ipsclass->vars['usernames_minlength']; $in_usr_maxlength = (int)$this->ipsclass->vars['usernames_maxlength']; $in_usr_badchars = "/[". preg_quote($this->ipsclass->vars['usernames_badchars']) ."]/"; //echo "PATTERN: $in_usr_badchars"; //if(preg_match($in_usr_badchars, $in_username)){ // echo "BAD CHARS"; //} if (! $in_password OR strlen($len_p) < $in_usr_minlength OR strlen($len_p) > $in_usr_maxlength OR preg_match($in_usr_badchars, $in_username) ) { $form_errors['password'][] = $this->ipsclass->lang['reg_error_no_pass']; }
Recommended Posts
Archived
This topic is now archived and is closed to further replies.