Re: using Auth.php
| From: | David Dahl | Date: | Mon, 18 Feb 2002 15:36:47 +0000 |
| Subject: | Re: using Auth.php | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-866@lists.php.net to get a copy of this message | ||
actually. when i revert to using just a function i get the same parse error on the line that starts the function:
<?php
require_once 'DB.php';
require_once 'Auth/Auth.php';
require_once 'classes/ui.class.php';
function showLogin($username, $status){
global $PHP_SELF;
$loginScreen = new ui;
//login screen html is in login(), part of ui class
$loginScreen->login();
}
$params = array(
"dsn" => "mysql://root:****@127.0.0.1/wos", "table" => "employee", "usernamecol" => "username", "passwordcol" => "password" );$a = new Auth("DB", $params, "showLogin"); $a->start(); if ($a->getAuth()) {
echo "You have been authenticated successfully.";} ?> On Monday, February 18, 2002, at 09:12 AM, David Dahl wrote:
it was on line 16: $a = new Auth("DB", $params, "login_screen"); i guess may be complicating this too much. I am trying to over-OOP myself. Thanks David On Monday, February 18, 2002, at 03:13 AM, Martin Jansen wrote:On Sun, 17 Feb 2002 23:06:23 -0600, David Dahl wrote:Here is what I have managed to screw up so far (all i get is a parse error):Where do you get that parse error?=====Security.php===== <?php require_once "Auth/Auth.php"; require_once "classes/ui.class.php"; class security extends Auth { var $username; var $password; var $status; var $params = array(You don't need to subclass Auth: Simply create a function login_screen() in the global scope and pass it via the third parameter to Auth. The array $params can be passed as the second paramter: $a = new Auth("DB", $params, "login_screen"); - Martin"dsn" => "mysql://root:****@127.0.0.1/wos", "table" => "employees", "usernamecol" => "username", "passwordcol" => "password" );function login_screen($username, $password, $status) { //calls "UI" forms and html widgets $ui = new ui; $ui->login($username); } } ?>