Thread: Errata
View Single Post
 
Old April 18th, 2005, 06:32 AM
soup soup is offline
Registered User
 
Join Date: Apr 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The book is interested but.......

I'm looking at chapter 15 Sessions and Authentification

Changes made so far to make my code work
In usersession.phpm
Change 1
# $strUserAgent = $GLOBALS["HTTP_USER_AGENT"];
# changed to _SERVER
$strUserAgent = $_SERVER["HTTP_USER_AGENT"];

this also needs changing further down in the script

Change 2
usersession.phpm
$maxlifetime is called but not defined in __construct so
$maxlifetime = $this->session_lifespan;

Change 3
usersession.phpm
also in __construct
this sql is wrong
DELETE FROM \"user_session\" WHERE (ascii_session_id = '". $this->php_session_id . "') OR (now() - created) > '".$maxlifetime."')
its missing a (
CORRECT it should be
DELETE FROM \"user_session\" WHERE (ascii_session_id = '". $this->php_session_id . "') OR ( (now() - created) > '".$maxlifetime."')

Extra in the tables sql they don't insert the user
INSERT INTO "user"(username,md5_pw,first_name,last_name) VALUES ('ed', '827ccb0eea8a706c4c34a16891f84e7b', 'Ed', 'Lecky-Thompson');

After these changes it now works at least but I still get at the bottem of my script the following ???
Fatal error: Call to private method UserSession::_session_write_method() from context '' in Unknown on line 0

Warning: Unknown: A session is active. You cannot change the session module's ini settings at this time. in Unknown on line 0

PS this was the case running on a local testing maching with WindowsXP pro