Dayo
01-10-2009, 02:49 PM
look thro this script is this correct, this is my 1st script made my self from scratch, i cant test atm as my ftp details are on my comp
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Member Index</title>
<link href="loginmodule.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
//Include database connection details
require_once('config.php');
//Connect to mysql server
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if(!$link) {
die('Failed to connect to server: ' . mysql_error());
}
//Select database
$db = mysql_select_db(DB_DATABASE);
if(!$db) {
die("Unable to select database");
}
//Create query
$qry="SELECT * FROM members WHERE level='$level'.";
$result=mysql_query($qry);
//************User level acsess************
//Admin
if($level==1){
header("location:admin/index.php");
}
//member
if($level==4){
header("location:member/index.php");
}
//VIP
if($level==3){
header("location:member/vipindex.php");
}
else {
echo "Wrong Username or Password";
}
?>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Member Index</title>
<link href="loginmodule.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
//Include database connection details
require_once('config.php');
//Connect to mysql server
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if(!$link) {
die('Failed to connect to server: ' . mysql_error());
}
//Select database
$db = mysql_select_db(DB_DATABASE);
if(!$db) {
die("Unable to select database");
}
//Create query
$qry="SELECT * FROM members WHERE level='$level'.";
$result=mysql_query($qry);
//************User level acsess************
//Admin
if($level==1){
header("location:admin/index.php");
}
//member
if($level==4){
header("location:member/index.php");
}
//VIP
if($level==3){
header("location:member/vipindex.php");
}
else {
echo "Wrong Username or Password";
}
?>
</body>
</html>