markbett Posted September 15, 2006 Share Posted September 15, 2006 my session variables arent staying set and i need some guidance as to where my problem lies.site:http://207.5.19.133/sbqawhen logging in i set:[code]<?phpinclude $_SERVER['DOCUMENT_ROOT']. '/sbqa/layout2.php';switch($_REQUEST['req']){ case "validate"://ensure they are not already logged in//if($_SESSION['login'] != TRUE){ $username = mysql_real_escape_string($_POST['username']); $password = mysql_real_escape_string($_POST['password']); $validate = mysql_query("SELECT * FROM users WHERE username='$username' AND password = md5('$password') AND verified='1' AND disabled='0' ") or die (mysql_error()); if(mysql_num_rows($validate) == 1){ while($row = mysql_fetch_assoc($validate)){ $_SESSION['login'] = true; $_SESSION['userid'] = $row['id']; $_SESSION['first_name'] = $row['first_name']; $_SESSION['last_name'] = $row['last_name']; $_SESSION['email_address'] = $row['email_address'];[/code]i include session permissions which include:[code]<?phpsession_start();session_name('SBQA');header("Cache-control: private"); // Fix for IE[/code]the problem is that when i go to the page:http://207.5.19.133/sbqa/rsvp_manager.php?req=rsvp&event_id=43the NAME in the login box changes from my name (as was set in the session earlier)to data from the event query.....is shouldnt because the code for that box is[code] echo '- Welcome '.$_SESSION[first_name].'.[/code]what gives?? Quote Link to comment Share on other sites More sharing options...
Wintergreen Posted September 15, 2006 Share Posted September 15, 2006 You need session_start() at the top of each page Quote Link to comment Share on other sites More sharing options...
markbett Posted September 15, 2006 Author Share Posted September 15, 2006 it is, my layout file includes variables and session includes that apply for every page that is shown.... so if it has the layout it ran through the sessionstart() additionally i event added that to the top of the layout file so it would be run twice to no avail..... still happens... Quote Link to comment Share on other sites More sharing options...
markbett Posted September 15, 2006 Author Share Posted September 15, 2006 the problem stopped when i changed this bit of code[code] //determien the event hosts name $sql = mysql_query("SELECT first_name, last_name FROM users WHERE id ='$event_host'") //id ='15'")// or die (mysql_error()); if(!$sql){ echo 'Error getting determining event host: '. mysql_error(); } else { while($row = mysql_fetch_array($sql)){ stripslashes(extract($row)); $event_host = $first_name.' '.$last_name; } } [/code]it was originally set to a static host (id=15) but then i changed it so that it will show the name of the person who posted the event..... the problem is WHY is this piece of code changing the value of a session variable?? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.