PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
session_regerate_id() issue

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Authentication
View previous topic :: View next topic  
Author Message
Wolfsbane



Joined: 04 Jul 2008
Posts: 1
Location: Chicago burbs

PostPosted: Thu Jul 10, 2008 2:52 pm    Post subject: session_regerate_id() issue Reply with quote

I get the following error when I run an authentication script:

PHP Warning: session_regenerate_id() [/etc/php5/helpdocs/htmlfunction.session-regenerate-id.html]: Session object destruction failed in /srv/www/htdocs/PEAR/Auth.php on line 830, referer: http://homeserver/recipe/index.php

This error does not happen every time just every other time. I can log in and get the error then log out and then log back in and not get the error the repeat the process and get the error. I have checked permissions on the session directory and they are fine.

The first page (index.php):
<?php
require_once('config.php');
$smarty->assign('web_title',$web_title);
$smarty->display('header.tpl');
?>
<form action="login.php">
<input type="submit" value="Login in"/>
<br>
<br>
</form>
<form method="link" action="register.php">
<input type="submit" value="New user">
</form>
</body>

The index page sends you to this (login.php):

<?php

// Example of Auth_HTTP the also returns additional information about the user thank you to Michele Davis and Jon A. Phillips
// Learning PHP & MySQL - O'REILLY Media.
require_once('config.php');
require_once('db_login.php');
require_once('Auth/HTTP.php');
// require_once('Log.php');
// error_log(PEAR_LOG_TYPE_DEBUG);
$AuthOptions = array(
'dsn'=>"mysql://$db_username:$db_password@$db_host/$db_database",
'table'=>"users",
'usernamecol'=>"username",
'passwordcol'=>"password",
'cryptType'=>"md5",
'db_fields'=>"*"
);
$authenticate = new Auth_HTTP("MDB2", $AuthOptions);
$authenticate->setRealm('Member Area');
$authenticate->setCancelText('<h2>Access Denied</h2>');

$authenticate->start( );
if ($authenticate->getAuth( )) {
session_start( );
header("Cache-control: private");
$smarty->assign('web_title',$web_title);
$smarty->display('header.tpl');
//setup session variable
echo '<meta http-equiv="refresh" content="4; url=mainmenu.php">';
$_SESSION['username'] = $authenticate->username;
$_SESSION['first_name'] = $authenticate->getAuthData('first_name');
$_SESSION['last_name'] = $authenticate->getAuthData('last_name');
$_SESSION['user_id'] = $authenticate->getAuthData('user_id');
echo "Login successful. Great to see you ";
echo $authenticate->getAuthData('first_name');
echo " ";
echo $authenticate->getAuthData('last_name').".<br />";
//$smarty->display('footer.tpl');
}
?>

This page contains the first session_start() statement and like I said bombs every other time.
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Authentication All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement

'Actiemonitor' online projectmanagement software