Jump to content

session variables changes


markbett

Recommended Posts

my session variables arent staying set and i need some guidance as to where my problem lies.

site:
http://207.5.19.133/sbqa

when logging in i set:

[code]<?php
include $_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]<?php
session_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=43

the 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??
Link to comment
Share on other sites

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...
Link to comment
Share on other sites

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??
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.