Skip to content
Find file
6cc9e4a Dec 10, 2010
41 lines (37 sloc) 1.75 KB
<?PHP
require 'includes/master.inc.php';
if($Auth->loggedIn()) redirect(WEB_ROOT);
if(!empty($_POST['username']))
{
if($Auth->login($_POST['username'], $_POST['password']))
{
if(isset($_REQUEST['r']) && strlen($_REQUEST['r']) > 0)
redirect($_REQUEST['r']);
else
redirect(WEB_ROOT);
}
else
$Error->add('username', "We're sorry, you have entered an incorrect username and password. Please try again.");
}
// Clean the submitted username before redisplaying it.
$username = isset($_POST['username']) ? htmlspecialchars($_POST['username']) : '';
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Sample Login Page</title>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.5.2/build/reset-fonts-grids/reset-fonts-grids.css">
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.5.2/build/base/base-min.css">
</head>
<body>
<form action="<?PHP echo $_SERVER['PHP_SELF']; ?>" method="post">
<?PHP echo $Error; ?>
<p><label for="username">Username:</label> <input type="text" name="username" value="<?PHP echo $username;?>" id="username" /></p>
<p><label for="password">Password:</label> <input type="password" name="password" value="" id="password" /></p>
<p><input type="submit" name="btnlogin" value="Login" id="btnlogin" /></p>
<input type="hidden" name="r" value="<?PHP echo htmlspecialchars(@$_REQUEST['r']); ?>" id="r">
</form>
</body>
</html>
Something went wrong with that request. Please try again.