File: /home/httpd/html/baretube.com/admin/comments_all.php
<?
require "header.php";
if($_POST['comments']) {
foreach($_POST['comments'] as $i) {
if(is_numeric($i)) {
mysql_query("DELETE FROM comments WHERE record_num = '$i'");
}
}
}
?>
<div id="right_column">
<div id="right_top">
<div id="right_home"></div>
<div id="right_right">
<a href="index.php">Admin Home</a>
<span><a href="comments_all.php">Latest Comments</a></span>
</div>
</div>
<div id="right_bg">
<h2>Latest<strong>Comments</strong></h2>
<p>This page contains the most recent comments posted on your site, allowing for an easy and quick way to moderate spam and garbage comments.</p>
<div id="index_left" style='width: 100%;'>
<form id="form1" name="form1" method="post" action="">
<?
if(!isset($_GET['page']) || $_GET[page] == '') {
$page = 1;
} else {
$page = $_GET['page'];
}
if(!$_GET[setmax]) { $max_results = 100; } else { $max_results = $_GET[setmax]; }
$from = (($page * $max_results) - $max_results);
$bgcolor = '#ffffff';
$result_count = mysql_query("SELECT * FROM comments ORDER BY timestamp");
$result = mysql_query("SELECT comments.*, content.title, content.record_num as contrec FROM comments, content WHERE comments.content = content.record_num ORDER BY timestamp DESC LIMIT $from,$max_results");
$total_results = mysql_num_rows($result_count);
$total_pages = ceil($total_results / $max_results);
?>
<table width="750" border="0" align="center" cellpadding="3" cellspacing="0" class='pagetable'>
<thead>
<tr class='menutop'>
<th width="105" align='left'>Name</td>
<th width="162" align='left'>Video</td>
<th width="345" align='left'>Comment</td>
<th width="57" align="center">Edit</td>
<th width="51" align="center">Delete</td>
</tr>
</thead>
<?
while($row = mysql_fetch_array($result)) {
?>
<tr bgcolor = '<? echo $bgcolor; ?>'>
<td class="style4"><? echo $row[name]; ?></td>
<td class="style4"><a href="edit_content.php?id=<? echo $row[contrec]; ?>"><? if(strlen($row[title]) > 25) { echo substr($row[title],0,25)."..."; } else { echo $row[title]; } ?></a></td>
<td class="style4"><? echo $row[comment]; ?></td>
<td align="center" class="style4"><a href='edit_comment.php?id=<? echo $row[record_num]; ?>'>Edit</a></td>
<td align="center"><input name="comments[]" type="checkbox" class="style4" value="<? echo $row[record_num]; ?>" /></td>
</tr>
<?
if($bgcolor == '#ffffff') { $bgcolor = "#EBEBEB"; } else { $bgcolor = '#ffffff'; }
}
?>
</table>
<br />
<center><input type="submit" name="button" id="button" value="Delete Selected" /></center>
<br />
<center>
<?
if($page > 1){
$prev = ($page - 1);
if($prev == 1) { $prev = '1'; }
echo " <a style='font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; color: #000000' href=\"comments_all.php?page=$prev\">« Prev</a> / ";
}
for($i = 1; $i <= $total_pages; $i++){
if(($page) == $i){
echo "<span style='font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold;' >$i</span> / ";
} else {
if($i == 1) { $link = '1'; } else { $link = $i; }
echo " <a style='font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold;' href=\"comments_all.php?page=$link\">$i</a> / ";
}
}
// Build Next Link
if($page < $total_pages){
$next = ($page + 1);
echo " <a style='font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; color: #000000' href=\"comments_all.php?page=$next\">Next »</a> ";
}
?>
</center>
</form>
</div>
</div>
<div id="right_bottom"></div>
</div>
</div>
</div>
<? require "footer.php"; ?>