Right i have the following code, however it doesnt seem to work the way i want it to, it says access level too low for members which should have access, can ne 1 help me and tell me whats wrong?
<?php // accesscontrol.php
session_start();
include("common.php");
include("db.php");
if(!isset($ircnick)) {
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
a {
color: #000000;
}
-->
</style>
<link href="abattoir.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#000000">
<table width="75%" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="main.gif" width="700" height="100"></td>
</tr>
<tr>
<td height="161">
<center>
<h1><font color="#FFFFFF"> Login Required </font></h1>
<p><font color="#FFFFFF">You must log in to access this area of the site. If you are
not a registered user, <a href="signup.php">click here</a>
to sign up for instant access!</font></p>
<p><form method="post" action="<?=$PHP_SELF?>">
<font color="#FFFFFF"> IRC Nick:</font> <input type="text" name="ircnick" size="8"><br>
<font color="#FFFFFF"> Password:</font> <input type="password" name="userpassword" SIZE="8"><br>
<input type="submit" value="Log in">
</form></p>
</td>
</tr>
<tr>
<td><div align="center"><font color="#FFFFFF">© Abattoir Alliance 2003</font></div></td>
</tr>
</table>
</center>
</body>
</html>
<?php
exit;
}
session_register("ircnick");
session_register("userpassword");
dbConnect("ollyculv_xmb1");
$sql = "SELECT * FROM members WHERE
ircnick = '$ircnick' AND password = PASSWORD('$userpassword')";
$result = mysql_query($sql);
if (!$result) {
error("A database error occurred while checking your ".
"login details.\\nIf this error persists, please ".
"contact [email]olly@ollyculverhouse.co.uk[/email].");
}
if (mysql_num_rows($result) == 0) {
session_unregister("ircnick");
session_unregister("userpassword");
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
a {
color: #000000;
}
-->
</style>
<link href="abattoir.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#000000">
<table width="75%" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="main.gif" width="700" height="100"></td>
</tr>
<tr>
<td height="161">
<center>
<h1><font color="#FFFFFF"> Access Denied </font></h1>
<p><font color="#FFFFFF">Your IRC Nick or password is incorrect, or you are not a
registered user on this site. To try logging in again, click
<a href="<?=$PHP_SELF?>">here</a>. To register for instant
access, click <a href="signup.php">here</a>.</font></p>
</td>
</tr>
<tr>
<td><div align="center"><font color="#FFFFFF">© Abattoir Alliance 2003</font></div></td>
</tr>
</table>
</center>
</body>
</html>
<?php
exit;
}
$sql = "SELECT rank FROM members WHERE
ircnick = '$ircnick' AND password = PASSWORD('$userpassword')";
$result = mysql_query($sql);
if ($rank <= 1) {
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
a {
color: #000000;
}
-->
</style>
<link href="abattoir.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#000000">
<table width="75%" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="main.gif" width="700" height="100"></td>
</tr>
<tr>
<td height="161">
<center>
<h1><font color="#FFFFFF"> Access Denied </font></h1>
<p><font color="#FFFFFF">Your Access Level is not high enough to view this page</font></p>
</td>
</tr>
<tr>
<td><div align="center"><font color="#FFFFFF">© Abattoir Alliance 2003</font></div></td>
</tr>
</table>
</center>
</body>
</html>
<?php
exit;
}
?>
sorry for the length of the message but ive tried everything.