engelsystem/www-ssl/nonpublic/news_comments.php

86 lines
2.0 KiB
PHP
Raw Normal View History

<?php
$title = "Kommentare zu den News";
$header = "Kommentar";
include ("../../../camp2011/includes/header.php");
2011-06-01 12:13:39 +02:00
if(isset($_GET["nid"])) {
if(isset( $_GET["text"])) {
$ch_sql = "INSERT INTO `news_comments` (`Refid`, `Datum`, `Text`, `UID`) ".
"VALUES ('". $_GET["nid"]. "', '". date("Y-m-d H:i:s"). "', '". $_GET["text"]. "', '". $_SESSION["UID"]. "')";
$Erg = mysql_query($ch_sql, $con);
2011-06-01 12:13:39 +02:00
if ($Erg == 1) {
echo "Eintrag wurde gespeichert<br /><br />";
SetHeaderGo2Back();
}
}
2011-06-01 12:13:39 +02:00
$SQL = "SELECT * FROM `news_comments` WHERE `Refid`='". $_GET["nid"]. "' ORDER BY 'ID'";
$Erg = mysql_query($SQL, $con);
echo mysql_error( $con);
2011-06-01 12:13:39 +02:00
// anzahl zeilen
$news_rows = mysql_num_rows($Erg);
?>
2011-06-01 12:13:39 +02:00
<table border="0" width="100%" class="border" cellpadding="2" cellspacing="1">
2011-06-01 12:13:39 +02:00
<tr class="contenttopic">
<th width=100 align="left">Datum</th>
<th align="left">Nick</th>
</tr>
<tr class="contenttopic">
<th align="left" colspan=2>Kommentar</th>
</tr>
2011-06-01 12:13:39 +02:00
<?php
for ($n = 0 ; $n < $news_rows ; $n++) {
echo "\t<tr class=\"content\">";
echo "\t\t<td width=100>";
2011-06-01 12:13:39 +02:00
echo mysql_result($Erg, $n, "Datum");
echo "\t\t</td>";
echo "\t\t<td>";
2011-06-01 12:13:39 +02:00
echo UID2Nick(mysql_result($Erg, $n, "UID"));
// avatar anzeigen?
echo DisplayAvatar (mysql_result($Erg, $n, "UID"));
echo "\t\t</td>";
echo "</tr>";
echo "\t<tr class=\"content\">";
echo "\t\t<td colspan=\"2\">";
2011-06-01 12:13:39 +02:00
echo nl2br(mysql_result($Erg, $n, "Text"))."\n";
echo "\t\t</td>";
echo "</tr>";
}
echo "</table>";
?>
2011-06-01 12:13:39 +02:00
<br />
<hr>
<h4>Neuer Kommentar:</h4>
<a name="Neu">&nbsp;</a>
<form action="./news_comments.php" method="GET">
2011-06-01 12:13:39 +02:00
<input type="hidden" name="nid" value="<?php echo $_GET["nid"]; ?>">
<table>
<tr>
<td align="right" valign="top">Text:</td>
<td><textarea name="text" cols="50" rows="10"></textarea></td>
</tr>
</table>
2011-06-01 12:13:39 +02:00
<br />
<input type="submit" value="sichern...">
</form>
2011-06-01 12:13:39 +02:00
<?php
}
else
{
echo "Fehlerhafter Aufruf!";
}
include ("../../../camp2011/includes/footer.php");
?>