Jump to content

Download: Restrict allowed chars in usernames


ossipetz

Recommended Posts

Posted

File Name: Restrict allowed chars in usernames
File Submitter: ossipetz
File Submitted: 15 Jan 2006
File 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'];

        }

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...