Jump to content


Photo

Session variable


  • Please log in to reply
28 replies to this topic

#21 Hi I Am Timbo

Hi I Am Timbo
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts

Posted 05 October 2006 - 05:17 AM

i thoguht about that as well which is why i did the above... furthermore when i watch the ["login"]=> &bool(true)  it doesnt change....


right, but it depends on where you are dumping it, right?

#22 markbett

markbett
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts

Posted 05 October 2006 - 05:19 AM

what do you mean

#23 Hi I Am Timbo

Hi I Am Timbo
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts

Posted 05 October 2006 - 05:20 AM

well if the bool is changed after you dump it, or you execute the login then dump it and it sets it to true again, that wouldn't show up.  I would try doing an echo inside the login part, so when the login part is executed, you know and know if that is the problem.

#24 markbett

markbett
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts

Posted 05 October 2006 - 05:23 AM

thats what i did **see reply 17**

#25 markbett

markbett
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts

Posted 05 October 2006 - 05:41 AM

ok i dump varibles on the page throughout it and it changes them from after teh session stuff is done to when the data is being put in that page... now WHY WHY WHY

#26 markbett

markbett
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts

Posted 05 October 2006 - 05:58 AM

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

<?
	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); ?>

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

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'];

wtf is going on.....

#27 Hi I Am Timbo

Hi I Am Timbo
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts

Posted 05 October 2006 - 07:57 AM

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.

#28 markbett

markbett
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts

Posted 05 October 2006 - 05:25 PM

i looked through the php manual and i dont see anything indicating that register globals results in session variables overwriting non session... anyone

#29 markbett

markbett
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts

Posted 05 October 2006 - 11:21 PM

aanyone




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users