Disini proses loogin menggunakan session, yaitu system akan melihat id user serta password user, selama dia valid dalam proses login maka dia akan bisa melanjutkan proses selanjutnya. Disini session dibedakan atas tiga user yaitu konsumen, admin serta managerial.
session_start();
include ("open-db.inc");
if ($rec=mysql_fetch_array(mysql_query("SELECT * FROM admin WHERE id_admin='$admin' AND pass = '$pass'"))) {
if (($rec['id_admin']==$admin)&&($rec['pass']==$pass))
{ $_SESSION['id']=session_id();
$_SESSION['userid']=$admin;
$_SESSION['nama']=$nama;
echo "
Log OUT
Klik Disini
print "";
}
}
else
//login admin
if($rec=mysql_fetch_array(mysql_query("SELECT * FROM konsumen WHERE id_konsumen='$admin' AND pass = '$pass'")))
{
if(($rec['id_konsumen']==$admin)&&($rec['pass']==$pass))
{
$_SESSION['id']=session_id();
$_SESSION['pegawai']=$admin;
$_SESSION['nama']=$nama;
echo "
Log OUT
Click here if your browser is not redirecting automatically or you don't want to wait.
print "";
}
}
else
//login admin
if($rec=mysql_fetch_array(mysql_query("SELECT * FROM managerial WHERE id_manager='$admin' AND pass = '$pass'")))
{
if(($rec['id_manager']==$admin)&&($rec['pass']==$pass))
{
$_SESSION['id']=session_id();
$_SESSION['pegawai']=$admin;
$_SESSION['nama']=$nama;
echo "
Log OUT
Click here if your browser is not redirecting automatically or you don't want to wait.
print "";
}
}
else
{
include ("salah.php");
}
?>
2.Dession tree
Tidak ada komentar:
Posting Komentar