2006-08-19 07:04:45 +00:00
|
|
|
<?php
|
2006-03-04 10:58:25 +00:00
|
|
|
// require_once "sessions.php";
|
2005-11-18 02:50:47 +00:00
|
|
|
|
2005-11-23 17:20:17 +00:00
|
|
|
require_once "sanity_check.php";
|
2005-11-18 02:50:47 +00:00
|
|
|
require_once "version.php";
|
|
|
|
require_once "config.php";
|
2005-11-18 06:21:24 +00:00
|
|
|
require_once "functions.php";
|
2005-11-18 02:50:47 +00:00
|
|
|
|
2006-08-19 06:42:53 +00:00
|
|
|
$error_msg = "";
|
|
|
|
|
2005-12-09 20:34:29 +00:00
|
|
|
$url_path = get_script_urlpath();
|
2006-11-09 10:00:24 +00:00
|
|
|
$return_to = $_REQUEST["rt"];
|
2006-06-14 07:24:15 +00:00
|
|
|
|
|
|
|
if (ENABLE_LOGIN_SSL) {
|
|
|
|
$redirect_base = "https://" . $_SERVER["SERVER_NAME"] . $url_path;
|
|
|
|
} else {
|
|
|
|
$redirect_base = "http://" . $_SERVER["SERVER_NAME"] . $url_path;
|
|
|
|
}
|
2005-12-09 20:34:29 +00:00
|
|
|
|
2006-11-09 10:00:24 +00:00
|
|
|
if (SINGLE_USER_MODE && $return_to != "none") {
|
2005-12-09 20:34:29 +00:00
|
|
|
header("Location: $redirect_base/tt-rss.php");
|
2005-11-21 04:25:48 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2005-11-18 06:21:24 +00:00
|
|
|
$link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
|
|
|
|
|
|
|
|
$login = $_POST["login"];
|
|
|
|
$password = $_POST["password"];
|
2006-08-19 07:04:45 +00:00
|
|
|
$action = $_POST["action"];
|
2005-11-18 06:21:24 +00:00
|
|
|
|
2006-11-09 10:00:24 +00:00
|
|
|
if ($_COOKIE[get_session_cookie_name()] && $return_to != "none") {
|
2006-03-17 02:55:38 +00:00
|
|
|
require_once "sessions.php";
|
|
|
|
if ($_SESSION["uid"]) {
|
|
|
|
initialize_user_prefs($link, $_SESSION["uid"]);
|
|
|
|
header("Location: $redirect_base/tt-rss.php");
|
2006-03-17 05:00:32 +00:00
|
|
|
exit;
|
2006-03-17 02:55:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-11-18 06:21:24 +00:00
|
|
|
if ($login && $password) {
|
2006-03-04 10:58:25 +00:00
|
|
|
|
|
|
|
if ($_POST["remember_me"]) {
|
|
|
|
session_set_cookie_params(SESSION_COOKIE_LIFETIME_REMEMBER);
|
|
|
|
} else {
|
|
|
|
session_set_cookie_params(SESSION_COOKIE_LIFETIME);
|
|
|
|
}
|
|
|
|
|
2006-03-04 11:03:17 +00:00
|
|
|
require_once "sessions.php";
|
2006-03-04 10:58:25 +00:00
|
|
|
|
2005-11-18 06:21:24 +00:00
|
|
|
if (authenticate_user($link, $login, $password)) {
|
2005-11-18 09:00:18 +00:00
|
|
|
initialize_user_prefs($link, $_SESSION["uid"]);
|
2006-03-20 16:53:11 +00: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 05:11:45 +00:00
|
|
|
if (!$return_to) {
|
|
|
|
$return_to = "tt-rss.php";
|
2005-11-19 11:31:35 +00:00
|
|
|
}
|
2006-03-17 05:11:45 +00:00
|
|
|
header("Location: $redirect_base/$return_to");
|
2006-03-17 05:02:37 +00:00
|
|
|
exit;
|
2006-08-19 06:42:53 +00:00
|
|
|
} else {
|
|
|
|
$error_msg = "Error: Unable to authenticate user. Please check login and password.";
|
2005-11-18 06:21:24 +00:00
|
|
|
}
|
2006-08-19 07:04:45 +00:00
|
|
|
} else if ($action) {
|
2006-08-19 06:42:53 +00:00
|
|
|
$error_msg = "Error: Either login or password is blank.";
|
2005-11-18 06:21:24 +00:00
|
|
|
}
|
2005-11-18 02:50:47 +00:00
|
|
|
|
|
|
|
?>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Tiny Tiny RSS : Login</title>
|
|
|
|
<link rel="stylesheet" type="text/css" href="tt-rss.css">
|
2006-09-11 06:50:52 +00:00
|
|
|
<link rel="shortcut icon" type="image/png" href="images/favicon.png">
|
2005-11-18 02:50:47 +00:00
|
|
|
<!--[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>
|
|
|
|
|
2006-06-14 07:32:10 +00:00
|
|
|
<script type="text/javascript">
|
|
|
|
function init() {
|
|
|
|
|
|
|
|
if (arguments.callee.done) return;
|
|
|
|
arguments.callee.done = true;
|
|
|
|
|
|
|
|
var login = document.forms["loginForm"].login;
|
|
|
|
|
|
|
|
login.focus();
|
|
|
|
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
if (document.addEventListener) {
|
|
|
|
document.addEventListener("DOMContentLoaded", init, null);
|
|
|
|
}
|
|
|
|
window.onload = init;
|
|
|
|
</script>
|
|
|
|
|
2006-08-19 06:42:53 +00:00
|
|
|
<form action="login.php" method="POST" name="loginForm">
|
|
|
|
|
|
|
|
<table width="100%" class="loginForm2">
|
|
|
|
<tr>
|
|
|
|
<td class="loginTop" valign="bottom" align="left">
|
|
|
|
<img src="images/ttrss_logo_big.png" alt="Logo">
|
|
|
|
</td>
|
|
|
|
</tr><tr>
|
|
|
|
<td align="center" valign="middle" class="loginMiddle" height="100%">
|
2006-08-19 07:04:45 +00:00
|
|
|
<?php if ($error_msg) { ?>
|
|
|
|
<div class="loginError"><?php echo $error_msg ?></div>
|
|
|
|
<?php } ?>
|
2006-08-19 06:42:53 +00:00
|
|
|
<table>
|
|
|
|
<tr><td align="right">Login:</td>
|
2006-08-19 07:14:46 +00:00
|
|
|
<td align="right"><input name="login"></td></tr>
|
2006-08-19 06:42:53 +00:00
|
|
|
<tr><td align="right">Password:</td>
|
2006-08-19 07:14:46 +00:00
|
|
|
<td align="right"><input type="password" name="password"></td></tr>
|
2006-08-19 06:42:53 +00:00
|
|
|
<tr><td colspan="2">
|
|
|
|
<input type="checkbox" name="remember_me" id="remember_me">
|
|
|
|
<label for="remember_me">Remember me on this computer</label>
|
|
|
|
</td></tr>
|
2006-08-19 07:14:46 +00:00
|
|
|
<tr><td colspan="2" align="right" class="innerLoginCell">
|
2006-08-19 06:42:53 +00:00
|
|
|
<input type="submit" class="button" value="Login">
|
2006-08-19 07:04:45 +00:00
|
|
|
<input type="hidden" name="action" value="login">
|
2006-11-09 10:00:24 +00:00
|
|
|
<input type="hidden" name="rt"
|
|
|
|
value="<?php if ($return_to != 'none') { echo $return_to; } ?>">
|
2006-08-19 06:42:53 +00:00
|
|
|
</td></tr>
|
|
|
|
</table>
|
|
|
|
</td>
|
|
|
|
</tr><tr>
|
|
|
|
<td align="center" class="loginBottom">
|
2007-01-22 07:35:57 +00:00
|
|
|
<a href="http://tt-rss.spb.ru/">Tiny Tiny RSS</a> © 2005-2007 Andrew Dolgov
|
2006-08-19 07:04:45 +00:00
|
|
|
<?php if (WEB_DEMO_MODE) { ?>
|
2006-08-19 06:42:53 +00:00
|
|
|
<br>Running in demo mode, some functionality is disabled.
|
2006-08-19 07:04:45 +00:00
|
|
|
<?php } ?>
|
2006-08-19 06:42:53 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
2005-11-25 07:28:27 +00:00
|
|
|
</table>
|
2005-11-18 06:21:24 +00:00
|
|
|
|
2006-08-19 06:42:53 +00:00
|
|
|
</form>
|
|
|
|
|
2006-08-19 07:04:45 +00:00
|
|
|
<?php db_close($link); ?>
|
2005-11-18 06:21:24 +00:00
|
|
|
|
2006-06-14 07:32:10 +00:00
|
|
|
<script type="text/javascript">
|
|
|
|
/* for IE */
|
|
|
|
function statechange() {
|
|
|
|
if (document.readyState == "interactive") init();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (document.readyState) {
|
|
|
|
if (document.readyState == "interactive" || document.readyState == "complete") {
|
|
|
|
init();
|
|
|
|
} else {
|
|
|
|
document.onreadystatechange = statechange;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2005-11-18 02:50:47 +00:00
|
|
|
</body>
|
|
|
|
</html>
|