Hvad er fejlen ? Header already send ?
Hvad er fejlen i denne kode ?<?php
session_start();
include("db.inc.php");
?>
<html>
<head>
<title>www.MikZe.Dk</title>
<link href="mikze.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table border="0" width="100%" cellspacing="0" cellpadding="0" height="100%">
<tr>
<td width="160" valign="top" style="border-right: 1px solid black"><?php
$res = mysql_query("SELECT * from users where username = '$username'");
session_register("user"); $user = mysql_fetch_array($res);
if($_SESSION['user']['level'] == 1) {
include("loggedin.php");
} else {
include("login.php");
}
?></td>
<td valign="top">
<?php
if($_SESSION['user']['level'] >= 1) {
?>
<script type="text/javascript" language="JavaScript">
function add(url) {
url = url.split("/");
antal = url.length;
antal--;
image = url[antal];
antal--;
image = url[antal]+"/"+image;
document.addnews.pic.value=image;
}
</script>
<script>
function submitForm() {
if (window.event.keyCode == 13) {
document.addnews.submit();
}
}
</script>
<form action="?page=addnews" method="post" name="addnews" id="addnews">
<table width="453" border="0" cellspacing="0" cellpadding="0" class="text1">
<tr>
<td>Brugernavn:</td>
<td><?=$_SESSION['user']['username'];?></td>
</tr>
<tr>
<td>Title:</td>
<td><input name="title" type="text" id="title" class="login"></td>
</tr>
<tr>
<td colspan="2">Besked:</td>
</tr>
<tr>
<td colspan="2"><textarea name="besked" cols="60" rows="10" id="besked" class="login"></textarea></td>
</tr>
<tr>
<tr>
<td colspan="2"><input name="pic" type="text" id="pic" class="login"></td>
</tr>
<td>
<?php
$dir = "images";
$width = "60";
$height = "80";
if ($dh = opendir("$dir")) {
while ($file = readdir($dh)) {
if ($file == "." || $file == ".." || is_dir($file)) continue;
echo "
<center><img src=\"$dir/$file\" style=\"border: 1px solid black; filter:alpha(opacity=10);-moz-opacity:0.8;\" onmouseover=\"if(ie){this.filters.alpha.opacity=100}else{this.style.MozOpacity=1}\" onmouseout=\"if(ie){this.filters.alpha.opacity=10}else{this.style.MozOpacity=0.8}\" onclick=\"add(this.src)\" id=\"pic\" width=\"$width\" height=\"$height\"></img>
";
}
}
?>
</td>
</tr>
<tr>
<td colspan="2"><a href="java script:document.addnews.submit();" class="midt">Opret Nyhed</a></td>
</tr>
</table>
</form>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$besked = $_POST['besked'];
$ip = $_SERVER['REMOTE_ADDR'];
$dato = time();
mysql_query("insert into nyheder (navn, dato, ip, besked, title, pic) values ('$username', '$dato', '$ip', '$besked', '$_POST[title]', '$_POST[pic]')") or die (mysql_error());
HEADER("LOCATION: index.php");
}
} else {
echo "fejl...!!!";
}
?>
</td>
</tr>
</table>
</body>
</html>
???
Der står dette:
Warning: Cannot modify header information - headers already sent by (output started at /home/web/web13697/news/addnyheder.php:15) in /home/web/web13697/news/addnyheder.php on line 101
Hvad mener de ?
