Jump to content

Archived

This topic is now archived and is closed to further replies.

markbett

Session variable

Recommended Posts

ok the code on that page now looks somethign like this:

[code]<?
var_dump($_SESSION);
echo "<hr>";
//determien the event hosts name
$sql = mysql_query("SELECT first_name, last_name, email_address AS host_email 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;
}
}
var_dump($_SESSION); ?>[/code]

you can see THAT is the section of code that is causeing the session variable  to be RESET WHY???

my login script ONLY should set those if the login isnt set to being true

[code]
if($_SESSION['login'] != TRUE){
echo "i ran again cause i suck";
$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'];
[/code]

wtf is going on.....

Share this post


Link to post
Share on other sites
do you have oh, what is it called, session register globals or something like that, where session variables become normal variables? 

do this: 

echo ini_get('register_globals');

If that is on or true or whatever, that is your problem.  &$first_name == &$_SESSION['first_name']

I think that is the problem.  Sorry for the slow response, I went out for the night.

Share this post


Link to post
Share on other sites
i looked through the php manual and i dont see anything indicating that register globals results in session variables overwriting non session... anyone

Share this post


Link to post
Share on other sites

×

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.