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
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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.