<center><font color="#C0C0C0" size="2" face="verdana, arial">
<h1><font color="#000000">News Eintrag hinzufügen</font></h1><P>
<br>
<hr noshade size=2 width=50% COLOR="5D5D5D"><p>
<?php
if (! empty($del)) {
$sql = "DELETE FROM $news_table_name WHERE id = '$del'";
mysql_db_query($db, $sql, $link);
print "<b><font colour=\"#FF6600\">Status: Deleted news post with id $del.</b></font>";
} elseif (strcmp($iaction, "Edit")==0) {
$sql = "UPDATE $news_table_name SET topic = '$itopic', item = '$iitem' WHERE id = '$iid'";
$result = mysql_query($sql);
print "<b><font colour=\"#FF6600\">Status: Edit Successful.</b></font>";
} elseif (!empty($iname) && !empty($itopic) && strcmp($iaction, "Post")==0) {
$idate = date("d/m/y");
$sql = "INSERT INTO $news_table_name (topic, date, item, poster) " .
"VALUES('$itopic', '$idate', '$ipost', '$iname')";
$result = mysql_query($sql);
print "<b><font colour=\"#FF6600\">Status: Update Successful. - $result</b></font>";
}
?>
<form method="POST" action="news.php">
<font color="#000000"><b>Name: </b></font><b><font size=+1 color=#FF6600>
<?php
$usery = ucfirst(strtolower($REMOTE_USER));
if (!empty($usery)) {
print $usery;
print "<input type=\"hidden\" name=\"iname\" value=\"" . $usery . "\">";
} else {
print "<input type=text name=\"iname\" value=\"" . $session->username . "\">";
}
?>
</font></b>
<b><font color="#ffffff">Topic:</font></b>
<input type=text name="itopic" width=40 value="" AUTOCOMPLETE="off">
<p>
<b><font color="#000000">Post:</font></b><p>
<textarea name="ipost" rows="14" cols="70" wrap="virtual"></textarea>
<p>
<input type=submit name="iaction" value="Post">
</form></center>
<?php
if (! isset($news_index) ) {
$news_index = 0;
}
$sql = "SELECT * FROM $news_table_name ORDER BY id DESC LIMIT $news_index, $news_item_count";
$result = mysql_query($sql);
$row = mysql_num_rows($result);
$i = 0;
while ($i < $row) {
$i = $i + 1;
$temp = mysql_data_seek($result, ($i - 1));
$myrow = mysql_fetch_array($result);
$id = stripslashes($myrow["id"]);
$topic = stripslashes($myrow["topic"]);
$date = stripslashes($myrow["date"]);
$item = nl2br(stripslashes($myrow["item"]));
$poster = stripslashes($myrow["poster"]);
echo "<table border=1 bordercolor=4c4c4c width=100% cellpadding=0 cellspacing=0 >
<tr bgcolor=\"#ffffff\">
<td rowspan=2 > <font class='faqausgabeueberschirft'><b> $topic </td>
<td width=20% align=right rowspan=1> <font class='faqausgabeauthor'><b>Author $poster</td>
</tr>
<tr>
<td width=20% align=right rowspan=1>
<a href=\"edit-news.php?id=$id\"><font color=\"#FF0000\" size=-2><b>Edit</a>
- <a href=\"news.php?del=$id\"><font color=\"#FF0000\" size=-2><b>Delete</a>
</td>
</tr>
</tr>
</table><table><td class='faqausgabetext'><p>$item<p></td></table>";
}
?>
</td>
</tr>
</table>
<?php
index_navigation($news_index, $news_item_count, $row);
?>
<hr noshade size=2>