]> git.wh0rd.org - tt-rss.git/blame - login.php
fix ?rt= handling in login.php
[tt-rss.git] / login.php
CommitLineData
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
a5ebd1f9
AD
23 if ($_COOKIE["ttrss_sid"]) {
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"]);
f6d0ab14 44
1f0d3e07
AD
45 if (!$return_to) {
46 $return_to = "tt-rss.php";
f6d0ab14 47 }
1f0d3e07 48 header("Location: $redirect_base/$return_to");
ab9ecc04 49 exit;
c8437f35
AD
50 }
51 }
46a1969d
AD
52
53?>
54<html>
55<head>
56 <title>Tiny Tiny RSS : Login</title>
57 <link rel="stylesheet" type="text/css" href="tt-rss.css">
58 <!--[if gte IE 5.5000]>
59 <script type="text/javascript" src="pngfix.js"></script>
60 <![endif]-->
61 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
62</head>
63
64<body>
65
66<table width='100%' height='100%' class="loginForm">
67
68 <tr><td align='center' valign='middle'>
747976de
AD
69
70 <form action="login.php" method="POST">
46a1969d
AD
71
72 <table class="innerLoginForm">
73
74 <tr><td valign="middle" align="center" colspan="2">
75 <img src="images/ttrss_logo.png" alt="logo">
76 </td></tr>
77
78 <tr><td align="right">Login:</td>
79 <td><input name="login"></td></tr>
80 <tr><td align="right">Password:</td>
81 <td><input type="password" name="password"></td></tr>
5ccc1cf5
AD
82 <tr><td>&nbsp;</td><td>
83 <input type="checkbox" name="remember_me" id="remember_me">
84 <label for="remember_me">Remember me</label>
85 </td></tr>
c8437f35
AD
86 <tr><td colspan="2" align="center">
87 <input type="submit" class="button" value="Login">
1f0d3e07 88 <input type="hidden" name="rt" value="<?= $_GET['rt'] ?>">
c8437f35 89 </td></tr>
46a1969d 90
747976de
AD
91 </table>
92
93 </form>
46a1969d 94
747976de
AD
95 </td></tr>
96</table>
c8437f35
AD
97
98<? db_close($link); ?>
99
46a1969d
AD
100</body>
101</html>