Commit 668287a2 authored by Mac Newbold's avatar Mac Newbold

Fix a nit and a long-standing bug.

If I was red dot when my login timed out (or whatever) the login link
should go back to admin mode after I log in.

The bug was that by the time I get into loggedinordie, if my login isn't
valid, getuid fails, and uid is "", instead of what the cookie said. This
caused it always just to say "You do not appear to be logged in!" instead
of the real error (ie timed out, etc). So if uid=="", grab the uid from
the cookie instead of checking things for nobody.
parent 5b30eb58
......@@ -249,12 +249,30 @@ function CHECKLOGIN($uid) {
# conditions.
function LOGGEDINORDIE($uid, $modifier = 0) {
# If our login isn't valid, then the uid is already set to "",
# so refresh it to the cookie value. Then we can pass the right
# uid to hcecklogin, so we can give the right error message.
if ($uid=="") { $uid=$HTTP_COOKIE_VARS[$TBNAMECOOKIE]; }
# If I was reddot adminmode before I had problems, the login link
# should put me back in reddot immediately.
$q = DBQueryFatal("select admin,adminoff from users ".
"where uid='$uid'");
if (mysql_num_rows($q)>0) {
$r = mysql_fetch_array($q);
if (($r["admin"]==1) &&
($r["adminoff"]==0)) {
$adminstr = "&adminmode=1";
$link = "\n<blockquote><blockquote>\n".
"<table class=\"menu\" cellpadding=10 cellspacing=0 align=center>\n".
"<tr>\n<td class=\"menufooter\" align=center valign=center>\n".
"<a href=\"$TBBASE/login.php3?refer=1\">".
"<a href=\"$TBBASE/login.php3?refer=1$adminstr\">".
"<img alt=\"logon\" border=0 src=\"$BASEPATH/logon.gif\"></a>\n".
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment