3 Pitchfork Music Player Daemon Client
4 Copyright (C) 2007 Roger Bystrøm
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; version 2 of the License.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 $no_require_login = "true";
21 require_once("../inc/base.php");
22 if(isset($_POST['password']) && $_POST['password'] != "") {
23 $pass = get_config("login_pass");
24 if(substr($pass,0, 4)=="sha:") {
25 if(check_hash($pass, trim($_POST['password']))) {
26 $_SESSION['logged_in'] = "rw";
27 header("Location: index.php");
30 $error = "Login failed";
32 else if($pass==trim($_POST['password'])) {
33 $_SESSION['logged_in'] = "rw";
34 header("Location: index.php");
38 $pass = get_config("ro_pass");
39 if(substr($pass,0, 4)=="sha:") {
40 if(check_hash($pass, trim($_POST['password']))) {
41 $_SESSION['logged_in'] = "ro";
42 header("Location: index.php");
45 $error = "Login failed";
47 else if($pass==trim($_POST['password'])) {
48 $_SESSION['logged_in'] = "ro";
49 header("Location: index.php");
53 $error = "Login failed";
55 else if(isset($_GET['logout'])) {
57 header("Location: login.php");
63 <title>Pitchfork login</title>
64 <meta name="robots" content="noindex,nofollow" />
65 <style type="text/css">
75 padding: 10px 25px 10px 25px;
78 border: 1px solid #B0BDEC;
79 background-color: #DEE7F7;
82 border: 1px solid #a20000;
83 background-color: #ffcccc;
88 <body onload="document.getElementById('password').focus();">
89 <div class='container'>
90 <h1>Pitchfork login</h1>
93 echo "<p class='error'>$error</p>";
95 if(isset($_SESSION['logged_in'])&&$_SESSION['logged_in']) {
96 echo "<p>Already logged in. <a href='login.php?logout'>Log out?</a></p>\n";
99 <form method="post" action="login.php">
100 Password: <input type='password' id="password" name='password' />
101 <input type='submit' name='submit' value='Log in'/>