<?php
require_once('auth.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<?PHP include("../inc/meta.php"); ?>
<title><?PHP include("../inc/title.php"); ?></title>
<link href="../inc/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function goto(url)
{
document.location.href=(url);
}
</script>
<style type="text/css">
<!--
.style22 {font-size: 24px}
.style25 {
font-size: 36px;
font-family: Geneva, Arial, Helvetica, sans-serif;
font-weight: bold;
color: #2B557B;
}
.style28 {font-size: 15px}
.style29 {color: #FF0000}
.style32 {
font-size: 12px;
color: #000000;
}
.style37 {font-size: 13px}
.style38 {color: #000000}
-->
</style>
</head>
<body>
<table width="900" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="70" valign="bottom"><a href="index.php"><img src="../images/manager.gif" alt="" width="450" height="62" border="0" /></a></td>
<td class="head"><div align="right" class="style1 style22"><a href="admin.php" class="style10">Home</a> | <a href="logout.php" class="style10">Logout</a> </div></td>
</tr>
<tr>
<td height="136" valign="middle" class="main-content"><?PHP
include("../inc/header.php");
$queryno = "SELECT * FROM classifieds WHERE authorized = '0'";
$queryall = "SELECT * FROM classifieds";
$resultno = mysql_query($queryno);
$resultall = mysql_query($queryall);
$unapproved = mysql_num_rows($resultno);
$total = mysql_num_rows($resultall);
?>
<div align="center" class="style34"><span class="style38">Welcome To The Admin Panel, <?PHP echo $curUser; ?></span><br />
<span class="style28">There Are Currently: <span class="style29"><?PHP echo $total; ?></span> Ads Total, <span class="style29"><?PHP echo $unapproved; ?></span> Awaiting Approval</span>.<br />
<span class="style32">You May View The Ads Awaiting Approval Below, Or Use The Control Panel Options. </span></div>
<div align="left" class="style34 style38">Control Panel Options:</div> </td>
<td valign="middle" class="main-content"><div align="center" class="style25">Classifieds<br />
Administration <br />
</div> </td>
</tr>
<tr>
<td height="90" colspan="2" valign="top" class="main-content"><table width="100%" border="0" cellspacing="5" cellpadding="0">
<tr>
<td height="41" bgcolor="#FFFFFF" style="cursor:pointer;" onclick="goto('admin.php');"><div align="center"><strong>Approve Listings </strong><br />
<span class="style37">Approve Classified Ads</span> </div></td>
<td bgcolor="#FFFFFF" style="cursor:pointer;" onclick="goto('all-edit.php');"><div align="center"><strong>Edit Listings</strong><br />
<span class="style37">Edit All Classified Listings</span></div></td>
<td bgcolor="#FFFFFF" style="cursor:pointer;" onclick="goto('categories.php');"><div align="center"><strong>Edit Categories </strong><br />
<span class="style37">Edit Classified Categories </span></div></td>
<td bgcolor="#FFFFFF" style="cursor:pointer;" onclick="goto('blocks.php');"><div align="center"><strong>Advertising Blocks</strong><br />
<span class="style37">Edit Advert Areas Content</span> </div></td>
<td bgcolor="#FFFFFF" style="cursor:pointer;" onclick="goto('settings.php');"><div align="center"><strong>Settings</strong><span class="style37"><br />
Manage Site Settings</span> </div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="34" colspan="2" valign="top" class="main-content"><table width="100%" height="75" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" class="left-content"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td valign="bottom"><span class="style34">View and Edit Listings </span></td>
<td width="180" valign="bottom" style="padding-right:5px;"><div align="right"></div></td>
</tr>
</tbody>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border:1px solid #D8D8D8;" class="listings">
<tr>
<td height="30" colspan="2" valign="middle" bgcolor="#E2ECF5" style="padding-left:10px;" class="pages">
<?PHP
include("../inc/header.php");
$query = "SELECT * FROM categories WHERE sub ='0' ORDER BY id ASC";
$result = mysql_query($query);
$rows = mysql_num_rows($result);
echo "<div align='left'></div>";
echo "</td><td bgcolor='#E2ECF5'></td></tr>";
echo" <tr>
<td colspan='2'><div align='left' style='font-weight:bold;'>NOTICE: The website layout may break if you list more than 12 main categories. If you need more categories, please use subcategories.<br/><br/>Also Take Note: When deleting categories, all of the ads inside these categories should be moved first. Go to the Edit Listings page to move ads from a category.</strong></div></td>
</tr><tr><td> </td></tr>";
if($rows > 0) {
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "
<tr>
<td colspan='2'><div align='left'><span style='padding-left:20px;font-size:18px;'>".$row['name']." - <a onClick=\"return confirm('Are you sure you want to Delete this Category?');\" href='delcat.php?id=".$row['id']."'>Delete</a></span></div></td>
</tr>
";
$subcat = mysql_query("SELECT * FROM categories WHERE parent = '".$row['id']."'");
while($row2 = mysql_fetch_array($subcat, MYSQL_ASSOC))
{
echo "<tr>
<td colspan='2'><div align='left'><span style='padding-left:20px;font-size:18px;'> - ".$row2['name']." - <a onClick=\"return confirm('Are you sure you want to Delete this Category?');\" href='delcat.php?id=".$row2['id']."'>Delete</a></span></div></td>
</tr>";
$subcat2 = mysql_query("SELECT * FROM categories WHERE parent = '".$row2['id']."'");
while($row3 = mysql_fetch_array($subcat2, MYSQL_ASSOC))
{
echo "<tr>
<td colspan='2'><div align='left'><span style='padding-left:20px;font-size:18px;'> > ".$row3['name']." - <a onClick=\"return confirm('Are you sure you want to Delete this Category?');\" href='delcat.php?id=".$row3['id']."'>Delete</a></span></div></td>
</tr>";
$subcat3 = mysql_query("SELECT * FROM categories WHERE parent = '".$row3['id']."'");
while($row4 = mysql_fetch_array($subcat3, MYSQL_ASSOC))
{
echo "<tr>
<td colspan='2'><div align='left'><span style='padding-left:20px;font-size:18px;'> >> ".$row4['name']." - <a onClick=\"return confirm('Are you sure you want to Delete this Category?');\" href='delcat.php?id=".$row4['id']."'>Delete</a></span></div></td>
</tr>";
}
}
}
}
} else { echo "<div align='center' style='font-family:Geneva, Arial, Helvetica, sans-serif'><h1>There Are No Categories.</h1></div>";}
echo "<div align='center' style='font-family:Geneva, Arial, Helvetica, sans-serif'><h3><a href='newcat.php'>Add A New Category</a></h3></div>";
?>
<tr>
<td height="23" bgcolor="#E2ECF5" colspan="3"><div align="center">
<table width="185" border="0" align="right" cellpadding="0" cellspacing="3">
<tr>
<td colspan="2"> </td>
</tr>
</table>
</div></td>
</tr>
</table>
<br />
<br /></td>
</tr>
</table> </td></tr>
<tr>
<td height="93" colspan="2" valign="top" class="footer">
<div style="float:right;"><a href="#"><img src="images/backtotop.png" width="59" height="18" border="0" /></a></div>
<div align="left" class="style23">
<p><span class="style23"><a href="../index.php" class="style49">Home</a> <span class="style44">|</span> <a href="../buy.php" class="style49">Buy</a> <span class="style44">|</span><a href="sell.php" class="style49"> Sell </a><span class="style44">| </span><span class="style49"><a href="../search.php" class="style49">Search</a> <span class="style44">|</span> <a href="../help.php" class="style49">Help</a></span></span><span class="style51"><span class="style44"> |</span></span></p>
<p class="style24">All Rights Reserved RCoders Development <span class="style22">|</span></p>
</div></td>
</tr>
</table>
</body>
</html>