For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > April 2004 > RE: [PEAR] Auth problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author RE: [PEAR] Auth problem
Vincent Dupont

2004-04-21, 8:41 am

Hi,

did you try to rename your 'loginFunction()' into something other, like =
'loginForm()'

then you must also change the statement where you instanciate the Auth =
class :
$a =3D new Auth("DB", $dsn, "loginForm");

Vincent

-----Original Message-----
From: lists [mailto:lists@pardel.net]
Sent: mercredi 21 avril 2004 11:22
To: pear-general@lists.php.net
Subject: [PEAR] Auth problem


Hello ,
When trying the example for Auth:

<?php
require_once "Auth/Auth.php";

function loginFunction()
{
/**
* Change the HTML output so that it fits to your
* application.
*/
echo "<form method=3D\"post\" action=3D\"" . $_SERVER['PHP_SELF'] . =
"\">";
echo "<input type=3D\"text\" name=3D\"username\">";
echo "<input type=3D\"password\" name=3D\"password\">";
echo "<input type=3D\"submit\">";
echo "</form>";
}

$dsn =3D "mysql://user:password@localhost/database";
$a =3D new Auth("DB", $dsn, "loginFunction");

$a->start();

if ($a->getAuth()) {
/**
* The output of your site goes here.
*/
}
?>

I got the following error:

Fatal error: Cannot redeclare loginfunction() (previously declared in =
D:\MyWork\WebServer\auth.php:10) in D:\MyWork\WebServer\Auth.php on line =
4

Can anyone advise on this?
Thank you!
Paul

--=20
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Stephan Wentz

2004-04-22, 6:34 am

lists wrote:

> require_once "Auth/Auth.php";


> Fatal error: Cannot redeclare loginfunction() (previously declared in D:\MyWork\WebServer\auth.php:10) in D:\MyWork\WebServer\Auth.php on line 4


trivial: rename you file auth.php to something else and try again.
Auth has moved it's main file from <pear>/Auth/Auth.php to
<pear>/Auth.php, the file Auth/Auth.php requires Auth.php for this to
work. and windows doesn't differ between auth.php and Auth.php, so
Auth/Auth.php includes your file again, and this redeclares the function :)

so you have to rename your file, and you can change the require_once-line to
require_once "Auth.php";

stephan
Paul

2004-04-22, 8:34 am

Hi!
Does anyone have any working example on Auth?
Paul
Rogue

2004-04-22, 9:35 am

I used the example in the pear docs to get started.

http://pear.php.net/manual/en/packa...hentication.php


On Apr 22, 2004, at 5:29 AM, Paul wrote:

> Hi!
> Does anyone have any working example on Auth?
> Paul
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com