|
function connect() {
if(!$db = @mysql_pconnect("localhost","root","janganmasuk")){
print("Cannot Connect to the DB!\n");
return 0;
} else {
mysql_select_db("iix", $db);
return 1;
}
}
function check_user($user, $password) {
if(connect()) {
$password = md5($password);
$sql = "select * from user_auth where user_name = '$user' and passwd = '$password'";
$result = mysql_query($sql);
if (mysql_num_rows($result) == 1) {
//setcookie("user", $user, time()+5);
return 1;
} else {
?>
Sorry, you are not authorized!
return 0;
}
}
}
/***** MAIN *****/
if(!isset($user) or !check_user($user, $password)) {
?>
You must log in to view this page!
} else {
?>
echo "IIX JK2
";
echo "";
include("header.noc.php");
$namadb = "iix";
$namatabel = "apjii_iix_jk2";
$connect = mysql_connect("localhost","root","janganmasuk") or die(mysql_error());
$select_db = mysql_select_db($namadb,$connect) or die(mysql_error());
$sql = "SELECT no, namaisp, asn, online, phone, fax, admin, email FROM $namatabel ORDER BY no";
$result = mysql_query($sql,$connect) or die(mysql_error());
//Tampilkan database di website
while ($data = mysql_fetch_row($result)) {
echo ("$data[0] | $data[1] | $data[2] | $data[3] | $data[4] | $data[5] | $data[6] | $data[7] | "); }
echo " ";
?>
}
?>
|
|