fout in php script
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title> | </title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<link rel="stylesheet" href="default.css" type="text/css" />
</head>
<body><a name="top" />
<div class="banner"><a href="index.php"><img src="top.jpg" alt=" - Return to Board List" /></a></div>
<div class="topmenu"><table width="100%" cellpadding="0"><tr>
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php
if(isset($_COOKIE)) {
$username = $_COOKIE['username'];
$pass = $_COOKIE['pass'];
$check_adm = mysql_num_rows(mysql_query("SELECT userid FROM users WHERE username = '$username' AND pass = '$pass' AND level = '3'"));
$check_mod = mysql_num_rows(mysql_query("SELECT userid FROM users WHERE username = '$username' AND pass = '$pass' AND level = '2'"));
$check_usr = mysql_num_rows(mysql_query("SELECT userid FROM users WHERE username = '$username' AND pass = '$pass' AND level = '1'"));
if($check_adm == 1) {
echo '<td width="50%"><a href="user.php">'.$username.'</a> | <a href="logout.php">Log Out</a> | <a href="help.php">Help</a></td><td class="cp" width="50%"><a href="admin.php">Admin CP</a> | <a href="mod.php">Moderator CP</a></td>';
$userlvl = 3;
else if($check_mod == 1) {
echo '<td width="50%"><a href="user.php">'.$username.'</a> | <a href="logout.php">Log Out</a> | <a href="help.php">Help</a></td><td class="cp" width="50%"><a href="mod.php">Moderator CP</a></td>';
$userlvl = 2; }
else if($check_usr == 1) {
echo '<td><a href="user.php">'.$username.'</a> | <a href="logout.php">Log Out</a> | <a href="help.php">Help</a></td>';
$userlvl = 1; }
else {
echo '<td><a href="register.php">Register</a> | <a href="login.php">Log in</a> | <a href="help.php">Help</a></td>';
$userlvl = 0; }
}
?>
if(isset($_COOKIE)) {
$username = $_COOKIE['username'];
$pass = $_COOKIE['pass'];
$check_adm = mysql_num_rows(mysql_query("SELECT userid FROM users WHERE username = '$username' AND pass = '$pass' AND level = '3'"));
$check_mod = mysql_num_rows(mysql_query("SELECT userid FROM users WHERE username = '$username' AND pass = '$pass' AND level = '2'"));
$check_usr = mysql_num_rows(mysql_query("SELECT userid FROM users WHERE username = '$username' AND pass = '$pass' AND level = '1'"));
if($check_adm == 1) {
echo '<td width="50%"><a href="user.php">'.$username.'</a> | <a href="logout.php">Log Out</a> | <a href="help.php">Help</a></td><td class="cp" width="50%"><a href="admin.php">Admin CP</a> | <a href="mod.php">Moderator CP</a></td>';
$userlvl = 3;
else if($check_mod == 1) {
echo '<td width="50%"><a href="user.php">'.$username.'</a> | <a href="logout.php">Log Out</a> | <a href="help.php">Help</a></td><td class="cp" width="50%"><a href="mod.php">Moderator CP</a></td>';
$userlvl = 2; }
else if($check_usr == 1) {
echo '<td><a href="user.php">'.$username.'</a> | <a href="logout.php">Log Out</a> | <a href="help.php">Help</a></td>';
$userlvl = 1; }
else {
echo '<td><a href="register.php">Register</a> | <a href="login.php">Log in</a> | <a href="help.php">Help</a></td>';
$userlvl = 0; }
}
?>
</tr></table></div>
Het probleem: als een gebruiker geen admin is, veranderd de balk niet.
dit moet juist wel gebeuren (bij admin moet er staan *username* | Log Out | Help | Admin CP | Mod CP
Bij moderator hetzelfde min de Admin CP
en bij een gewone gebruiker hetzelfde als mod min de mod CP.
Als je niet bent ingelogd staat er Register | log in | help, dit staat er ook bij mod en user.
kan iemand helpen??
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title> | </title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<link rel="stylesheet" href="default.css" type="text/css" />
</head>
<body><a name="top" />
<div class="banner"><a href="index.php"><img src="top.jpg" alt=" - Return to Board List" /></a></div>
<div class="topmenu"><table width="100%" cellpadding="0"><tr>
Code (php)
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
<?php
if(isset($_COOKIE)) {
$username = $_COOKIE['username'];
$pass = $_COOKIE['pass'];
$result = mysql_query('SELECT level FROM users WHERE username = "'.$username.'" AND pass = "'.$pass);
if(mysql_num_rows($result)!=0){
list($userlvl) = mysql_fetch_row($result);
?>
if(isset($_COOKIE)) {
$username = $_COOKIE['username'];
$pass = $_COOKIE['pass'];
$result = mysql_query('SELECT level FROM users WHERE username = "'.$username.'" AND pass = "'.$pass);
if(mysql_num_rows($result)!=0){
list($userlvl) = mysql_fetch_row($result);
?>
<td width="50%">
<a href="user.php">'.$username.'</a> |
<a href="logout.php">Log Out</a> |
<a href="help.php">Help</a>
</td>
<td class="cp" width="50%">
<a href="mod.php">Moderator CP</a>
</td>
<td>
<a href="register.php">Register</a> |
<a href="login.php">Log in</a> |
<a href="help.php">Help</a>
</td>
<td>
<a href="register.php">Register</a> |
<a href="login.php">Log in</a> |
<a href="help.php">Help</a>
</td>
</tr>
</table>
</div>
ja het werkt, ik heb zelf even mod en user toegevoegd, en het werkte goed