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'])) {
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'] = true;
27 header("Location: index.php");
30 $error = "Login failed";
32 else if($pass==trim($_POST['password'])) {
33 $_SESSION['logged_in'] = true;
34 header("Location: index.php");
38 $error = "Login failed";
41 else if(isset($_GET['logout'])) {
43 header("Location: login.php");
49 <title>Pitchfork login</title>
50 <meta name="robots" content="noindex,nofollow" />
51 <style type="text/css">
61 padding: 10px 25px 10px 25px;
64 border: 1px solid #B0BDEC;
65 background-color: #DEE7F7;
68 border: 1px solid #a20000;
69 background-color: #ffcccc;
74 <body onload="document.getElementById('password').focus();">
75 <div class='container'>
76 <h1>Pitchfork login</h1>
79 echo "<p class='error'>$error</p>";
81 if(isset($_SESSION['logged_in'])&&$_SESSION['logged_in']) {
82 echo "<p>Already logged in. <a href='login.php?logout'>Log out?</a></p>\n";
85 <form method="post" action="login.php">
86 Password: <input type='password' id="password" name='password' />
87 <input type='submit' name='submit' value='Log in'/>