Skip to content

Instantly share code, notes, and snippets.

@tylerhall
Created October 18, 2010 21:41
Show Gist options
  • Save tylerhall/633125 to your computer and use it in GitHub Desktop.
Save tylerhall/633125 to your computer and use it in GitHub Desktop.
<?PHP
require 'includes/master.inc.php';
if($Auth->loggedIn()) redirect('index.php');
if(!empty($_POST['username']))
{
if($Auth->login($_POST['username'], $_POST['password']))
redirect('index.php');
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>Shine - An Open Source Dashboard for Mac Developers</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">
<link rel="stylesheet" href="styles/screen.css" type="text/css" media="screen" title="Screen" charset="utf-8" />
</head>
<body>
<h1>Welcome to Shine</h1>
<div id="main">
<form action="/login/" 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>
</form>
</div>
</body>
</html>
<?PHP
// You can manually insert a user into your database via:
$new_user = Auth::createNewUser('username', 'password');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment