2005-11-18 03:50:47 +01:00
|
|
|
<?
|
2006-03-04 11:58:25 +01:00
|
|
|
// require_once "sessions.php";
|
2005-11-18 03:50:47 +01:00
|
|
|
|
2005-11-23 18:20:17 +01:00
|
|
|
require_once "sanity_check.php";
|
2005-11-18 03:50:47 +01:00
|
|
|
require_once "version.php";
|
|
|
|
require_once "config.php";
|
2005-11-18 07:21:24 +01:00
|
|
|
require_once "functions.php";
|
2005-11-18 03:50:47 +01:00
|
|
|
|
2005-12-09 21:34:29 +01:00
|
|
|
$url_path = get_script_urlpath();
|
|
|
|
$redirect_base = "http://" . $_SERVER["SERVER_NAME"] . $url_path;
|
|
|
|
|
2005-11-21 05:25:48 +01:00
|
|
|
if (SINGLE_USER_MODE) {
|
2005-12-09 21:34:29 +01:00
|
|
|
header("Location: $redirect_base/tt-rss.php");
|
2005-11-21 05:25:48 +01:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2005-11-18 07:21:24 +01:00
|
|
|
$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
|
|
|
|
|
|
|
|
$login = $_POST["login"];
|
|
|
|
$password = $_POST["password"];
|
2006-03-17 06:11:45 +01:00
|
|
|
$return_to = $_POST["rt"];
|
2005-11-18 07:21:24 +01:00
|
|
|
|
2006-03-17 03:55:38 +01:00
|
|
|
if ($_COOKIE["ttrss_sid"]) {
|
|
|
|
require_once "sessions.php";
|
|
|
|
if ($_SESSION["uid"]) {
|
|
|
|
initialize_user_prefs($link, $_SESSION["uid"]);
|
|
|
|
header("Location: $redirect_base/tt-rss.php");
|
2006-03-17 06:00:32 +01:00
|
|
|
exit;
|
2006-03-17 03:55:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-11-18 07:21:24 +01:00
|
|
|
if ($login && $password) {
|
2006-03-04 11:58:25 +01:00
|
|
|
|
|
|
|
if ($_POST["remember_me"]) {
|
|
|
|
session_set_cookie_params(SESSION_COOKIE_LIFETIME_REMEMBER);
|
|
|
|
} else {
|
|
|
|
session_set_cookie_params(SESSION_COOKIE_LIFETIME);
|
|
|
|
}
|
|
|
|
|
2006-03-04 12:03:17 +01:00
|
|
|
require_once "sessions.php";
|
2006-03-04 11:58:25 +01:00
|
|
|
|
2005-11-18 07:21:24 +01:00
|
|
|
if (authenticate_user($link, $login, $password)) {
|
2005-11-18 10:00:18 +01:00
|
|
|
initialize_user_prefs($link, $_SESSION["uid"]);
|
2006-03-20 17:53:11 +01:00
|
|
|
|
|
|
|
if ($_POST["remember_me"]) {
|
|
|
|
$_SESSION["cookie_lifetime"] = time() + SESSION_COOKIE_LIFETIME_REMEMBER;
|
|
|
|
} else {
|
|
|
|
$_SESSION["cookie_lifetime"] = time() + SESSION_COOKIE_LIFETIME;
|
|
|
|
}
|
|
|
|
|
|
|
|
setcookie("ttrss_cltime", $_SESSION["cookie_lifetime"],
|
|
|
|
$_SESSION["cookie_lifetime"]);
|
|
|
|
|
2006-03-17 06:11:45 +01:00
|
|
|
if (!$return_to) {
|
|
|
|
$return_to = "tt-rss.php";
|
2005-11-19 12:31:35 +01:00
|
|
|
}
|
2006-03-17 06:11:45 +01:00
|
|
|
header("Location: $redirect_base/$return_to");
|
2006-03-17 06:02:37 +01:00
|
|
|
exit;
|
2005-11-18 07:21:24 +01:00
|
|
|
}
|
|
|
|
}
|
2005-11-18 03:50:47 +01:00
|
|
|
|
|
|
|
?>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Tiny Tiny RSS : Login</title>
|
|
|
|
<link rel="stylesheet" type="text/css" href="tt-rss.css">
|
|
|
|
<!--[if gte IE 5.5000]>
|
|
|
|
<script type="text/javascript" src="pngfix.js"></script>
|
|
|
|
<![endif]-->
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<table width='100%' height='100%' class="loginForm">
|
|
|
|
|
|
|
|
<tr><td align='center' valign='middle'>
|
2005-11-25 08:28:27 +01:00
|
|
|
|
|
|
|
<form action="login.php" method="POST">
|
2005-11-18 03:50:47 +01:00
|
|
|
|
|
|
|
<table class="innerLoginForm">
|
|
|
|
|
|
|
|
<tr><td valign="middle" align="center" colspan="2">
|
|
|
|
<img src="images/ttrss_logo.png" alt="logo">
|
|
|
|
</td></tr>
|
|
|
|
|
|
|
|
<tr><td align="right">Login:</td>
|
|
|
|
<td><input name="login"></td></tr>
|
|
|
|
<tr><td align="right">Password:</td>
|
|
|
|
<td><input type="password" name="password"></td></tr>
|
2006-03-04 11:58:25 +01:00
|
|
|
<tr><td> </td><td>
|
|
|
|
<input type="checkbox" name="remember_me" id="remember_me">
|
|
|
|
<label for="remember_me">Remember me</label>
|
|
|
|
</td></tr>
|
2005-11-18 07:21:24 +01:00
|
|
|
<tr><td colspan="2" align="center">
|
|
|
|
<input type="submit" class="button" value="Login">
|
2006-03-17 06:11:45 +01:00
|
|
|
<input type="hidden" name="rt" value="<?= $_GET['rt'] ?>">
|
2005-11-18 07:21:24 +01:00
|
|
|
</td></tr>
|
2005-11-18 03:50:47 +01:00
|
|
|
|
2005-11-25 08:28:27 +01:00
|
|
|
</table>
|
|
|
|
|
|
|
|
</form>
|
2005-11-18 03:50:47 +01:00
|
|
|
|
2005-11-25 08:28:27 +01:00
|
|
|
</td></tr>
|
|
|
|
</table>
|
2005-11-18 07:21:24 +01:00
|
|
|
|
|
|
|
<? db_close($link); ?>
|
|
|
|
|
2005-11-18 03:50:47 +01:00
|
|
|
</body>
|
|
|
|
</html>
|