[PHPLIB] PHPLib loginform From: Hein van Eeden (hein <email protected>)
Date: 12/17/99

Hi,

My problem is, when using phplib, as soon as the page_open command is
called, it automatically loads my loginform.phtml page. Even if I enter a
valid username and password, it keep re-displaying the page (not showing
the error message when failed to comfirm). If you want to take a look at
the page, go to www.informsa.co.za/services/Mail/mail_login.phtml

I call the mail_login.phtml page first, here is my code:

<?
         require("prepend.php3");
         page_open(array("sess" => "Inf_mail_session", "auth" =>
"Inf_mail_auth"));
?>
<html>
blah blah blah
</html>
<? page_close() ?>

In my local.inc, the session and auth classes looks like this:

class Inf_mail_auth extends Auth {
     var $classname = "Inf_mail_auth"; // Object serialization support
     var $lifetime = 15;

     // DB_Sql subclass and database table to use
     var $database_class = "DB_Example";
     var $database_table = "auth_user";

         // Some magic value to make our uids harder to guess.
     var $magic = "info89$%den@)xmen01(";

         // Use an own login form
     function auth_loginform() {
         global $sess;
         include("/home/httpd/htdocs/services/Mail/loginform.phtml");
     }

     function auth_validatelogin() {
         global $userid, $passwd; // form variables from loginform.ihtml
         $this->auth["uname"] = $userid;

         // Value to return in case auth fails.
         $uid = false;

         // Check the database for this user and password pair.
         $query = sprintf("select username from %s where username = '%s'
and password = '%s'",
                         $this->database_table, $userid, $passwd);
                         $this->db->query($query);

         // If we found a matching user, grab the uid and permissions...
         while($this->db->next_record()) {

                 $uid = $this->db->f("uid");

         }

         return $uid;
     }
}

class Inf_mail_session extends Session {
         var $classname = "Inf_mail_session";

         var $cookiename = "Inf_Mail_Del";
         var $magic = "inf34)20349(joker()@#";
         var $mode = "cookie"; ## We propagate session IDs
with cookies

         var $fallback_mode = "get";
         var $lifetime = 20; ## 0 = do session
cookies, else minutes
         var $that_class = "Example_CT_Sql"; ## name of data storage
container
         var $gc_probability = 5;
}
?>
-
PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in
the body, not the subject, of your message.