]>
Commit | Line | Data |
---|---|---|
46a1969d | 1 | <? |
5ccc1cf5 | 2 | // require_once "sessions.php"; |
46a1969d | 3 | |
66581886 | 4 | require_once "sanity_check.php"; |
46a1969d AD |
5 | require_once "version.php"; |
6 | require_once "config.php"; | |
c8437f35 | 7 | require_once "functions.php"; |
46a1969d | 8 | |
75836f33 AD |
9 | $url_path = get_script_urlpath(); |
10 | $redirect_base = "http://" . $_SERVER["SERVER_NAME"] . $url_path; | |
11 | ||
4585ff0e | 12 | if (SINGLE_USER_MODE) { |
75836f33 | 13 | header("Location: $redirect_base/tt-rss.php"); |
4585ff0e AD |
14 | exit; |
15 | } | |
16 | ||
c8437f35 AD |
17 | $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); |
18 | ||
19 | $login = $_POST["login"]; | |
20 | $password = $_POST["password"]; | |
1f0d3e07 | 21 | $return_to = $_POST["rt"]; |
c8437f35 | 22 | |
3dd46f19 | 23 | if ($_COOKIE[get_session_cookie_name()]) { |
a5ebd1f9 AD |
24 | require_once "sessions.php"; |
25 | if ($_SESSION["uid"]) { | |
26 | initialize_user_prefs($link, $_SESSION["uid"]); | |
27 | header("Location: $redirect_base/tt-rss.php"); | |
8858b67b | 28 | exit; |
a5ebd1f9 AD |
29 | } |
30 | } | |
31 | ||
c8437f35 | 32 | if ($login && $password) { |
5ccc1cf5 AD |
33 | |
34 | if ($_POST["remember_me"]) { | |
35 | session_set_cookie_params(SESSION_COOKIE_LIFETIME_REMEMBER); | |
36 | } else { | |
37 | session_set_cookie_params(SESSION_COOKIE_LIFETIME); | |
38 | } | |
39 | ||
8c453eac | 40 | require_once "sessions.php"; |
5ccc1cf5 | 41 | |
c8437f35 | 42 | if (authenticate_user($link, $login, $password)) { |
e6cb77a0 | 43 | initialize_user_prefs($link, $_SESSION["uid"]); |
76b4eae1 AD |
44 | |
45 | if ($_POST["remember_me"]) { | |
46 | $_SESSION["cookie_lifetime"] = time() + SESSION_COOKIE_LIFETIME_REMEMBER; | |
47 | } else { | |
48 | $_SESSION["cookie_lifetime"] = time() + SESSION_COOKIE_LIFETIME; | |
49 | } | |
50 | ||
51 | setcookie("ttrss_cltime", $_SESSION["cookie_lifetime"], | |
52 | $_SESSION["cookie_lifetime"]); | |
53 | ||
1f0d3e07 AD |
54 | if (!$return_to) { |
55 | $return_to = "tt-rss.php"; | |
f6d0ab14 | 56 | } |
1f0d3e07 | 57 | header("Location: $redirect_base/$return_to"); |
ab9ecc04 | 58 | exit; |
c8437f35 AD |
59 | } |
60 | } | |
46a1969d AD |
61 | |
62 | ?> | |
63 | <html> | |
64 | <head> | |
65 | <title>Tiny Tiny RSS : Login</title> | |
66 | <link rel="stylesheet" type="text/css" href="tt-rss.css"> | |
67 | <!--[if gte IE 5.5000]> | |
68 | <script type="text/javascript" src="pngfix.js"></script> | |
69 | <![endif]--> | |
70 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
71 | </head> | |
72 | ||
73 | <body> | |
74 | ||
75 | <table width='100%' height='100%' class="loginForm"> | |
76 | ||
77 | <tr><td align='center' valign='middle'> | |
747976de AD |
78 | |
79 | <form action="login.php" method="POST"> | |
46a1969d AD |
80 | |
81 | <table class="innerLoginForm"> | |
82 | ||
83 | <tr><td valign="middle" align="center" colspan="2"> | |
84 | <img src="images/ttrss_logo.png" alt="logo"> | |
85 | </td></tr> | |
86 | ||
87 | <tr><td align="right">Login:</td> | |
88 | <td><input name="login"></td></tr> | |
89 | <tr><td align="right">Password:</td> | |
90 | <td><input type="password" name="password"></td></tr> | |
5ccc1cf5 AD |
91 | <tr><td> </td><td> |
92 | <input type="checkbox" name="remember_me" id="remember_me"> | |
93 | <label for="remember_me">Remember me</label> | |
94 | </td></tr> | |
c8437f35 AD |
95 | <tr><td colspan="2" align="center"> |
96 | <input type="submit" class="button" value="Login"> | |
1f0d3e07 | 97 | <input type="hidden" name="rt" value="<?= $_GET['rt'] ?>"> |
c8437f35 | 98 | </td></tr> |
46a1969d | 99 | |
747976de AD |
100 | </table> |
101 | ||
102 | </form> | |
46a1969d | 103 | |
747976de AD |
104 | </td></tr> |
105 | </table> | |
c8437f35 AD |
106 | |
107 | <? db_close($link); ?> | |
108 | ||
46a1969d AD |
109 | </body> |
110 | </html> |