summaryrefslogtreecommitdiff
path: root/mobile/login.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2006-03-27 03:47:07 +0100
committerAndrew Dolgov <[email protected]>2006-03-27 03:47:07 +0100
commit0d3adafe15b21dde08c89fea8f016d31662fedf9 (patch)
tree62bd38147493ca82d093acb288e27ba0910c874e /mobile/login.php
parentca35939d207237fb3cf3f8f63fb888d62280f24c (diff)
more mobile work (add missing files)
Diffstat (limited to 'mobile/login.php')
-rw-r--r--mobile/login.php93
1 files changed, 93 insertions, 0 deletions
diff --git a/mobile/login.php b/mobile/login.php
new file mode 100644
index 000000000..0e2d0c8b4
--- /dev/null
+++ b/mobile/login.php
@@ -0,0 +1,93 @@
+<?
+// require_once "sessions.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"];
+ $return_to = $_POST["rt"];
+
+ if ($_COOKIE["ttrss_sid"]) {
+ 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;
+ }
+
+ setcookie("ttrss_cltime", $_SESSION["cookie_lifetime"],
+ $_SESSION["cookie_lifetime"]);
+
+ if (!$return_to) {
+ $return_to = "tt-rss.php";
+ }
+ header("Location: $redirect_base/$return_to");
+ exit;
+ }
+ }
+
+?>
+<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>
+
+ <div class="main">
+
+ <h1>Tiny Tiny RSS</h1>
+
+ <form action="login.php" method="POST">
+
+ Login: <input name="login"><br>
+ Password: <input type="password" name="password"><br>
+
+ <input type="checkbox" name="remember_me" id="remember_me">
+ <label for="remember_me">Remember me</label><br>
+
+ <input type="submit" class="button" value="Login">
+ <input type="hidden" name="rt" value="<?= $_GET['rt'] ?>">
+
+ </form>
+
+ </div>
+</body>
+</html>
+
+<? db_close($link); ?>
+