Session Fustration

Howdy folks,

I am trying to get sessions to cooperate, but am at a loss. I am trying to copy the variable of userlevel in a session. The array displays correctly on pointerface.php. For some reason, the session doesn’t seem to carry over to other pages, and the session ID’s are different.

I’d appreciate some input as to where I may be going wrong.

pointerface.php:
[php]session_start();

{
include(’…/htconfig/dbConfig.php’);
mysql_connect("$hostname","$username","$password");
mysql_select_db("$database")or die(“cannot select DB”);
$tbl_name=“members”;

$sql2=“SELECT * FROM members WHERE username=’$myusername’ and password=’$mypassword’”;
$result2=mysql_query($sql2);
$userlevel=mysql_result($result2,$i,“userlevel”);
$_SESSION[“userlevel”] = “$userlevel” ;
echo session_id();
echo “
”;
Print_r ($_SESSION);[/php]

adminnotes.php:

[php]session_start();

print_r ($_SESSION);
echo session_id();

if($_SESSION['userlevel']=='Admin'){[/php]

change your queries from mysql to mysqli or PDO then i’ll be able to help you :wink:

Sponsor our Newsletter | Privacy Policy | Terms of Service