]>
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"]; | |
21 | ||
22 | if ($login && $password) { | |
5ccc1cf5 AD |
23 | |
24 | if ($_POST["remember_me"]) { | |
25 | session_set_cookie_params(SESSION_COOKIE_LIFETIME_REMEMBER); | |
26 | } else { | |
27 | session_set_cookie_params(SESSION_COOKIE_LIFETIME); | |
28 | } | |
29 | ||
8c453eac | 30 | require_once "sessions.php"; |
5ccc1cf5 | 31 | |
c8437f35 | 32 | if (authenticate_user($link, $login, $password)) { |
e6cb77a0 | 33 | initialize_user_prefs($link, $_SESSION["uid"]); |
f6d0ab14 AD |
34 | |
35 | if ($_SESSION["login_redirect"]) { | |
36 | $redirect_to = $_SESSION["login_redirect"]; | |
37 | } else { | |
38 | $redirect_to = "tt-rss.php"; | |
39 | } | |
75836f33 | 40 | header("Location: $redirect_base/$redirect_to"); |
c8437f35 AD |
41 | } |
42 | } | |
46a1969d | 43 | |
f6d0ab14 AD |
44 | if ($_GET["rt"]) { |
45 | $_SESSION["login_redirect"] = $_GET["rt"]; | |
46 | } | |
47 | ||
46a1969d AD |
48 | ?> |
49 | <html> | |
50 | <head> | |
51 | <title>Tiny Tiny RSS : Login</title> | |
52 | <link rel="stylesheet" type="text/css" href="tt-rss.css"> | |
53 | <!--[if gte IE 5.5000]> | |
54 | <script type="text/javascript" src="pngfix.js"></script> | |
55 | <![endif]--> | |
56 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
57 | </head> | |
58 | ||
59 | <body> | |
60 | ||
61 | <table width='100%' height='100%' class="loginForm"> | |
62 | ||
63 | <tr><td align='center' valign='middle'> | |
747976de AD |
64 | |
65 | <form action="login.php" method="POST"> | |
46a1969d AD |
66 | |
67 | <table class="innerLoginForm"> | |
68 | ||
69 | <tr><td valign="middle" align="center" colspan="2"> | |
70 | <img src="images/ttrss_logo.png" alt="logo"> | |
71 | </td></tr> | |
72 | ||
73 | <tr><td align="right">Login:</td> | |
74 | <td><input name="login"></td></tr> | |
75 | <tr><td align="right">Password:</td> | |
76 | <td><input type="password" name="password"></td></tr> | |
5ccc1cf5 AD |
77 | <tr><td> </td><td> |
78 | <input type="checkbox" name="remember_me" id="remember_me"> | |
79 | <label for="remember_me">Remember me</label> | |
80 | </td></tr> | |
c8437f35 AD |
81 | <tr><td colspan="2" align="center"> |
82 | <input type="submit" class="button" value="Login"> | |
83 | </td></tr> | |
46a1969d | 84 | |
747976de AD |
85 | </table> |
86 | ||
87 | </form> | |
46a1969d | 88 | |
747976de AD |
89 | </td></tr> |
90 | </table> | |
c8437f35 AD |
91 | |
92 | <? db_close($link); ?> | |
93 | ||
46a1969d AD |
94 | </body> |
95 | </html> |