2006-08-19 10:52:33 +02:00
|
|
|
<?php
|
2006-05-23 07:07:38 +02:00
|
|
|
require_once "functions.php";
|
2006-03-27 04:47:07 +02:00
|
|
|
|
|
|
|
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"];
|
|
|
|
$return_to = $_POST["rt"];
|
2006-08-19 10:52:33 +02:00
|
|
|
$action = $_POST["action"];
|
2006-03-27 04:47:07 +02:00
|
|
|
|
2006-05-23 07:07:38 +02:00
|
|
|
if ($_COOKIE[get_session_cookie_name()]) {
|
2006-03-27 04:47:07 +02:00
|
|
|
require_once "../sessions.php";
|
|
|
|
if ($_SESSION["uid"]) {
|
|
|
|
initialize_user_prefs($link, $_SESSION["uid"]);
|
|
|
|
header("Location: $redirect_base/tt-rss.php");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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 ($_POST["remember_me"]) {
|
|
|
|
$_SESSION["cookie_lifetime"] = time() + SESSION_COOKIE_LIFETIME_REMEMBER;
|
|
|
|
} else {
|
|
|
|
$_SESSION["cookie_lifetime"] = time() + SESSION_COOKIE_LIFETIME;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$return_to) {
|
|
|
|
$return_to = "tt-rss.php";
|
|
|
|
}
|
|
|
|
header("Location: $redirect_base/$return_to");
|
|
|
|
exit;
|
2006-08-19 10:52:33 +02:00
|
|
|
} else {
|
|
|
|
$error_msg = "Error: Unable to authenticate user. Please check login and password.";
|
2006-03-27 04:47:07 +02:00
|
|
|
}
|
2006-08-19 10:52:33 +02:00
|
|
|
|
|
|
|
} else if ($action) {
|
|
|
|
$error_msg = "Error: Either login or password is blank.";
|
2006-03-27 04:47:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Tiny Tiny RSS : Login</title>
|
|
|
|
<link rel="stylesheet" type="text/css" href="mobile.css">
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
2006-03-27 07:56:37 +02:00
|
|
|
<div id="content">
|
|
|
|
<div id="heading">Tiny Tiny RSS</div>
|
2006-03-27 04:47:07 +02:00
|
|
|
|
|
|
|
<form action="login.php" method="POST">
|
2006-08-19 10:52:33 +02:00
|
|
|
<input type="hidden" name="rt" value="<?php echo $_GET['rt'] ?>">
|
|
|
|
<input type="hidden" name="action" value="login">
|
|
|
|
|
|
|
|
<?php if ($error_msg) { ?>
|
|
|
|
<div class="loginError"><?php echo $error_msg ?></div>
|
|
|
|
<?php } ?>
|
2006-03-27 04:47:07 +02:00
|
|
|
|
2006-03-27 07:56:37 +02:00
|
|
|
<table>
|
|
|
|
<tr><td align='right'>Login:</td><td><input name="login"></td>
|
|
|
|
<tr><td align='right'>Password:</td><td><input type="password" name="password"></tr>
|
2006-03-27 04:47:07 +02:00
|
|
|
|
2006-03-27 07:56:37 +02:00
|
|
|
<tr><td colspan='2'>
|
|
|
|
<input type="submit" class="button" value="Login">
|
|
|
|
<input type="checkbox" name="remember_me" id="remember_me">
|
|
|
|
<label for="remember_me">Remember me</label></td></tr>
|
|
|
|
</table>
|
2006-03-27 04:47:07 +02:00
|
|
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
</div>
|
2006-03-27 07:56:37 +02:00
|
|
|
|
2006-03-27 04:47:07 +02:00
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|
2006-08-19 10:52:33 +02:00
|
|
|
<?php db_close($link); ?>
|
2006-03-27 04:47:07 +02:00
|
|
|
|