Thanks,
eViL X
Table Layout:
3Rows - 1 Colum
<?
include "config.php";
if (isset($_GET['del']) && $profile[username] != "") {
$del = $_GET['del'];
$query = "DELETE FROM news_comments WHERE id='$del'";
mysql_query($query);
}
if (!isset($_GET['oid'])) {
$query = "SELECT * FROM news ORDER BY id DESC LIMIT $frontpagelimit";
}
else {
$query = "SELECT * FROM news WHERE id='$oid'";
}
$result = mysql_query($query);
while($r=mysql_fetch_array($result))
{
if ($news) {
echo '<table border="0" style="border-top: 1px dashed silver" cellpadding="0" cellspacing="0" width="75%">
<tr>
<td></td>
</tr>
</table>';
}
$news = TRUE;
echo "$r[title]<br>";
$body = wordwrap($r[newsbody], 115, "\n", 1);
$body = bbcode(nl2br("$body"));
if (!isset($_GET['oid'])) {
$newname = substr($body,0,$stripnews);
if ($newname != $body) {
$newname .= '<br><a href="?oid='.$r[id].'">[Full Story]</a>';
}
$body = "$newname";
}
$writtendate = date("dS F Y ", $r[time]);
echo ''.$body.'';
$totalcomments = mysql_result(mysql_query("SELECT COUNT(id) FROM news_comments WHERE oid='$r[id]'"),0);
echo '<br><br>Posted By <a href="'.$posterwebsite.'" target="_blank">'.$r[username].'</a> On '.$writtendate.'';
if (!isset($_GET['oid'])) {
echo ', <a href="?oid='.$r[id].'">Comments ('.$totalcomments.')</a>';
}
if ($profile[username] != "") {
echo '<br><a href="admin.php?act=edit&uid='.$r[id].'">Edit?</a> / <a href="admin.php?act=remove&uid='.$r[id].'">Remove?</a>';
}
}
if (!$news) {
echo "Error<br>";
echo 'All The News Posts Were Removed';
if ($profile[username] != "") {
echo ' | <a href="admin.php?act=post">Post News?</a>';
}
}
elseif ($_GET['oid'] != "") {
if (isset($_POST['postcomment'])) {
$s1 = stripslashes(strip_tags(htmlspecialchars($_POST['s1'], ENT_QUOTES)));
$s2 = stripslashes(strip_tags(htmlspecialchars($_POST['s2'], ENT_QUOTES)));
$s3 = striplink(stripslashes(strip_tags(htmlspecialchars($_POST['s3'], ENT_QUOTES))));
$s4 = strip_tags(htmlspecialchars($_POST['s4'], ENT_QUOTES));
$spam_mins = "60";
$spam_mins = round($spam_mins * 60);
$spam_timeout = $time-$spam_mins;
$iscommentspam = mysql_result(mysql_query("SELECT COUNT(id) FROM news_comments WHERE time>$spam_timeout AND oid='$oid' AND ip='$ip'"),0);
if ($iscommentspam < "3") {
if (!is_member($s1) || $profile[username] != "" && $s1 == $profile[username]) {
if (substr_count("$s3", ".") != "0" && $s3 != "http://" || $s3 == "http://") {
if (substr_count("$s2", "@") == 1 && substr_count("$s2", ".") == 1 && $s2 != "" || $s2 == "") {
if (!empty($s4)) {
if (!empty($s1)) {
$query = "INSERT INTO news_comments (username, time, ip, oid, message, website, email)
VALUES ('$s1','$time','$ip','$oid','$s4','$s3','$s2')";
mysql_query($query);
}
}
}
}
}
}
unset($error);
$error = "";
if (empty($s1)) {
$error = "Invalid Name\n";
}
if (is_member($s1) && $profile[username] == "") {
$error .= "That Username Is Taken By an Admin\n";
}
if (substr_count("$s3", ".") == "0" && $s3 != "http://") {
$error .= "Invalid Website\n";
}
if (substr_count("$s2", "@") != 1 && $s2 != "" || substr_count("$s2", ".") != 1 && $s2 != "") {
$error .= "Invalid Email\n";
}
if (empty($s4)) {
$error .= "No Message\n";
}
if ($iscommentspam == "3") {
$error .= "Your Spamming, Stop!";
}
if (!empty($error)) {
echo '<table border="0" style="border-top: 1px dashed silver" cellpadding="0" cellspacing="0" width="75%">
<tr>
<td></td>
</tr>
</table>';
echo "Error<br>";
$error = nl2br($error);
echo ''.$error.'';
}
}
echo '<table border="0" style="border-top: 1px dashed silver" cellpadding="0" cellspacing="0" width="75%">
<tr>
<td></td>
</tr>
</table>';
echo "Comments<br>";
$total = mysql_result(mysql_query("SELECT COUNT(id) FROM news_comments WHERE oid='$oid'"),0);
$numofpages = $total / $compp;
if (!isset($_GET['page'])) {
$page = 1;
}
else {
$page = $_GET['page'];
}
$limitvalue = $page * $compp - ($compp);
$query = "SELECT * FROM news_comments WHERE oid='$oid' ORDER by id DESC LIMIT $limitvalue, $compp";
$result = mysql_query($query);
while($r=mysql_fetch_array($result))
{
if ($comments) {
echo '<br><br>';
}
$comments = TRUE;
$message = wordwrap($r[message], 115, "\n", 1);
$postdate = date("D M d, Y H:i", $r[time]);
if ($r[email] != "") {
echo '<a href="java script:alert(\''.$r[email].'\')" title="'.$r[username].' Replied On '.$postdate.'">@</a>';
}
if ($r[website] != "http://") {
echo '<a href="'.$r[website].'" target="_blank" title="'.$r[username].' Replied On '.$postdate.'">';
}
echo ''.$r[username].'';
if ($r[website] != "http://") {
echo '</a>';
}
$newname = substr($message,0,150);
if ($newname != $message) {
$newname .= ".....";
}
$message = bbcode("$newname");
if ($profile[username] != "") {
echo '<a href="?oid='.$oid.'&del='.$r[id].'" title="'.$r[username].' Replied On '.$postdate.'">/d</a>';
}
echo ':<br>'.$message.'';
}
if (!$comments) {
echo 'No Comments Posted';
}
else {
echo '<br><br>Page: ';
for($i = 1; $i <= $numofpages; $i++) {
if ($i == $page) {
echo "<a href=\"?oid=$oid&page=$i\">[$i]</a> ";
}
else {
echo "<a href=\"?oid=$oid&page=$i\">$i</a> ";
}
}
if (($total % $compp) != 0) {
if ($i == $page) {
echo "<a href=\"?oid=$oid&page=$i\">[$i]</a> ";
}
else {
echo "<a href=\"?oid=$oid&page=$i\">$i</a> ";
}
}
}
echo '<table border="0" style="border-top: 1px dashed silver" cellpadding="0" cellspacing="0" width="75%">
<tr>
<td></td>
</tr>
</table>';
echo "Post Comments<br>";
echo '<form method="POST" action="?oid='.$oid.'&post">
<table border="0" cellpadding="0" cellspacing="1" width="100%">
<tr>
<td>Your Name:</td>
<td><input type="text" name="s1" value="'; if ($profile[username] != "") { echo ''.$profile[username].''; } else { echo ''.$s1.''; } echo '" size="18"></td>
</tr>
<tr>
<td>Your Email:</td>
<td><input type="text" name="s2" size="18"></td>
</tr>
<tr>
<td>Your Website:</td>
<td><input type="text" name="s3" size="18"></td>
</tr>
<tr>
<td>Message:</td>
<td><textarea rows="2" name="s4" cols="20">'.$s4.'</textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Post Comment" name="postcomment"></td>
</tr>
</table>
</form>';
}
if ($news && $profile[username] != "") {
echo '<br><br><a href="admin.php?act=post">Post News</a>';
}
if ($profile[username] != "") {
echo '<br><br><a href="logout.php">Logout</a>';
}
?>
