Jump to content

Session variable


markbett

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.....
Link to comment
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.
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.