// This is the line where we actually try to authenticate against some kind
         // of user database. Note that depending on the auth backend, this function might
         // redirect the user to a different page, in which case it does not return.
         $ulogin->Authenticate($_POST['user'], $_POST['pwd']);
         if ($ulogin->IsAuthSuccess()) {
             // Since we have specified callback functions to uLogin,
             // we don't have to do anything here.
         }
     } else {
         $msg = 'invalid nonce';
     }
 } else {
     if ($action == 'autologin') {
         // We were requested to use the remember-me function for logging in.
         // Note, there is no username or password for autologin ('remember me')
         $ulogin->Autologin();
         if (!$ulogin->IsAuthSuccess()) {
             $msg = 'autologin failure';
         } else {
             $msg = 'autologin ok';
         }
     } else {
         if ($action == 'create') {
             // We were requested to try to create a new acount.
             // New account
             if (!$ulogin->CreateUser($_POST['user'], $_POST['pwd'])) {
                 $msg = 'account creation failure';
             } else {
                 $msg = 'account created';
             }
         }