Hele loginsiden:
<? session_start();
if (isset($_COOKIE['user'])) {
$user = $_COOKIE['user'];
setcookie ("user", $user, time()+60*60*24*365);
require 'db.php';
$res = mysql_query("SELECT status FROM brugere WHERE bruger = '$user'") or die(mysql_error());
if (mysql_num_rows($res) == 1) {
$_SESSION['status'] = mysql_result($res,0);
$_SESSION['bruger'] = $user;
header('Location: ./');
}
}elseif (isset($_POST['send'])) {
$bruger = $_POST['bruger'];
$pass = md5($_POST['pass']);
require 'db.php';
$res = mysql_query("SELECT status FROM brugere WHERE bruger = '$bruger' AND pass = '$pass'") or die(mysql_error());
if (mysql_num_rows($res) == 1) {
setcookie ("user", $bruger, time()+60*60*24*365);
$_SESSION['status'] = mysql_result($res,0);
$_SESSION['bruger'] = $bruger;
header('Location: ./');
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "
http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="
http://www.w3.org/1999/xhtml"><head>
<title>Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="buks.css" rel="stylesheet" type="text/css" />
</head>
<body class="bag">
<table class="tab">
<tr>
<td>
<?
include ('top_menu.php');
include ('left_menu.php');
include ('right_menu.php');
?>
<div class="center" align="center">
<p class="over"><br />Login<br /></p>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<table class="tableft">
<tr class="tableft">
<td class="tabright">Bruger:</td>
<td><input name="bruger" type="text" size="25" /></td>
</tr>
<tr class="tableft">
<td class="tabright">Password:</td>
<td><input name="pass" type="password" size="25" /></td>
</tr>
<tr>
<td></td><td><input name="send" type="submit" value="Fyr den af!" /></td>
</tr>
</table>
</form>
</div>
</td>
</tr>
</table>
</body>
</html>