wtfsmd Posted January 15, 2007 Share Posted January 15, 2007 Hey guys, im trying to figure out why i can't get this to work :-\i cut out most of the code, this is just the stuff i thought would be important.[code]<?php//start sessionsession_start();//include the database loginrequire 'login/db_connect.php'; //make a connection to the database $sql = "SELECT username, password, userrank FROM users WHERE username = '".$_POST['uname']."'"; $result = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_array($result) or die(mysql_error()); // where $row is the record pulled from the database. $_SESSION['level'] = $row['userrank'];?>[/code]on the page that i want admin privileges on i have this(session_start and database connect are cut out but at the top of everything):[code]<?php include('fetchnews.php'); print_r($_SESSION);//session user idif($_SESSION['level'] == "2") { include('test.php'); } else { }?>[/code]I have print_r($_SESSION);, and what i get is this:[code]Array ( [username] => Admin [password] => d159167596fd8ac07a8c9cf92150848d [level] => )[/code]Here is a screenshot of my database [url=http://tinypic.com/2z7mkie.png]http://tinypic.com/2z7mkie.png[/url]Any help would be appreciated, i most likely did this wrong lol. Link to comment https://forums.phpfreaks.com/topic/34210-session-permissions/ Share on other sites More sharing options...
wtfsmd Posted January 15, 2007 Author Share Posted January 15, 2007 ah sorry got a little ahead of myself, here is what i need help with: I am trying to make the session get the userrank for whom ever is logged in, regular people have the rank of 1 admins have the rank of 2. currently my userrank Session is not working most likely because of a error. Link to comment https://forums.phpfreaks.com/topic/34210-session-permissions/#findComment-160941 Share on other sites More sharing options...
wtfsmd Posted January 15, 2007 Author Share Posted January 15, 2007 Can anyone help? Link to comment https://forums.phpfreaks.com/topic/34210-session-permissions/#findComment-160976 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.