using Auth.php
| From: | David Dahl | Date: | Mon, 18 Feb 2002 05:06:23 +0000 |
| Subject: | using Auth.php | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-863@lists.php.net to get a copy of this message | ||
hi:
I am new to Pear, and would like to subclass Auth to handle authentication...
I have taken the example scripts from the Auth docs on pear.php.net and am trying to write new classes that I can understand to create a simple, useful authentication class.
Here is what I have managed to screw up so far (all i get is a 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(
"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); } } ?> ======index.php===== <?php require_once 'DB.php'; require_once'Auth/Auth.php'; require_once("classes/ui.class.php"); require_once("classes/security.class.php"); $a = new security("DB", $params, "login_screen"); $a->start(); if ($a->getAuth()) {
echo "You have been authenticated successfully.";} else { //whoops, no good } //check for logged in user otherwise show login screen ?> ======== also: I am using MacOS X 10.1 for development, and Auth.php was not included in the distro. I also downloaded the PHP source and once expanded, noticed the Auth.php is not in the "pear" directory. I grabbed the source from cvs, and found the Auth directory, I put in it into my /System/Library/PHP folder. Is this the right way to install Pear? including Auth, etc... TIA, David Dahl ddahl.com, inc Chicago