Whilst doing this ive ran into a problem with using sessions to identify if the user is banned or is an admin..
The code ive got so far is this to make the sessions on the login page..
Code: Select all
$query="SELECT * FROM game_accounts";
$result=mysql_query($query);
$num=mysql_numrows($result);
$i=0;
while ($i < $num) {
$UserID=mysql_result($result,$i,"UserID");
$Admin=mysql_result($result,$i,"admin");
$Banned=mysql_result($result,$i,"banned");
$i++;
}
$_SESSION['UserID'] = $UserID; // store session data
$_SESSION['IsAdmin'] = $Admin;
$_SESSION['IsBanned'] = $Banned;
//then redirect them to the members area
header("Location: overview.php");Code: Select all
<?php
session_start();
if ($_SESSION['IsBanned']=1){
echo ('<center><font color="red">Your account has been banned</font><br><a href="logout.php">Back</a></center>');
}
else {
}Code: Select all
<link href="styles/style.css" rel="stylesheet" type="text/css" />
<center>
<a href="overview.php">Overview</a> -
<a href="units.php">Units</a> -
<a href="profile.php">Profile</a> -
<?php
if ($_SESSION['IsAdmin']=1){
echo ('<a href="admin.php">Admin Panel</a> - ');
echo ('<a href="logout.php">Logout</a>');
}
else{
echo ('<a href="logout.php">Logout</a>');
}
?>
</center>Most likley ive gone around it all the totally wrong way.
Anyway help will be appreciated