Hi guys I have a sessions problem i am using a login that will change menu depending on the user group your are listed in the database.
This all works fine but as i browse through pages my user id or pilot_id changes to that of another person any idea why this would happen .
Any help would be great got me stumped this one as im new to php and sessions.
<?php
session_start();
include("dbinfo.inc.php");
mysql_connect("localhost",$username,$code);
mysql_select_db ("$database");
$pilot_id = $_POST['pilot_id'];
$password = $_POST['password'];
if((!$pilot_id) || (!$password)){}
$sql = mysql_query("SELECT * FROM members WHERE pilot_id='$pilot_id' AND password='$password'");
$login_check = mysql_num_rows($sql);
if($login_check > 0){
while($row = mysql_fetch_array($sql)){
foreach( $row AS $key => $val ){
$$key = stripslashes( $val );
}
$_SESSION['pilot_id'] = $pilot_id;
$_SESSION['password'] = $password;
$_SESSION['menu'] =$membership;
$meta='<meta http-equiv="refresh" content="0;url=http://www.">';
}
} else {
}?>
and this logs you in fine i use the following script to display the menu depending on the group your in.
<?php
session_start();
include("scripts/dbinfo.inc.php");
$pilot_id = $_SESSION['pilot_id'];
$password = $_SESSION['password'];
$membership =$_SESSION['menu'];
if ($membership=="member")
{$menu=menu_pilot;}
else
if ($membership=="staff")
{$menu='menu_staff';}
else
if (!$membership)
{$menu=menu_guest;}?>