RE: @session_start generates a new session_id

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



session_id($username);
session_start();
Solved the problem...
Thank you all for the replies...

-----Original Message-----
From: Lizet Peña de Sola [mailto:lizet@xxxxxxxxxxxxx] 
Sent: Wednesday, October 27, 2004 3:55 PM
To: rv@xxxxxxxx; php-general@xxxxxxxxxxxxx
Subject: RE:  @session_start generates a new session_id



It still doesn't work :(... When I try to destroy the session without asking
if there's a session_id, it gives me a warning, I fixed it with the
if(session_id()) but still, when the user logs in again with a different
profile, in the same browser window, the profile that is loaded is the
previous one... Here I copy the logout.php code: <?
$_SESSION['validlogin']=""; 
$_SESSION['username']=""; 
$_SESSION['password']=""; //destroy the sessions array 
$_SESSION = array(); 
//destroy the session
if(session_id()){
session_destroy(); 
}
?>

And the code that runs when the user logs in:
<?
$username=trim($_POST['user']);
$password=trim($_POST['pwd']);

if(session_id()){echo('Error, please contact tech support'); exit();}
if(validateuser()){			  
			  session_start();
			  			  
			  $_SESSION['validlogin']=true;
			  $_SESSION['username']=$username;
			  $_SESSION['password']=$password;
}
...
?>
Any ideas why the session variables get set to their first value after
starting the session for the second time? Should I create a different
session id each time? Tia, Lizet

-----Original Message-----
From: Reinhart Viane [mailto:rv@xxxxxxxx] 
Sent: Tuesday, October 26, 2004 12:49 PM
To: 'Lizet Peña de Sola'; php-general@xxxxxxxxxxxxx
Subject: RE:  @session_start generates a new session_id


Instead of:
	<? $_SESSION['validlogin']=""; $_SESSION['username']="";
$_SESSION['password']=""; unset($_SESSION['validlogin']);
unset($_SESSION['username']); unset($_SESSION['password']);
session_unset(); print("username=".$_SESSION	['username']);
	print("password=".$_SESSION['password']);

	if(session_id()){
	session_destroy();}
	?>

Try this:

//unregister the sessions
$_SESSION['validlogin']=""; $_SESSION['username']="";
$_SESSION['password']=""; //destroy the sessions array $_SESSION = array(); 
//destroy the session
session_destroy(); 

Greetings
Reinhart Viane






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux