$isLoginRequest = true; } break; } // process login if this is a login-request if ($isLoginRequest) { // First User check $next_loc = "index.php?iid=index"; $sql = "SELECT count(*) FROM tf_users"; $user_count = $db->GetOne($sql); if ($user_count == 0) { firstLogin($user, $iamhim); $next_loc = "admin.php?op=serverSettings"; } // perform auth if (performAuthentication($user, $iamhim, $md5password) == 1) { @header("location: " . $next_loc); exit; } else { $tmpl->setvar('login_failed', 1); // reset the captcha if this was an auth types of 5 or 6. $bSetReCaptcha = $cfg["auth_type"] == 5 || $cfg["auth_type"] == 6; } } // Do we need to reset the captcha for this page? if ($bSetReCaptcha) { // write recaptcha code $tmpl->setvar('recaptcha_html', recaptcha_get_html($cfg["recaptcha_public_key"], $error)); } // defines $tmpl->setvar('auth_type', $cfg["auth_type"]);
define('_FILE_THIS', $_SERVER['SCRIPT_NAME']); // includes require_once "config.php"; require_once "functions.php"; // global fields $error = ""; $statusImage = "black.gif"; $statusMessage = ""; $htmlTitle = ""; $htmlTop = ""; $htmlMain = ""; // ----------------------------------------------------------------------------- // Main // ----------------------------------------------------------------------------- // authenticate first performAuthentication(); // get + define this version (is done in config.php but we dont want that here) define('_VERSION_THIS', trim(getDataFromFile(_VERSION_LOCAL))); // backup if (isset($_REQUEST["b"])) { $backupStep = trim($_REQUEST["b"]); if ($backupStep != "") { switch ($backupStep) { case "0": // choose backup-type buildPage("b"); $htmlMain .= '<br>'; $htmlMain .= '<a href="' . _FILE_THIS . '?b=3"><img src="images/arrow.gif" width="9" height="9" title="Backups on Server" border="0"> Backups on Server</a><p>'; $htmlMain .= '<form name="backupServer" action="' . _FILE_THIS . '" method="post">'; $htmlMain .= '<select name="c">'; $htmlMain .= '<option value="0">none</option>';
} // authenticate if (isAuthenticated() == 1) { // check if we are locked if ($cfg["webapp_locked"] == 1) { // only superadmin can login when we are locked if (!IsSuperAdmin()) { @header('location: locked.php'); exit; } } } else { // try to auth with supplied credentials $credentials = getCredentials(); if ($credentials !== false) { if (performAuthentication($credentials['username'], $credentials['password'], $credentials['md5pass']) == 1) { if (isAuthenticated() != 1) { @header('location: login.php'); exit; } $currentUser = $cfg["user"]; // check if we are locked if ($cfg["webapp_locked"] == 1) { // only superadmin can login when we are locked if (!IsSuperAdmin()) { @header('location: locked.php'); exit; } } } else { @header('location: login.php');