We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 867
    • 241 Posts
    If someone use an accent in his login’name (has french people do..)
    cause in the database its coded..

    (utf8 both for the site and sql)

    PHP error debug
    Error: Invalid argument supplied for foreach()
    Error type/ Nr.: Warning - 2
    File: /homepages/43/d232224317/htdocs/assets/snippets/webloginpe/webloginpe.class.php
    Line: 1167
    Line 1167 source: foreach ($theUser as $attribute => $value)

    ??
      • 867
      • 241 Posts

      Can scotty or someone confirm that code would do the trick (and maybe précision where to include it the class) ?

      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

      Code:

      // 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;
      }
      http://modxcms.com/forums/index.php/topic,23393.0.html
      Topic: modification to websignup form
        • 867
        • 241 Posts
        I finally change line 466 in weblogin class

        // Check username for bullshit.
        $illegals = array(’.’ , ’,’ , ’/’ , ’\\’ , ’`’ , ’;’ , ’[’ , ’]’ , ’-’, "’", ’*’, ’&’, ’^’, ’%’, ’$’, ’#’, ’@’, ’!’, ’~’, ’+’, ’(’, ’)’, ’|’, ’{’, ’}’, ’<’, ’>’, ’?’,’é’,’è’,’à’,’î’,’ô’, ’:’, ’"’, ’=’);
        $badUsername = str_replace($illegals, ’’, $username);

        I believe that will do. grin
          • 31471
          • 206 Posts
          In my case the error is:
          Line 1195 source: foreach($attributes as $field => $value)

          I would much like to see a fix by which all utf8 characters would be allowed in the login name -- just like in the manager part of MODx.
            • 31471
            • 206 Posts
            I think that WebloginPE handles the webusers’ array in a fundamentally wrong way. (At the sorting part around the 1190-1200th lines of webloginpe.class.php.)
            It is taking usernames as associative ID keys for the array of users. Since PHP doesn’t understand unicode, this way a wrong attribute stops the code if any one of the usernames contains accent chars.

            The MODX manager accepts unicode usernames.
            It is obvious to fix WebloginPE to do it as well!

            It’s not a solution to enable to register only non-unicode names!

            This snippet is far-far from basic. Let’s make it work well for unicode-people too!