Jump to content

Userlevel login


dean7

Recommended Posts

Hi all, on my website i have a Owner Panel which your userlevel needs to be 4 other wise you carnt veiw it...

 

<?php
session_start();
include ("includes/config.php");
include ("includes/functions.php");
$when = gmdate('Y-m-d h:i:s'); // Date the log happend.
$get = mysql_query("SELECT userlevel FROM users WHERE username = '$username'");
$got = mysql_fetch_object($get);
$userlevel=$get->userlevel; 
// main varibales
$username = $_SESSION['username'];
// Gets the $username

if(!isset($_SESSION['username']) || !isset($_SESSION['password'])){
header("Location: index.php");
}else{
$fetch_users_data = mysql_fetch_object(mysql_query("SELECT * FROM `users` WHERE username='".$_SESSION['username']."'"));
}
// Checking login status, if not logged in got to the header location. (index.php);

if ($userlevel == "4"){ // Do this..
echo ("Welcome $username, Your level is <font color=darkred>Owner</font>");
}
elseif ($userlevel < "4"){ // Do this...
echo ("<b><font size=3>Get Away! - Action Logged!"); // echo message saying "Not meant to be here"
$action = "Tryed Getting On Owner Panel"; // What the user tryed doing when should'nt be there.
$addlog = mysql_query("INSERT INTO adminlogs WHERE username = '$username', action = '$action', date = $when"); // Insert to database
}
?>
<html>
<head>
<title>Owner Panel</title>
<?php
include ("style.css");
?>
</head>
<body>
<br />
<align="center"><table width="90%" height="" cellpadding="0" cellspacing="0" border="1" bordercolor="#000000">
<tr>
<td class="header">
<align="center">Owner Cp</align>
</td>
</tr>
<tr>
<td class="forum">
<align="center">Please Note: All Actions Are Logged!</align>
</td>
</tr>
<tr>
<td class="forum" width="45%">
<strong>User Settings</strong>
</td>
<td class="forum" width="45%">
<strong>Game Settings</strong>
</td>
</tr>
<tr>
<td class="tablestyle">
~ <a href="../pannels/owner/edit_profile.php">Edit User Profile</a>
</td>
<td class="tablestyle">
~ <a href="../pannels/staff/ban.php">Ban User</a>
</td>
</tr>
<tr>
<td class="tablestyle">
~ <a href="../pannels/owner/user_stats.php">User Stats</a>
</td>
<td class="tablestyle">
~ <a href="../pannels/topstaff/ip_ban.php">Ip Ban</a>
</td>
</tr>
<tr>
<td class="forum" width="45%">
<strong>Log's</strong>
</td>
<td class="forum" width="45%">
<strong>Help Systems</strong>
</td>
</tr>
<tr>
<td class="tablestyle">
~ <a href="../pannels/topstaff/userlogs.php">User Logs</a>
</td>
<td class="tablestyle">
~ <a href="../pannels/staff/get_ticket.php">Help Desk Ticket</a>
</td>
</tr>
<tr>
<td class="tablestyle">
~ <a href="../pannels/topstaff/modlogs.php">Mod Logs</a>
</td>
<td class="tablestyle">
~ <a href="../pannels/staff/abuse_panel.php">Abuse Ticket</a>
</td>
</tr>
<tr>
<td class="tablestyle">
~ <a href="../pannels/owner/headmodlogs.php">Head Mod Logs</a>
</td>
<td class="tablestyle">
~ <a href="../pannels/topstaff/answered_tickets.php">Answered Tickets</a>
</td>
</tr>
<tr>
<td class="tablestyle">
~ <a href="../pannels/owner/admin_logs.php">Admin Logs</a>
</td>
<td class="tablestyle">
~ <a href="#">Nothing Here<a/>
</td>
</tr>
</table></align>
</body>
</html>

 

Ive coded that piece of code but even if the user has a userlevel of 4 it still dont let them veiw the page. :S

anyway know why?

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/192508-userlevel-login/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.