We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11979
    • 8 Posts
    Hello everyone,
    The default websignup.inc.php script does not perform any special char checks. If you wish you only allow a-z, A-Z & 0-9 in your usernames, you can modify the script as follows

        // no spaces or special chars in username!
       if(ereg(' ', $username))   {
            $output = webLoginAlert("Username can not contain blank spaces or special chars!").$tpl;
            return;
        }
       if(ereg('[^[:space:]a-zA-Z0-9_.-]{1,}', $username))   {
            $output = webLoginAlert("Username can not contain blank spaces or special chars!").$tpl;
            return;
        }
    


    insert this chunk of code right above the email & password verification!

        // verify email
        if($email=='' || !ereg("^[-!#$%&'*+./0-9=?A-Z^_`a-z{|}~]+", $email)){
            $output = webLoginAlert("E-mail address doesn't seem to be valid!").$tpl;
            return;
        }
        // verify password
        if ($_POST['wsu_password']!=$_POST['confirmpassword']) {
            $output = webLoginAlert("Password typed is mismatched").$tpl;
            return;
        }
    


    hope this helps, thanks for modx!
    Brandon