Hello,
I have a very small login script that I feel is kind of a mess. I would like to clean it up and do it the correct way. My script is posted below. I would like to have some help in understanding what members, if any I should declare.
[PHP]class Login
{
function Login($account, $operator,$pass word)
{
}
function getUser()
{
ob_start();
if(isset($accou nt) && ($operator) && ($password))
{
$password = md5($password);
require_once("d atabase.php");
$db = new Database();
$result = $db->query("");
$count = $db->count();
if ($count == 1)
{
foreach($result as $key)
{
$level = $key['level'];
$name = $key['last_name'];
}
$_SESSION['name'] = $name;
$_SESSION['user'] = $user;
$_SESSION['level'] = $level;
header("locatio n:index.php?id= 6");
}
else
{
header("locatio n:index.php?id= 1");
}
}
ob_end_flush();
}
}[/PHP]
I have a very small login script that I feel is kind of a mess. I would like to clean it up and do it the correct way. My script is posted below. I would like to have some help in understanding what members, if any I should declare.
[PHP]class Login
{
function Login($account, $operator,$pass word)
{
}
function getUser()
{
ob_start();
if(isset($accou nt) && ($operator) && ($password))
{
$password = md5($password);
require_once("d atabase.php");
$db = new Database();
$result = $db->query("");
$count = $db->count();
if ($count == 1)
{
foreach($result as $key)
{
$level = $key['level'];
$name = $key['last_name'];
}
$_SESSION['name'] = $name;
$_SESSION['user'] = $user;
$_SESSION['level'] = $level;
header("locatio n:index.php?id= 6");
}
else
{
header("locatio n:index.php?id= 1");
}
}
ob_end_flush();
}
}[/PHP]
Comment