"" && trim($_POST['user_pass']) <> "") {
$user_name = $_POST['user_name'];
$result = mysql_query("SELECT user_id, user_pass, user_level, user_displayname, user_mac, user_lang FROM user WHERE user_name='$user_name'") or die(mysql_error());
if(mysql_num_rows($result) > 0) {
if(!strcmp(md5($_POST['user_pass']), mysql_result($result, 0, "user_pass"))) {
// all ok, user logged in
$_SESSION['suser_id'] = mysql_result($result, 0, "user_id");
$_SESSION['suser_level'] = mysql_result($result, 0, "user_level");
$_SESSION['suser_displayname'] = mysql_result($result, 0, "user_displayname");
$_SESSION['suser_mac'] = mysql_result($result, 0, "user_mac");
$_SESSION['suser_lang'] = mysql_result($result, 0, "user_lang");
header("Location: index.php");
} else {
// not ok, break session
$_SESSION = array();
session_destroy();
}
// clear mysql-result
mysql_free_result($result);
}
}
echo 'Error!';
}
?>
IP Reg |