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 
Auth->setExpire

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



Joined: 29 Jan 2007
Posts: 1

PostPosted: Mon Jan 29, 2007 2:47 pm    Post subject: Auth->setExpire Reply with quote

Cannot someone advise me why this isn't working?

Code:
<?php
require_once("db.php");
require_once("Auth.php");

function login_form() {
?>
<form method="post" action="/index.php" onSubmit="return true;">
<table border="0" cellpadding="2" cellspacing="0" summary="login form" align="center" height="100%" width="100%">
   <tr>
      <td align="center">
         <table align="center" cellpadding="2" cellspacing="0" border="1" bgcolor="#eeeeee">
            <tr>
                <td>Username:</td>
                <td><input type="text" id="username" name="username" value="" /></td>
            </tr>
            <tr>
                <td>Password:</td>
            
                <td><input type="password" id="password" name="password" /></td>
            </tr>
            <tr>
                <td colspan="2" align="right"><input value="Login" id="doLogin" name="doLogin" type="submit" /></td>
            </tr>
         </table>
      </td>
   </tr>
</table>
<input type="hidden" id="authsecret" name="authsecret" value="" /></form>
<?php
}

$params = array(
  "dsn" => $dsn,
  "table" => "staff",
  "usernamecol" => "username",
  "passwordcol" => "password"
);

// A database is used as storage container in this example
$login = new Auth("MDB2", $params, "login_form");

// Detection, if user is logged in. Otherwise the login form
// is being displayed.
$login->start();
$login->setExpire(time()+36000);

if ($disable_auth || $login->getAuth()) {
   if(isset($_GET["action"]) && $_GET["action"] == "logout") {
      // Log user out
      $login->logout();
      header("Location: index.php");
      exit;
   }
   $user_defaults = login_user_defaults();
} else {
   exit;
}
?>

That's my login include, and once logged in, I've got a test script that print_r's getAuthData() and getStatus(), and it returns nothing...

Any thoughts?

Cheers
Nunners
Back to top
View user's profile Send private message
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