]> git.wh0rd.org - tt-rss.git/blame - login.php
add some basic "did I forget to create config.php" sanity checks
[tt-rss.git] / login.php
CommitLineData
46a1969d
AD
1<?
2 session_start();
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
4585ff0e
AD
9 if (SINGLE_USER_MODE) {
10 header("Location: tt-rss.php");
11 exit;
12 }
13
c8437f35
AD
14 $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
15
16 $login = $_POST["login"];
17 $password = $_POST["password"];
18
19 if ($login && $password) {
20 if (authenticate_user($link, $login, $password)) {
e6cb77a0 21 initialize_user_prefs($link, $_SESSION["uid"]);
f6d0ab14
AD
22
23 if ($_SESSION["login_redirect"]) {
24 $redirect_to = $_SESSION["login_redirect"];
25 } else {
26 $redirect_to = "tt-rss.php";
27 }
28 header("Location: $redirect_to");
c8437f35
AD
29 }
30 }
46a1969d 31
f6d0ab14
AD
32 if ($_GET["rt"]) {
33 $_SESSION["login_redirect"] = $_GET["rt"];
34 }
35
46a1969d
AD
36?>
37<html>
38<head>
39 <title>Tiny Tiny RSS : Login</title>
40 <link rel="stylesheet" type="text/css" href="tt-rss.css">
41 <!--[if gte IE 5.5000]>
42 <script type="text/javascript" src="pngfix.js"></script>
43 <![endif]-->
44 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
45</head>
46
47<body>
48
c8437f35
AD
49<form action="login.php" method="POST">
50
46a1969d
AD
51<table width='100%' height='100%' class="loginForm">
52
53 <tr><td align='center' valign='middle'>
54
55 <table class="innerLoginForm">
56
57 <tr><td valign="middle" align="center" colspan="2">
58 <img src="images/ttrss_logo.png" alt="logo">
59 </td></tr>
60
61 <tr><td align="right">Login:</td>
62 <td><input name="login"></td></tr>
63 <tr><td align="right">Password:</td>
64 <td><input type="password" name="password"></td></tr>
c8437f35
AD
65
66 <tr><td colspan="2" align="center">
67 <input type="submit" class="button" value="Login">
68 </td></tr>
46a1969d
AD
69
70 </table></td></tr>
71</table>
72
c8437f35
AD
73</form>
74
75<? db_close($link); ?>
76
46a1969d
AD
77</body>
78</html>