Hi,
I am stuck from yesterday with session problem. I got a car website, if user login then it saves some values in session like(user name, listing id, user type). But it get destroyed session when a user want to change his details like username password etc, here is the script when user login.
<?
session_start();
$user_name = isset($POST['login_user_name']) ? $POST['login_user_name'] : $SESSION['user_name'];
$user_pass = isset($POST['login_user_pass']) ? $POST['login_user_pass'] : $SESSION['user_pass'];
if((!isset($user_name)) || (!isset($user_pass)))
{
return "login";
}
$_SESSION['user_name'] = $user_name;
$_SESSION['user_pass'] = $user_pass;
$query = "SELECT user_name, user_pass, user_type, user_fullname, user_id, listing_id FROM user_details WHERE user_name = '$user_name' AND user_pass = PASSWORD('$user_pass') AND user_type='5'";
$result = do_query($query, $dbcnx);
$row = mysql_fetch_array($result);
$user_name=$row['0'];
$user_fullname = $row['3'];
$_SESSION['user_name']=$user_name;
the whole script works ok. but if i want to change user_details and call this query again then session get destroyed. here is the query due to which session is getting destroyed.
$query="SELECT user_id, user_name, user_fullname, user_email, user_mobile, user_address, user_city, user_postcode FROM user_details
WHERE listing_id='$listing_id'";
$result=do_query($query, $dbcnx);
do any one knows why it is destroying session and how can i fix it. thanks in advance