Jump to content

check user level script (not working


devangel

Recommended Posts

hey guys,

 

im making a check user level script.

 

if $usr['authlevel']>4

echo "adminpanel"

 

i have set my sessions.

 

$_SESSION['SESS_USERID'] = $user['userid'];

$_SESSION['SESS_USERNAME'] = $user['username'];

 

how do i use the sess_userid to retrieve the users details for the users id only.

 

ive tried ::

 

mysql_query("SELECT * FROM users WHERE userid = '$userid'") or die(mysql_error());

$usr = mysql_fetch_array( $data );

 

please someone with guidance, ive been searching for hours. i need to make a if statement to check user level, but i havent managed to retrieve db info via session.

 

 

Link to comment
https://forums.phpfreaks.com/topic/195613-check-user-level-script-not-working/
Share on other sites

how would i be able to save the authlevel in a session

 

ive tried

 

$user = mysql_fetch_assoc($result);

$_SESSION['SESS_USERID'] = $user['userid'];

$_SESSION['SESS_USERNAME'] = $user['username'];

$_SESSION['SESS_AUTHLEVEL'] = $user['authlevel'];

 

how would you define it into a session?

my query doesnt look wrong

 

$qry="SELECT * FROM users WHERE username='$username' AND password='".md5($_POST['password'])."' and authlevel>0";

$result=mysql_query($qry);

 

it checks to see if your banned userlevel (0)

 

but yeah i cant figure out why its saying its not defined i used:

 

<?php if ($_SESSION['authlevel']>4)

echo "adminpanel"; ?>

 

and i got

 

Notice: Undefined index: authlevel in

 

on that line.

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.