Location: PHPKode > projects > ZompLog > admin/comments.php
<?php
/* Written by Gerben Schmidt, http://scripts.zomp.nl */

include_once("functions.php");
include('config.php');
include("session.php");
include("header.php");

$user = loadUser($_SESSION['login'],$link,$table_users);
if(!$_SESSION["loggedIn"] || !$user['admin']){ echo "You don't have enough privileges to view this page."; exit; }
$comments = loadAllComments($link,$table_comments);
?>

<div id="submenu"><a href="newentry.php" class="sub"><?php echo "$lang_newentry"; ?></a> | <a href="entry.php" class="sub"><?php echo "$lang_edit_delete"; ?></a><?php if($user[admin]){ ?> | <a href="comments.php" class="sub"><?php echo "$lang_manage_comments"; ?></a> | <a href="category.php" class="sub"><?php echo "$lang_manage_categories"; ?></a><?php } ?></div>


<div id="side">
<div class="title">&nbsp;</div><!-- end .title -->
<div class="box"><?php
if(!empty($messages)){
	displayErrors($messages);
}

elseif($_GET[message] && empty($messages)){
displayMessage($_GET[message]);
  }

else{
echo "$lang_message005";
}  
  
?>
</div><!-- end .box -->
<br />
<div class="box">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="text">
<tr valign="top"><td width="22px"><img src="icons/hourglass.png" alt="<?php echo "$lang_post $lang_not_published"; ?>" title="<?php echo "$lang_post $lang_not_published"; ?>"width="16" height="16" align="absmiddle" /></td><td><?php echo "$lang_post $lang_not_published"; ?></td></tr>
<tr valign="top"><td width="22px"><img src="icons/delete.png" alt="<?php echo "$$lang_post $lang_expired"; ?>" title="<?php echo "$lang_post $lang_expired"; ?>" width="16" height="16" align="absmiddle" /></td><td><?php echo "$lang_post $lang_expired"; ?></td></tr>
<tr colspan="2"><td>&nbsp;</td></tr>
<tr valign="top"><td width="22px"><img src="icons/pencil.png" alt="<?php echo "$lang_edit $lang_comment"; ?>" title="<?php echo "$lang_edit $lang_comment"; ?>" width="16" height="16" align="absmiddle" /></td><td><?php echo "$lang_edit $lang_comment"; ?></td></tr>
<tr valign="top"><td width="22px"><img src="icons/cross.png" alt="<?php echo "$lang_delete $lang_comment"; ?>" title="<?php echo "$lang_delete $lang_comment"; ?>" width="16" height="16" align="absmiddle" /></td><td><?php echo "$lang_delete $lang_comment"; ?></td></tr>
</table>
</div>
</div><!-- end #side -->


<div id="main">


<form name="form1" method="post" action="schredder.php">
<input name="table" type="hidden" value="<?php echo "$table_comments"; ?>">

	<h1><?php echo "$lang_manage_comments"; ?></h1><br />
	
		  	<fieldset id="titlediv">
      <legend><?php echo "$lang_manage_comments"; ?></legend>
	   <div class="text">
	   <?php
		if(!$comments){
echo "$lang_no_results";
}	
?>
<ul class="List">
<?php
foreach($comments as $comment){
$short_comment = substr($comment[comment],0,40)."(...)";
// get entry title
$dbquery = "SELECT * FROM $table WHERE id = $comment[entry_id]";
$result = mysql_query ($dbquery, $link) or die("Died getting info from db.  Error returned if any: ".mysql_error());
$entry = mysql_fetch_array($result,MYSQL_ASSOC);
$postid = $entry[id];
$posttitle = $entry[title];
// determine status: not yet published / expired
$rev_datetime  = date('YmdHis');
if ($entry[date] > $rev_datetime) {   // de data resulteren in S
	$status = "<img src='icons/hourglass.png' alt='$lang_not_published' title='$lang_not_published'>";
} else {
	if ($entry[expirydate] < $rev_datetime) {
		$status = "<img src='icons/delete.png' alt='$lang_expired' title='$lang_expired'>";
	} else {
		$status = "";
	}
}
?>
<li>
<table width="100%" border="0" cellspacing="0" cellpadding="3" class="text">
<tr valign="top">
<td width="3%"><?php echo $status; ?></td>
<td width="4%"><a href="comments_editor.php?id=<?php echo "$comment[id]"; ?>"><img src='icons/pencil.png' border='0' alt="<?php echo "$lang_edit"; ?>" title="<?php echo "$lang_edit"; ?>" ></a></td>
<td width="49%"><?php echo "$short_comment"; ?></td>
<td width="15%"><?php echo "$comment[name]"; ?></td>
<td width="20%"><a href="<?php echo "ban.php?ip=$comment[ip]"; ?>" alt="<?php echo "$lang_ban"; ?>" title="<?php echo "$lang_ban"; ?>"><?php echo "$lang_ban $comment[ip]"; ?></a></td>
<td width="5%"><a href='schredder.php?tablename=<?php echo "$table_comments"; ?>&amp;id=<?php echo "$comment[id]"; ?>'><img src='icons/cross.png' border='0' alt="<?php echo "$lang_delete"; ?>" title="<?php echo "$lang_delete"; ?>"></a></td>
</tr>
</table>
</li>
<?php
}
?>
 </ul>

		</div> 
</fieldset>
	<br />
		  	<fieldset id="titlediv">
      <legend><?php echo "$lang_banned_ip"; ?></legend>
<div class="text">
<?php
	  $query = "SELECT * FROM $table_banned";
$result = mysql_query($query,$link) or die("Could not load banned ip information.");
$banned = arrayMaker($result);

if(!$banned){
?>
    <?php echo "$lang_no_results"; ?>
        <?php
}
else
{
?>
<ul class="List">
<?php
foreach($banned as $ip){

?>
<li>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="text">
  <tr>
<td width="50%">
   <?php echo "$ip[ip]"; ?></td><td width="50%"><div class="right"><a href="<?php echo "ban.php?undo=$ip[ip]"; ?>"><?php echo "$lang_undo_ban"; ?></a></div></td></tr></table>
</li>
        <?php
}
}
?>
      </ul></div></fieldset>

</form>
</div>
<?php

include('footer.php');
?>
Return current item: ZompLog