Hi all!
I want to write a admin UI in Smarty but there are some problems. I don't know how to create a site that requires a username, passwd, compares to the data stored in mysql and if it's ok creates a logedin session.
I tried like that:
PHP Code:
include('admin.lib.php');
$admin = new Smarty_admin();
$conn = &NewADOConnection('mysql');
$conn->PConnect('localhost','root','','gasztrostudio');
if(!isset($_SESSION['logedin'])){
$r = $conn->Execute("SELECT * FROM adminok WHERE uname = '".$_POST['uname']."' AND passwd = '".$_POST['passwd']."'");
$res=$r->GetArray();
if(empty($res)){
$admin->display('login.tpl');
}else{
$admin->display('admin_index.tpl');
$_SESSION['logedin']=true;
}
}
After reloading the page the login window pops up. I use Apache 2 with PHP5
Dani