<?
session_start();
?>
<html>
<head>
<body>
<link rel="stylesheet" type="text/css" href="style.css">
<?
include('forb.php');
$q2 = mysql_query("select * from brugere where brugernavn = '$_SESSION[Brugernavn]'");
$se = mysql_fetch_array($q2);
if($se[online] !== "ja"){
print " ";
}else{
include("menu.php");
}
$connect = mysql_query("SELECT * FROM debat WHERE id = '$_GET[id]'") or die(mysql_error());
while($vis = mysql_fetch_array($connect)) {
?>
<div align="left">
<b><? echo "$vis[emne]"; ?><br><br></b>
<?php
$nyhed = $vis[beskrivelse];
$nyhed = str_replace("\n","<br>",$nyhed);

echo $nyhed;
?><br><br>
Startet d.<? echo "$vis[dato]"; ?> Af <a href=profil.php?b=<? echo "$vis[opret_af]";?>><? echo "$vis[opret_af]";?></a>
      <td width="163" height="1" align="right"></td>
    </tr>
  </table>
</div><hr>
<?
}
?>
<?
include("forb.php");
$q2 = mysql_query("select * from brugere where brugernavn = '$_SESSION[Brugernavn]'");
$se = mysql_fetch_array($q2);
if($se[online] !== "ja"){
print "Du skal være logget på for at kunne kommentere :-)";
}else{
print "
<form action=gem_debat_kommentar.php?id=$_GET[id] method=POST>
Kommentar:<br>
<input type='text' name='kommentar'><br>
<input type=submit value=Kommenter>
";
}
?><hr>
<html>
<head>
<body>
<link rel="stylesheet" type="text/css" href="style.css">
<?
include('forb.php');
$connect = mysql_query("SELECT * FROM debat_kommentar WHERE t_id = '$_GET[id]' ORDER by id DESC") or die(mysql_error());
while($vis = mysql_fetch_array($connect)) {
?>
<b><a href=profil.php?b=<? echo "$vis[af]";?>><? echo "$vis[af]";?></a></b> - d.<? echo "$vis[dato]";?>
<?php
$q1 = mysql_query("SELECT * FROM brugere WHERE brugernavn = '$_SESSION[Brugernavn]'");
$se = mysql_fetch_array($q1);
if($se[slet_debat_k] == '1'){
print "
 - <a href=slet_k.php?id=$vis[id]>Slet kommentar</a>";
}
?><br>
<? echo "$vis[kommentar]";?><hr>
<?
}
?>
<?php
$q1 = mysql_query("SELECT * FROM brugere WHERE brugernavn = '$_SESSION[Brugernavn]'");
$se = mysql_fetch_array($q1);
if($se[lock_debat] == '1'){
print "
<a href=lock_debat.php?id=$_GET[id]>Lås debatten</a><br>";
}
if($se[slet_debat] == '1'){
print "
<a href=slet_debat.php?id=$_GET[id]>Slet debatten</a>";
}
?>
</html>
</head>
</body>