[pmwiki-users] Userauth newuser, added feature and one question

Florian Fischer Flori-Fischer at gmx.net
Wed Nov 8 09:11:43 CST 2006


Hello,

I'm trying to improve Userauth-newuser a bit. First of all i tried to check whether a user already exists. This works fine with the following piece of code of the recipe UserAuth-NewUser.

function UserauthNewUser() {
  global $ScriptUrl,$HTMLStartFmt,$HTMLEndFmt,$UserInfoObj;
  #PrintFmt($pagename,$HTMLStartFmt);
  $arg['uname']   = @$_POST['uname'];
  $arg['email']   = @$_POST['email'];
  $arg['uname']   = preg_replace('/\s/', '', $arg['uname']);
  $arg['rname']   = $arg['uname'];
  $arg['errors']  = '';
if($UserInfoObj->DoesUserExist($arg['uname'])){
    //fail... user exists...
    return "<p>This user already exists.Please return to the registry page</p>";
  }
else{
 return ($arg['uname'] && $arg['email'])
    ? UserauthNewUserReport($arg)
    : UserauthNewUserForm($arg);
}

Now, trying to check whether the posted email adress is valid.
I tried this by adding under the first if clause

if (! ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $arg['email']))
{return "<p>Mail not valid</p>";
  }

But loading my Registry page i get the "Mail not valid" and the Registerform isn't displayed. What seems strange to me, is that the "USercheck" works fine. But the Emailcheck seems to be triggered out before the registerform is loaded.

Any ideas?

Florian

-- 
GMX DSL-Flatrate 0,- Euro* - Überall, wo DSL verfügbar ist!
NEU: Jetzt bis zu 16.000 kBit/s! http://www.gmx.net/de/go/dsl




More information about the pmwiki-users mailing list