This is my current authentication page (login.php)
<?php
#Auth_HTTP returns additional information about the user
//include login details
require_once('db_login.php');
//include authentication page
require_once('Auth/HTTP.php');
//include header templates page
require_once('config.php');
// We use the same connection string as the pear DB functions
$AuthOptions = array(
'dsn' =>"mysql://$db_username:$db_password@$db_hostname/$db_database",
'table' => "users",//table name
'uernamecol' => "username", //table username column
'password' => "password", //table password column
'crypttype' => "MD5", //password encryption type in db
'db_fields' =>"*" //enabling fetch for other db columns
);
$authenticate = new Auth_HTTP("DB", $AuthOptions);
// set the realm name
$authenticate->setRealm('Member Area');
// authentication failed error message
$authenticate->setCancelText('<h2>Access Denied</h2>');
// request authentication
$authenticate->start( );
// compare username and password to stored values
if ($authenticate->getAuth( ))
{
$smarty->assign('blog_title',$blog_title);
$smarty->display('header.tpl');
//setup session variable
$_SESSION['username'] = $authenticate->username;
$_SESSION['first_name'] = $authenticate->getAuthData('first_name');
$_SESSION['last_name'] = $authenticate->getAuthData('last_name');
$_SESSION['user_id'] = $authenticate->getAuthData('user_id');
echo "Login successful. Great to see you ";
echo $authenticate->getAuthData('first_name');
echo " ";
echo $authenticate->getAuthData('last_name').".<br />";
$smarty->display('footer.tpl');
}
?>
And this is my smarty template page (config. php). It's included in the login.php page as require_once('config.php');
<?php
// put full path to Smarty.class.php
require('c:\xampp\smarty\libs\Smarty.class.php');
$smarty = new Smarty();
$smarty->template_dir = 'C:/xampp/htdocs/Smarty/templates';
$smarty->config_dir = 'C:/xampp/htdocs/Smarty/configs';
$smarty->cache_dir = 'C:/xampp/Smarty/cache';
$smarty->compile_dir = 'C:/xampp/Smarty/templates_c';
$smarty->assign('blog_title','Coffee Talk Blog');
$smarty->assign('index','Developer Programme');
$smarty->assign('loop','Enter into Forums');
$smarty->assign('date',12,3,2011);
$smarty->display('header.tpl');
$smarty->display('footer.tpl');
?>
Now this is the current error message:
Fatal error: Class 'Auth_HTTP' not found in C:\xampp\htdocs\OReilly\pear\blog\login.php on line 23
Hope this clarifies your question.