AW: [PEAR] Problems with Auth
| From: | Markus | Date: | Sat, 17 Aug 2002 09:45:15 +0000 |
| Subject: | AW: [PEAR] Problems with Auth | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-2144@lists.php.net to get a copy of this message | ||
Thank you very much for your help.
Your answer helped me, but it didn't solve all my problems.
On the second page the server doesn't remember that I just logged in.
So it still wants me to relogin.
I don't understand why. May it be a a problem with the configuration of
the php.ini?
Markus
-----Ursprüngliche Nachricht-----
Von: Alan Morey [mailto:alan@caint.com]
Gesendet: Freitag, 16. August 2002 12:19
An: Markus
Cc: pj@php.net; pear-general@lists.php.net
Betreff: Re: [PEAR] Problems with Auth
You will need to create the auth object on each page.
If you create one include file that gets included on each page
that will take care of Auth for all your pages.
Example for include file
<?php
require_once 'Auth/Auth.php';
// set options
$options = array(
'dsn' => 'mysql://test:test@localhost/test',
'table' => 'users',
'usernamecol' => 'username',
'passwordcol' => 'password'
);
// define login form function
function myloginform( $username ) {
global $PHP_SELF;
echo "<form method=\"post\" action=\"" . $PHP_SELF .
"\"><br>";
echo "<input type=\"text\" name=\"username\"><br>";
echo "<input type=\"password\"
name=\"password\"><br>";
echo "<input type=\"submit\">";
echo "</form>";
}
// create auth object
$myauth = new Auth( "DB", $options, 'myloginform', true);
// start auth session
$myauth->start(); // This also calls session_start()
?>
Each file will now have $myauth object created providing you
include the file at the start of each file.
hope this helps
alan
--
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php