function unset_superadmin_id($uid) { global $dbh; $super_id = get_superadmin_id(); if ($super_id == $uid) { $update = "UPDATE maia_users SET user_level = 'U' " . "WHERE id = ?"; $dbh->query($update, array($uid)); return true; } else { return false; } }
function unset_superadmin_id($uid) { global $dbh; $super_id = get_superadmin_id(); if ($super_id == $uid) { $sth = $dbh->prepare("UPDATE maia_users SET user_level = 'U' " . "WHERE id = ?"); $sth->execute(array($uid)); if (PEAR::isError($sth)) { die($sth->getMessage()); } $sth->free(); return true; } else { return false; } }
$_SESSION["firsttime"] = true; } if ($euid == 0) { $euid = $uid; } $_SESSION["timeout"] = time() + $default_session_timeout * 60; $_SESSION["clock_offset"] = $clock_offset; // Set session variables $_SESSION["uid"] = $uid; $_SESSION["euid"] = $euid; // set up language preferences $_SESSION["display_language"] = isset($_POST["language"]) ? trim($_POST["language"]) : get_display_language($euid); // If the $super variable was set, try to process the // (supposed) superuser's request. if ($super == "register") { if (get_superadmin_id() == 0) { set_superadmin_id($uid); } } elseif ($super == "unregister") { if (is_superadmin($uid)) { unset_superadmin_id($uid); } } // First time through, we don't know whether the user's // browser accepts cookies, so we include the session ID // in the GET just in case. header('Location: index.php?' . session_name() . '=' . session_id() . '&' . $_SERVER['QUERY_STRING']); exit; } else { $uid = 0; $euid = 0;
// Determine the user's language preference if (isset($_GET["lang"]) && strlen($_GET["lang"]) == 2) { $display_language = trim($_GET["lang"]); } else { $display_language = $default_display_language; } require_once "./locale/{$display_language}/db.php"; require_once "./locale/{$display_language}/display.php"; require_once "./locale/{$display_language}/smtp.php"; require_once "./locale/{$display_language}/internal-init.php"; require_once "./smarty.php"; $smarty->assign("display_language", $display_language); $smarty->assign("error", ""); // Only show this page if we've selected internal // authentication and there's no current superadmin if ($auth_method != "internal" || get_superadmin_id() > 0) { header("Location: /index.php"); exit; } if (isset($_POST["submit"])) { $smarty->assign("submitted", true); if (isset($_POST["your_email"])) { $your_email = trim($_POST["your_email"]); } else { $your_email = ""; } if (isset($_POST["admin_email"])) { $admin_email = trim($_POST["admin_email"]); } else { $admin_email = ""; }