<?php
/*
* $Id: serve-login.php 16 2008-09-04 21:45:49Z stuart $
*
* Serve
* http://stuconnolly.com/projects/serve/
*
* Copyright (c) 2008 Stuart Connolly. All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
require_once('serve-includes/serve-db.php');
require_once('serve-admin/login-functions.php');
require_once('serve-includes/page-template.php');
$url = siteinfo('url');
if (isset($_GET['action']))
{
switch ($_GET['action'])
{
case 'login':
login($_POST['username'], $_POST['password']);
break;
case 'accessdenied':
$show_message = 1;
break;
case 'logout':
logout();
break;
case 'retrievepassword':
retrieve_password_email($servedb->get_var("SELECT ID FROM serve_users WHERE user_name = '" . $_POST['username'] . "'"));
break;
}
}
check_session();
header('Content-Type: text/html; charset=UTF-8');
echo('<?xml version="1.0" encoding="UTF-8" ?>'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en:GB">
<head>
<meta name="developer" content="Stuart Connolly" />
<meta name="generator" content="Serve <?php echo siteinfo('version'); ?>" />
<title>
<?php if (isset($_GET['lostpassword'])) echo 'Lost Password'; else echo 'Serve Login'; ?></title>
<style type="text/css" media="screen">
<!--
* {
margin: 0;
padding: 0;
}
body {
background-color: #EEEEEE;
color: #666666;
text-align: center;
}
#bodycontainer {
text-align: center;
font-family: Verdana, Arial, Helvetica, sans-serif;
line-height: 1.6em;
font-size: 11px;
padding-top: 20px;
width: 425px;
margin: 0 auto;
background-color: #EEEEEE;
}
a {
outline: none;
}
a:link {
color: #40659B;
text-decoration: none;
border-bottom: 1px dotted #bbb;
}
a:visited {
color: #8EA4C2;
text-decoration: none;
border-bottom: 1px dotted #bbb;
}
a:hover, a:active {
color: #036;
border-bottom-style: solid;
}
#container {
margin: 15px;
padding: 5%;
border: 1px solid #D4D4D4;
background-color: #FFFFFF;
}
#logincontainer {
text-align: center;
padding: 8px 0 8px 0;
margin: 5px;
border: 1px solid #ECECEC;
}
#login #username, #login #password {
width: 150px;
color: #999999;
font-size: 12px;
border: 1px solid #CFCFCF;
font-family: Verdana, Sans-serif;
}
#login #username:focus, #login #password:focus {
color: #666666;
border: 1px solid #BABABA;
}
#login #username {
margin-left: 10px;
}
#login #password {
margin-left: 13px;
}
#login label {
text-transform: lowercase;
cursor: pointer;
}
#login label span {
font-weight: bold;
font-style: italic;
}
#denied {
text-align: center;
font-size: 10px;
}
#login #submit {
text-align: right;
}
#login #logmein {
width: 80px;
color: #666666;
font-size: 11px;
margin: 5px 5px 0 63px;
font-family: Verdana, Sans-serif;
}
#login #retrievepassword {
width: 130px;
margin: 5px 5px 0 100px;
}
#login #rememberme {
margin: 0 5px 0 18px;
}
#login #links {
margin: 0 0 0 5px;
}
p {
margin: 1em 0;
}
-->
</style>
</head>
<body>
<div id="bodycontainer">
<div id="container">
<?php if (isset($_GET['lostpassword'])) : ?>
<form method="post" action="<?php echo $url; ?>serve-login.php?action=retrievepassword" id="login">
<p>Please enter your username and a new password will be emailed to you.</p>
<div id="logincontainer">
<p><label for="username">User<span>name</span></label><input type="text" id="username" name="username" /></p>
</div>
<p><span id="links"><a href="<?php echo $url; ?>">← View site</a> | <a href="<?php echo $url; ?>serve-login.php">Login</a></span><input type="submit" name="retrievepassword" id="retrievepassword" value="Retrieve Password" /></p>
</form>
<?php else :
if ($show_message) : ?><p><strong>Access denied:</strong> Incorrect login details.</p><?php endif; ?>
<form method="post" action="<?php echo $url; ?>serve-login.php?action=login" id="login">
<div id="logincontainer">
<p><label for="username">User<span>name</span></label><input type="text" id="username" name="username" /></p>
<p><label for="password"><span>Pass</span>word</label><input type="password" id="password" name="password" /></p>
<p><input type="checkbox" name="rememberme" id="rememberme" /><label for="rememberme">Remember me</label></p>
</div>
<p><span id="links"><a href="<?php echo $url; ?>">← View site</a> | <a href="<?php echo $url; ?>serve-login.php?lostpassword=true">Lost your password?</a></span><input type="submit" name="logmein" id="logmein" value="Login" /></p>
</form>
<?php endif; ?>
</div>
</div>
</body>
</html>