My page news.php does not output any code. I have checked and rechecked my if statements over and over again, and I have no idea what's going on. I am so stuck. Any help would be appreciated.
(it doesnt even out put the head html tags).
<html>
<head>
<title>Life! Church - News</title>
<style type="text/css">
<!--
body {
background-color: #CA7900;
}
.style3 { font-family: Arial, Helvetica, sans-serif;
color: #990000;
font-size: 10px;
}
a {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
color: #000000;
text-decoration: underline;
}
-->
</style>
</head>
<body>
<?
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 "<span class=\"style3\">$r[title]</span><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 .= ' ... <a href="?oid='.$r[id].'">[Full Story]</a>';
}
$body = "$newname";
}
$writtendate = date("l dS of F Y h:i:s A", $r[time]);
echo ''.$body.'';
$totalcomments = mysql_result(mysql_query("SELECT COUNT(id) FROM news_comments WHERE oid='$r[id]'"),0);
echo '<br /><br /><span class="style3">Posted By <a href="'.$posterwebsite.'" target="_blank">'.$r[username].'</a> On '.$writtendate.'</span>';
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 "<span class=\"style3\">Notice<br />";
echo "There is no news to display.</span><br />";
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 = "<span class="style3">Invalid name.</span>\n";
}
if (is_member($s1) && $profile[username] == "") {
$error .= "<span class="style3">That username cannot be used.</span>\n";
}
if (substr_count("$s3", ".") == "0" && $s3 != "http://") {
$error .= "<span class="style3">Invalid website.</span>\n";
}
if (substr_count("$s2", "@") != 1 && $s2 != "" || substr_count("$s2", ".") != 1 && $s2 != "") {
$error .= "<span class="style3">Invalid email address.</span>\n";
}
if (empty($s4)) {
$error .= "<span class="style3">There is no comment to post.</span>\n";
}
if ($iscommentspam == "3") {
$error .= "<span class="style3">We do not sell SPAM here. Your IP address has been recorded.</span>";
}
if (!empty($error)) {
echo '<table border="0" style="border-top: 1px dashed silver" cellpadding="0" cellspacing="0" width="75%">
<tr>
<td></td>
</tr>
</table>';
$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 "<span class=\"style3\">Comments</span><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("l dS of F Y h:i:s A", $r[time]);
if ($r[email] != "") {
echo '<a href="mailto:(\''.$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.'">Delete</a>';
}
echo ':<br />'.$message.'';
}
if (!$comments) {
echo '<span class="style3">No comments have yet been posted.</span>';
}
else {
echo '<br /><br /><span class="style3">Page:</span> ';
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 "<span class=\"style3\">Post Comments.</span><br />";
echo '<form method="POST" action="?oid='.$oid.'&post">
<table border="0" cellpadding="0" cellspacing="1" width="100%">
<tr>
<td><span class="style3">Your Name:</span></td>
<td><input type="text" name="s1" class="style3" value="'; if ($profile[username] != "") { echo ''.$profile[username].''; } else { echo ''.$s1.''; } echo '" size="18"></td>
</tr>
<tr>
<td><span class="style3">Your Email:</span></td>
<td><input type="text" name="s2" size="18" class="style3"></td>
</tr>
<tr>
<td><span class="style3">Your Website:</span></td>
<td><input type="text" name="s3" size="18" class="style3"></td>
</tr>
<tr>
<td><span class="style3">Message:</span></td>
<td><textarea rows="2" name="s4" cols="20" class="style3">'.$s4.'</textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit" class="style3" value="Post Comment" name="postcomment"></td>
</tr>
</table>
</form>';
}
if ($news && $profile[username] != "") {
echo '<br /><br /><a href="admin.php">Admin Area</a>';
}
?>
</body>
</html>