kk....
gmn script/mengambil data untuk login dari 2 table yg berbeda ???
script
<?php
session_start();
include ("../config/conek_db.php");
//ngecek suapaya tdk ada karakter koma,kutip dll
$user_name = mysql_real_escape_string($_POST['user_name']);
$password = mysql_real_escape_string($_POST['password']);
$passwordhash = md5($password); // mengenkripsikannya untuk dicocokan dengan database
// query login
$query = "select user_name, password from admin where user_name = '$user_name' and password = '$passwordhash'";
$jalan = mysql_query($query);
if($jalan==1){ session_register("user_name","password");
if($jalan=="10")
{
header("location:../home.php");
}
else
{
header("location:index.php");
}
}
else{
header("index.php");
}
$cek = mysql_num_rows($jalan);
if(($user_name == "") && ($password == ""))
{
print "<center>Anda belum memasukkan USERNAME dan PASSWORD! <br> <a href=../admin/index.php><font color=blue>Back to home</a>";
exit;
}
if ($cek >= 1 )
{
$_SESSION['user_name'] = $user_name;
header ('location:../home.php');
}
else
{ echo "<link href='css/admin_style.css' rel='stylesheet' type='text/css'>
<div id='wrapper-login-validate'><div id='wrapper-login-validate-header'>
<div id='wrapper-login-validate-text'><center>Username dan Password Salah, Silahkan Ulangi Kembali<br>";
echo "<a href=../index.php><b>LOGIN</b></a></center></div></div></div>";
}
?>