 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
sacadia
Joined: 25 Aug 2008 Posts: 2
|
Posted: Mon Aug 25, 2008 2:27 pm Post subject: Cannt get Auth working - class error |
|
|
I am getting the following error:
Fatal error: Class 'Auth' not found in /hsphere/local/home/sacadia/stampederecruitment.com/admin/xxsr.php on line 33
Can anyone help me!
| Code: |
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set("include_path", "/hsphere/local/home/sacadia/stampederecruitment.com/pear/");
require_once '../pear/PEAR/PEAR.php';
PEAR::setErrorHandling(PEAR_ERROR_DIE);
require_once "../pear/PEAR/Auth/Auth.php";
function loginFunction()
{
/*
* Change the HTML output so that it fits to your
* application.
*/
echo "<form method=\"post\" action=\"xxsr.php?login=1\">";
echo "<input type=\"text\" name=\"username\">";
echo "<input type=\"password\" name=\"password\">";
echo "<input type=\"submit\">";
echo "</form>";
}
if (isset($_GET['login']) && $_GET['login'] == 1) {
$optional = true;
} else {
$optional = false;
}
$options = array(
'dsn' => 'mysql://user:password@host/database',
);
$a = new Auth("MDB2", $options, "loginFunction");
$a->start();
echo "Everybody can see this text!<br />";
if (!isset($_GET['login'])) {
echo "<a href=\"xxsr.php?login=1\">Click here to log in</a>\n";
}
if ($a->getAuth()) {
echo "YOU ARE LOGGED IN!";
} else {
echo 'I am not logged in';
echo '<br>'.$_GET['login'];
}
?>
|
Thanks
Stephen
Tuckerplace aatt hotmail doot com |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1053
|
Posted: Mon Aug 25, 2008 5:00 pm Post subject: |
|
|
Did you search the archives about error handling? I know the first lines of your code very good.
Anyway, I see two problems:
- PEAR.php seems to be in a directory named "PEAR" which is inside the directory that is specified in the include_path => you could append "PEAR/" to the include_path
- the require_once calls shouldn't contain that much path information => you should shorten them to just 'PEAR.php' and 'Auth/Auth.php' (this requires a correct include_path setting, of course) |
|
| Back to top |
|
 |
sacadia
Joined: 25 Aug 2008 Posts: 2
|
Posted: Mon Aug 25, 2008 7:03 pm Post subject: Seems so different to the way I have been coding |
|
|
But it works.
Thanks |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|