1, 'hide_copyright' => 1, 'hide_sidebar' => 1); } else { $view = array(); } # # Must not be logged in already. # if (($this_user = CheckLogin($status))) { $this_webid = $this_user->webid(); if ($status & CHECKLOGIN_LOGGEDIN) { # # If doing a verification for the logged in user, zap to that page. # If doing a verification for another user, then must login in again. # if (isset($key) && (!isset($vuid) || $vuid == $this_webid)) { header("Location: $TBBASE/verifyusr.php3?key=$key"); return; } PAGEHEADER("Login",$view); echo "

You are still logged in. Please log out first if you want to log in as another user!

\n"; PAGEFOOTER($view); die(""); } } # # Spit out the form. # # The uid can be an email address, and in fact defaults to that now. # function SPITFORM($uid, $key, $referrer, $error, $adminmode, $simple, $view) { global $TBDB_UIDLEN, $TBBASE; PAGEHEADER("Login",$view); $premessage = "Please login to our secure server."; if ($error) { echo "
"; echo ""; switch ($error) { case "failed": echo "Login attempt failed! Please try again."; break; case "notloggedin": echo "You do not appear to be logged in!"; $premessage = "Please log in again."; break; case "timedout": echo "Your login has timed out!"; $premessage = "Please log in again."; break; default: echo "Unknown Error ($error)!"; } echo ""; echo "

\n"; } echo "
$premessage
(You must have cookies enabled)
\n"; $pagearg = ""; if ($adminmode == 1) $pagearg = "?adminmode=1"; if ($key) $pagearg .= (($adminmode == 1) ? "&" : "?") . "key=$key"; echo "\n"; if ($referrer) { echo "\n"; } if ($simple) { echo "\n"; } echo "
Email Address:
(or UserName)
Password:
\n"; echo "

Forgot your password?

\n"; } # # If not clicked, then put up a form. # if (! isset($login)) { # Allow page arg to override what we think is the UID to log in as. # Use email address now, for the login uid. Still allow real uid though. if (isset($vuid)) { # For login during verification step, from email message. $login_id = $vuid; } else { $login_id = REMEMBERED_ID(); } SPITFORM($login_id, $key, $referrer, $error, $adminmode, $simple, $view); PAGEFOOTER($view); return; } # # Login clicked. # $STATUS_LOGGEDIN = 1; $STATUS_LOGINFAIL = 2; $login_status = 0; $adminmode = (isset($adminmode) && $adminmode == 1); if (!isset($uid) || $uid == "" || !isset($password) || $password == "") { $login_status = $STATUS_LOGINFAIL; } else { if (DOLOGIN($uid, $password, $adminmode)) { # Short delay. sleep(1); $login_status = $STATUS_LOGINFAIL; } else { $login_status = $STATUS_LOGGEDIN; } } # # Failed, then try again with an error message. # if ($login_status == $STATUS_LOGINFAIL) { SPITFORM($uid, $key, $referrer, "failed", $adminmode, $simple, $view); PAGEFOOTER($view); return; } if (isset($key)) { # # If doing a verification, zap to that page. # header("Location: $TBBASE/verifyusr.php3?key=$key"); } elseif (isset($referrer)) { # # Zap back to page that started the login request. # header("Location: $referrer"); } else { # # Zap back to front page in secure mode. # header("Location: $TBBASE/"); } return; ?>