Auth_HTTP problem
| From: | zaphod at s4r dot de | Date: | Fri, 07 Feb 2003 14:34:19 +0000 |
| Subject: | Auth_HTTP problem | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-3646@lists.php.net to get a copy of this message | ||
Hi,
following you find some code which worked with Auth. Now I changed it to
Auth_HTTP and it does not work anymore (the login fails). I only changed
two lines where the old are commented with ##.
I do not see the problem. Unfortunately the documentation is not quite
helpful.
Regards
Thomas
------------------------------------------------------------------
<?php
## require_once "Auth/Auth.php";
require_once "Auth_HTTP/Auth_HTTP.php";
define(DSN,"mysql://sp:sp@localhost/demo");
function loginFunction()
{
/**
* Change the HTML output so that it fits to your
* application.
*/
echo "<form method=\"post\" action=\"" .
$_SERVER['PHP_SELF'] . "\">";
echo "Username: <input type=\"text\"
name=\"username\"><br>";
echo "Passwort: <input type=\"password\"
name=\"password\"><br>";
echo "<input type=\"submit\">";
echo "</form>";
}
$params = array(
"dsn" => DSN,
"table" => "Respondents",
"usernamecol" => "Username",
"passwordcol" => "Password"
);
## $a = new Auth("DB", $params, "loginFunction");
$a = new Auth_HTTP("DB", $params);
$a->start();
if ($a->getAuth()) {
echo "You have been authenticated successfully.";
echo "<br>Welcome user ".$a->getUsername()."!<br />\n";
}
else{
echo "LOGIN ERROR";
}
?>