<?php
/****************************************
*@Author: Balaji J H
*@Version: 1.00
*@Package Name: Simple Login Class
*@HomePage: http://jhbalaji.com
*@EMail: hide@address.com / hide@address.com
*@Developed For: BloggerPoster.com
*@Copyright: Balaji J H,BloggerPoster.com
*@License: Free For Personal & Commerical Username but Header and Copyright information must stay intact!
*****************************************/
require_once('class.secure-jh.php');
$error = '0';
if (isset($_POST['submitBtn'])){
// Get user input
$username = isset($_POST['username']) ? $_POST['username'] : '';
$password = isset($_POST['password']) ? $_POST['password'] : '';
// Try to login the user
$jh = new loginjh();
$error = $jh->loginUser($username,$password);
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>Simple PHP Login</title>
<meta http-equiv="Pragma" content="no-cache"> <!-- Important for security -->
<meta http-equiv="Expires" content="-1">
<meta name="robots" content="index,follow">
<meta name="author" content="Balaji J H">
<meta name="email" content="hide@address.com">
<meta name="copyright" content="Balaji J H">
<meta name="Charset" content="UTF-8">
<meta name="Distribution" content="Global">
<meta name="Rating" content="General">
<meta name="Robots" content="INDEX,FOLLOW">
<meta name="Revisit-after" content="1 Day">
<link rel="stylesheet" href="stylesheet.css"> <!-- Main Stylesheet -->
</head>
<body>
<div id="header">
<div id="title"><a href="index.php">
<h1>Simple PHP Login</h1></a></div>
<div id="login"><a
href="login.php">Login</a></div>
</div>
<?php if ($error != '') {?>
<div id="main">
<h2>Login</h2>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<label>Username</label><input name="username" size="20" type="text">
<br>
<label>Password</label><input name="password" size="20" type="password">
<br>
<input value="Login" name="submitBtn" type="submit">
</form>
<p>Not registered yet? It's quick & easy to do so
<a href="register.php">here</a></p>
</div>
<?php
}
if (isset($_POST['submitBtn'])){
?>
<div id="main">
<h2>Login Status</h2>
<?php
if ($error == '') {
echo "<h3>Welcome Admin, $username! <br/>You are now logged in!<br/><br/>";
echo '<a href="index.php">Now you can now visit the Password Protected Page!</a></h3>';
}
else echo '<h3>'.$error.'</h3>';
?>
</div>
<?php
}
?>
<div id="footer">
Created by <a href="http://www.jhbalaji.com/" target="_blank">Balaji</a></div>
</body></html>