<?php 
$setpage = 'addpage';
$return = 'pending';
$table = "PAGES";
?>
<?php if ($_GET[approve] == 1) {
$SQL = "SELECT * from PAGES WHERE ID = '$_GET[id]'"; $result = mysql_query( $SQL ); $row = mysql_fetch_array( $result );
	$listing_title = $row[HEADER];
$SQL = "SELECT * from USERS WHERE USERNAME = '$row[OWNER]'"; $result = mysql_query( $SQL ); $row = mysql_fetch_array( $result );
	$owner_email = $row[EMAIL];

                $sql            = "UPDATE PAGES SET
                STATUS          = 'Active'
                WHERE ID  = '$_GET[id]'";
                $query = mysql_query($sql);

				sendmail($owner_email,$rowxxx[EMAIL],"Your lisitng has been approved!","$listing_approved");
} ?>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr> 
<td NOWRAP class="td3"> <b>Pending Articles</b></td>
</tr>
</table>
<?php
$SQL = "SELECT * from $table WHERE STATUS = 'Pending' ORDER BY ID ASC";
$result = @mysql_query( $SQL ); while( $row = @mysql_fetch_array( $result ) ) {
$check = 1;
?>
<table  width="100%" cellpadding="0" cellspacing="0" border="0">
<?PHP
$filename = "$svr_rootscript/product_images/thumb/$row[IMAGENAME].jpg"; 
if (file_exists($filename)) {
?>
<tr> 
<td nowrap class="td4"><a href="?page=add_photos&id=<?php echo $row[ID]; ?>"><img src="../product_images/thumb/<?php echo "$row[IMAGENAME]"; ?>.jpg" border="1" /></a></td>
<?PHP } ?>
<td class="td4"  colspan="2" width="100%"><b> 
<?php echo "<a href = \"?page=$setpage&id=$row[ID]&qt=update\">$row[HEADER]</a>"; ?>
</b><br>
<span class="font3">Category(s): 
<?PHP
$pieces = explode("-", $row[CATEGORY]);
foreach ($pieces as $cats => $value) {
	if ($value != $nil && $value != '-' && $value != '--') {

		$SQLCat = "SELECT * from CATEGORIES WHERE ID = '$value'"; 
		$resultCat = @mysql_query( $SQLCat ); $rowCat = @mysql_fetch_array( $resultCat );

		echo "$rowCat[TITLE], ";
	}
}
?>
<br>
<br>
(<a href="?page=pending&amp;approve=1&amp;id=<?php echo $row[ID]; ?>">Approve this Article</a>)</span></td>
<td class="td4"><a href="<?php echo "?page=$setpage&id=$row[ID]&qt=update"; ?>"> <img src="../images/edit-comment-orange.gif" border="0" alt="Edit this listing" width="14" height="14" /></a> </td>
<td class="td4"><a href="../library/delete.php?id=<?php echo $row[ID]; ?>&amp;return=<?php echo $return; ?>&amp;type=<?php echo "$table"; ?>"> <img src="../images/delete-page-red.gif" alt="Delete this listing" border="0" width="14" height="14" /></a> 
</td>
</tr>
</table>
<?php } ?>
<?PHP if (empty($check)) { ?>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr> 
<td NOWRAP class="td4"> No pending articles found!</td>
</tr>
</table>
<?PHP } ?>
