Pear::Auth and idle
| From: | Margusja | Date: | Wed, 23 Feb 2005 12:16:46 +0000 |
| Subject: | Pear::Auth and idle | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-17644@lists.php.net to get a copy of this message | ||
Hello, I try use Pear::Auth http://margusja.101d.ee/Pear_Auth/
user: test
passw: test
Pear::Auth manual say about function sessionValidThru(): This method returns the time in seconds after which the idle time of the current authentication session has reached its limit, which will cause the user to be logged out automatically. If no maximum idle time is set, which is the default configuration of PEAR::Auth, this method will return 0.
I use deffault settings, that mean sessionValidThru() must return 0?
My code:
<?php
require_once "Auth.php";
function loginFunction()
{
echo "<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">";
echo "<input type=\"text\" name=\"username\">";
echo "<input type=\"password\" name=\"password\">";
echo "<input type=\"submit\">";
echo "</form>";
}
$params = array(
"dsn" => "mysql://xxx:xxx@localhost/pear_auth",
"table" => "auth",
"usernamecol" => "username",
"passwordcol" => "password"
);
$a = new Auth("DB", $params, "loginFunction");
# Logout
if ($logout) $a->logout();
$a->start();
# Secure area
if ($a->checkAuth()) {
echo "You are in.<BR>";
echo "<a href=\"?logout=true\">Log out</a>";
echo "<hr>";
# Debug area
echo "Text from <a
href=\"http://pear.php.net/manual/en/package.authentication.auth.auth.sessionvalidthru.php\">manual</a> -> This method returns the time in
time of the current authentication session has reached its limit, which will
cause the user to be logged out automatically. If no maximum idle time is
set, which is the default configuration of PEAR::Auth, this method will
return 0.<BR><BR>";
echo "I use default settings!!! Why sessionValidThru not 0!!!???<BR>";
echo "<b>sessionValidThru</b> -> ".$a->sessionValidThru();} ?> Thanks for the help. ~Margusja