Location: PHPKode > projects > iBWd News > news/admin/access.php
<?

/*###############################################################*\
##                       iBWd News 1.1b                          ##
##                 http://bramstart.be/ibwds                     ##
##                                                               ##
*/###############################################################*\

// access control!

session_start();

if(!isset($uid)){
	?>
<html>

<head>
<title>Add new users</title>
<style>
<?=$style?>
</style>
</head>

<body>


<center>
<form method="post" action="<?=$PHP_SELF?>">
<table border="0" cellspacing="1" cellpadding="3" class="table_border">
<tr>
<td class="header_cell" colspan="2">Please login </td>
</tr>
<tr>
<td class="cells" colspan="2">
You must log in to access this area of the site.<br>
Please login:</td>
</tr>
<tr>
<td class="cells">
Login:</td>
<td class="cells">
<input class="box" type="text" name="uid" size="20">
</td>
</tr>
<tr>
<td class="cells">
Password:</td>
<td class="cells">
<input class="box" type="password" name="pwd" size="20">
</td>
</tr>
<tr>
<td class="cells" colspan="2">
<p align="center"><input type="submit" value="Log in">
</td>
</tr>
</table>
</form>
</center>
</body>
</html>
	<? exit; }

session_register("uid");
session_register("pwd");

$query = "SELECT * FROM $table_users WHERE password = PASSWORD('$pwd') AND name = '$uid'";
$result  = mysql_query($query);
if(!$result){
	error("Database error while checking your Login details.");
}

if(mysql_num_rows($result) == 0){
	session_unregister("uid");
	session_unregister("pwd");
	?>
		<html>

<head>
<title>Add new users</title>
<style>
<?=$style?>
</style>
</head>

<body>


<center>
<table border="0" cellspacing="1" cellpadding="3" class="table_border">
<tr>
<td class="header_cell">
<p align="center"><font color="#FF0000">ACCESS&nbsp; DENIED</font></p>
 </td>
</tr>
<tr>
<td class="cells">
<p align="center">Your user ID or password is incorrect, or you are not a<br>
registered user on this section of this site.</p>
</td>
</tr>
</table>
</center>
</body>
</html>
	<? exit; }

$username = mysql_result($result,0,"name");

$result = mysql_query("SELECT * FROM $table_users WHERE name = '$uid'");
list($ID, $password, $name, $addpost, $modpost, $delpost, $status) = mysql_fetch_row($result);
session_register(status);


if($action == "logout"){
	session_unregister(uid);
	session_unregister(pwd);
	session_unregister(status);
	echo"<html><head><style>$style</style></head><body>";
	echo"<center><br>Logged out!</center>";
	echo"</body>";
	exit;
}
?>
Return current item: iBWd News