// require_once "sessions.php"; require_once "sanity_check.php"; require_once "version.php"; require_once "config.php"; require_once "functions.php"; $url_path = get_script_urlpath(); $redirect_base = "http://" . $_SERVER["SERVER_NAME"] . $url_path; if (SINGLE_USER_MODE) { header("Location: $redirect_base/tt-rss.php"); exit; } $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); $login = $_POST["login"]; $password = $_POST["password"]; if ($_COOKIE["ttrss_sid"]) { require_once "sessions.php"; if ($_SESSION["uid"]) { initialize_user_prefs($link, $_SESSION["uid"]); header("Location: $redirect_base/tt-rss.php"); } } if ($login && $password) { if ($_POST["remember_me"]) { session_set_cookie_params(SESSION_COOKIE_LIFETIME_REMEMBER); } else { session_set_cookie_params(SESSION_COOKIE_LIFETIME); } require_once "sessions.php"; if (authenticate_user($link, $login, $password)) { initialize_user_prefs($link, $_SESSION["uid"]); if ($_SESSION["login_redirect"]) { $redirect_to = $_SESSION["login_redirect"]; } else { $redirect_to = "tt-rss.php"; } header("Location: $redirect_base/$redirect_to"); } } if ($_GET["rt"]) { $_SESSION["login_redirect"] = $_GET["rt"]; } ?>