Hello, I have found a nice login script but it only has the login part.
I need someone to finish coding it so I can have little button that says "Logout" and when they click it it redirects them tot he login page...
Here:
Index+
Code:
<?php require_once("maxProtector.class.php"); ?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<title>
Administrator Control Panel
</title>
<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
</head>
<body>
TEST
</body>
</html>
maxProtector.class.php
Code:
<?php
/*************************************************
* Buckets Administrators Control Panel Configuration
* Contact - MSN - Sith717@Hotmail.com
* Version: 1.0
* COPYIGHT BUCKET INC.
*
****************************************************/
class maxProtector{
var $password = 'aircombat1';
function showLoginForm(){
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Login To Continue...</title>
<link href="style/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="container">
<div id="header"><div id="header_left"></div>
<div id="header_main">Login To Continue...</div><div id="header_right"></div></div>
<div id="content">
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<center>
<label>Password:
<input name="passwd" type="password" size="20" />
</label><br/>
<label>
<input type="submit" name="submitBtn" class="sbtn" value="Login" /><input type="reset" name="submitBtn" class="sbtn" value="Login" />
</label>
</center>
</form>
</div>
<div id="footer"><a href="http://www.phpf1.com" target="_blank">Copyright Bucket Inc. 2008</a></div>
</div>
</body>
<?php
}
function login(){
$loggedin = isset($_SESSION['loggedin']) ? $_SESSION['loggedin'] : false;
if ( (!isset($_POST['submitBtn'])) && (!($loggedin))){
$_SESSION['loggedin'] = false;
$this->showLoginForm();
exit();
} else if (isset($_POST['submitBtn'])) {
$pass = isset($_POST['passwd']) ? $_POST['passwd'] : '';
if ($pass != $this->password) {
$_SESSION['loggedin'] = false;
$this->showLoginForm();
exit();
} else {
$_SESSION['loggedin'] = true;
}
}
}
}
// Auto create
session_start();
$protector = new maxProtector();
$protector->login();
?>
I need to make a logout button.
Thanks. I will also pay if it needs alot of work!