This script worked before.. but I ran into some problems with DreamWeaver and I ended up (Control-Z) Undoing everything and it didnt work again
The script below is supposed to log someone in and give thme a message accoridng to thier level of useage and also assign Sessions but right now.. I have 5 users in db, and I tried ti login as a level 1 user which is admin and it gave me a pure blank page
then I tried level 2 and it gave me the login failure page.. theres no errors, just its not working right
Someone help please
<?php
session_start();
header("Cache-control: private");
$db = mysql_connect(***********);
mysql_select_db("news",$db);
$name = addslashes($_POST['username']);
$db_pass = md5($_POST['password']);
$sql = "SELECT ID FROM user WHERE Name= '$name' AND Password= '$db_pass' LIMIT 1";
$result = mysql_query($sql);
$data_lev = mysql_fetch_array( $result );
if(mysql_num_rows($result) == 1)
{
if($data_lev['level'] == 1)
{
$_SESSION['name'] = $name;
$_SESSION['level'] = 1;
echo "Logged In, You will be redirected to Admin Page in 3 Seconds<br>";
echo "<meta http-equiv=\"refresh\" content=\"3; url=./admin/\" />\n";
}
if($data_lev['level'] == 2)
{
$_SESSION['name'] = $name;
$_SESSION['level'] = 2;
echo "You have been logged in as a Regular User, You will be directed";
echo "<meta http-equiv=\"refresh\" content=\"3; url=./index.php\" />\n";
}
else {
echo "Login failure<br>";
echo "<meta http-equiv=\"refresh\" content=\"3; url=login.html\" />\n";
exit;
}
}
?>