DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> PEAR Forum - Forum for PHP Extension and Application Repository

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 
HTTP_Session with DB-container and Auth

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



Joined: 12 Dec 2006
Posts: 2
Location: Sweden

PostPosted: Tue Dec 12, 2006 4:11 pm    Post subject: HTTP_Session with DB-container and Auth Reply with quote

I've made a simple login page with the Auth-package on one page pretty much like in the documentation:

-------------------------
<?php
require_once "Auth.php";

function loginFunction()
{
/*
* Change the HTML output so that it fits to your
* application.
*/
echo "<form method=\"post\" action=\"test.php\">";
echo "<input type=\"text\" name=\"username\">";
echo "<input type=\"password\" name=\"password\">";
echo "<input type=\"submit\">";
echo "</form>";
}

$options = array(
'dsn' = "mysql://user:password@localhost/database",
);
$a = new Auth("DB", $options, "loginFunction");

$a->start();

if ($a->checkAuth()) {

header('location:http:\\www.domain.com\page.php');
}
?>
---------------------------------

When the user logs in he is transfered to another page that checks again if he is authorized. All fine to this point, but then I want to use a new HTTP_Session to store some data in a database like this..

---------------------------------
HTTP_Session::useTransSID(false);
HTTP_Session::useCookies(true);

HTTP_Session::setContainer('DB', array('dsn' => database_Dsn(),'table' => 'tbl_sessiondata'));
HTTP_Session::start('mySession');

HTTP_Session::setExpire(time() + 300); // set expire to 300 seconds
HTTP_Session::setIdle(time() + 5); // set idle to 5 seconds
-----------------------------------

The problem is that I get this error message and I have no idea how to solve it.. :

Warning: session_module_name(): A session is active. You cannot change the session module's ini settings at this time.

Is it possible to run an Auth session together with a HTTP_Session on the same page?
Back to top
View user's profile Send private message MSN Messenger
rimian



Joined: 11 Feb 2007
Posts: 2
Location: Australia

PostPosted: Sun Feb 11, 2007 11:29 am    Post subject: Reply with quote

I am guessing but I think it's where you're trying to set the idle and expiry time. You shoud be able to do this with Auth and skip those two lines.
_________________
http://www.freelancewebdeveloper.net.au
http://www.rimian.com.au
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> HTTP 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