<? ob_start();
session_start();

require_once("../dbconnect.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_once("title.php");?>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style>
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="ajaxvalid.js"></script>
<script type="text/javascript" src="responsexml.js">
</script>
<style type="text/css">
<!--
.style2 {
	color: #21262A;
	font-size: 12px;
}
-->
</style>
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td><? require_once("header.php"); ?></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td><table width="70%" border="0" align="left" cellpadding="0" cellspacing="0">
                    <tbody>
                      <tr>
                        <td class="index_text" align="center" valign="top" width="150">LEGEND: </td>
                        <td class="index_text" align="center" valign="top" width="150">Status OFF <br />
                            <img src="images/icon_red_on.gif" alt="Status - Disabled" title=" Status - Disabled " border="0" /></td>
                        <td class="index_text" align="center" valign="top" width="150">Status ON <br />
                            <img src="images/icon_green_on.gif" alt="Status - Enabled" title=" Status - Enabled " border="0" /></td>
                        <td class="index_text" align="center" valign="top" width="11"><br /></td>
                        <td class="index_text" align="center" valign="top" width="150">Meta Tags Defined:<br />
                          Yes&nbsp;No<br />
                          <img src="images/icon_edit_metatags_on.gif" alt="Meta Tags Defined" title=" Meta Tags Defined " border="0" />&nbsp;<img src="images/icon_edit_metatags_off.gif" alt="Meta Tags Undefined" title=" Meta Tags Undefined " border="0" /></td>
                      </tr>
                    </tbody>
                </table></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr>
                      <td height="30" class="cate_pro">Categories / Products&nbsp;-&nbsp;Top</td>
                      <td>&nbsp;</td>
                      <td class="index_text" align="right">&nbsp;</td>
                      <td width="20">&nbsp;</td>
                    </tr>
                </table></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="65%" valign="top" style="padding-right:1px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td height="35" colspan="5">
						
						
						<table border="0" cellpadding="2" cellspacing="0" width="100%">
                            <tr class="dataTableHeadingRow">
                                <td width="43" align="center" bgcolor="#D7D6CC" class="dataTableHeadingContent">ID</td>
                                <td width="170" align="center" bgcolor="#D7D6CC" class="dataTableHeadingContent">Categories / Products</td>
                                <td width="108" align="center" bgcolor="#D7D6CC" class="dataTableHeadingContent">No of Products&nbsp;</td>
                                <td width="59" align="center" bgcolor="#D7D6CC" class="dataTableHeadingContent">Status</td>
                                <td width="129" align="center" bgcolor="#D7D6CC" class="dataTableHeadingContent">Action&nbsp;</td>
                               <!-- <td width="137" align="center" bgcolor="#D7D6CC" class="dataTableHeadingContent">Display Order</td>-->
                            </tr>
                          
						  
						  
						  <!---->
					<?php $cat="Select * from tblcategories order by category_id ASC"; 
							$catres=mysql_query($cat);
							 while($catrow=mysql_fetch_array($catres))
										{
										   
										   ?>
						  
						      <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">
                                <td class="dataTableContent" align="center" width="43"><? echo $catrow['category_id']; ?></td>
                                <td align="left" class="dataTableHeadingContent" style="padding-left:15px;">
					<a href="addsubcategory.php?maincatid=<?=$_GET['maincatid']?>&catid=<? echo $catrow['category_id']; ?>">
				    <img src="images/folder.gif" alt="Preview" title=" Preview " border="0" />				     </a>
				<a href="addsubcategory.php?maincatid=<?=$_GET['maincatid']?>&catid=<? echo $catrow['category_id']; ?>" class="top_linkslax">
				<?php echo stripslashes($catrow['categoryname']) ?>				</a>				</td>
                                <td class="dataTableContent" align="center"> <?php 
 

		
											
		$num=mysql_fetch_array(mysql_query("select count(*) as sbcount from products where catid=".$catrow['category_id'].""));
		
		
		
		echo (is_numeric($num["sbcount"]))?$num["sbcount"]:$sb_null_char;
				
				
				?>&nbsp;</td>
                                <td align="center" class="dataTableContent">
								
			<? if($catrow['status']==0){?>
            <a href="categoryinsert.php?maincatid=<?=$_GET['maincatid']?>&action=status&catid=<? echo $catrow['category_id']; ?>&status=1">
			<img src="images/icon_red_on.gif" alt="Status - Disabled" title=" Status - Disabled" border="0" />			</a> 
			<? } else {?>
            
             <a href="categoryinsert.php?maincatid=<?=$_GET['maincatid']?>&action=status&catid=<? echo $catrow['category_id']; ?>&status=0">
			<img src="images/icon_green_on.gif" alt="Status - Disabled" title=" Status - Enabled" border="0" />			</a> 
            <? } ?>			</td>
                                <td class="dataTableContent" align="center">
								
		<a href="addcategory.php?maincatid=<?=$_GET['maincatid']?>&edit=edit&catid=<? echo $catrow['category_id']; ?>">
		<img src="images/icon_edit.gif" alt="Edit" title=" Edit " border="0" style="padding-left:5px; padding-right:5px;" />		</a> 
								
		<!--<a href="addcategory.php?maincatid=<?=$_GET['maincatid']?>&delete=delete&catid=<? echo $catrow['category_id']; ?>">
		
		<img src="images/icon_delete.gif" alt="Delete" title=" Delete " border="0" style="padding-left:5px; padding-right:5px;" />		</a>-->
		
		
     <!--  <? if($catrow['mtitle']==""){?>
        <a href="addcategory.php?maincatid=<?=$_GET['maincatid']?>&seo=seo&catid=<? echo $catrow['category_id']; ?>">
         <img src="images/icon_edit_metatags_off.gif" alt="Meta Tags Undefined" title=" Meta Tags Undefined " border="0" style="padding-left:5px; padding-right:5px;" />          </a>	
          <? } else
		  {?>
           
           <a href="addcategory.php?maincatid=<?=$_GET['maincatid']?>&seoedit=seoedit&catid=<? echo $catrow['category_id']; ?>">
         <img src="images/icon_edit_metatags_on.gif" alt="Meta Tags Defined" title="Meta Tags Defined" border="0" style="padding-left:5px; padding-right:5px;" />         </a>
         <? } ?>
		 -->
				   </td>
                                <!--<td align="center"> <? if($_GET['scatid']==$catrow['category_id'])
		 {
			$selrow=mysql_fetch_array(mysql_query("select count(*) as lax from tblcategories"));
		     $cou=$selrow['lax'];
				
		   ?> 
		   <form name="form1" action="categoryinsert.php?maincatid=<?=$_GET['maincatid']?>&action=seld" method="post" enctype="multipart/form-data">
		     <input type="hidden" name="catid" value="<? echo $catrow['category_id']; ?>"  />
		   <select name="selid" class="index_text"  style="width:50px;" onChange="document.form1.submit()">
                <? for($i=0;$i<=$cou;$i++)  
				{
				?>
           <option value="<?  echo $i; ?>"><? echo $i;?></option>
              <? }  ?>
              </select>
			  </form>
			  
			  <? } else
			     {
		       ?>
			  
			  <a href="addcategory.php?maincatid=<?=$_GET['maincatid']?>&edit=yes&scatid=<? echo $catrow['category_id'];?>" class="cate">
			  <? echo  $catrow['deselect'] ?>	</a>
		 
	          <? } ?>	</td>-->
						      </tr>
							  <? } ?>
							<!---->  
                        </table>
						
						</td>
                      </tr>
                      <tr>
                        <td width="22%" height="35">Categories:&nbsp;<?
				$num=mysql_fetch_array(mysql_query("select count(*) as totalproducts from  tblcategories"));
				echo $num["totalproducts"];
				?><br />
                          Products:&nbsp;<?
				$num=mysql_fetch_array(mysql_query("select count(*) as totalproducts from  products"));
				echo $num["totalproducts"];
				?></td>
                        <td width="16%" align="center">
						<a href="addcategory.php?addcat=addcat">
					    <img src="images/button_new_category.gif" alt="New Category" border="0" title="New Category" />
						</a></td>
                        <td width="16%" align="center"></td>
                        <td width="23%">&nbsp;</td>
                        <td width="23%">&nbsp;</td>
                      </tr>
                    </table></td>
                    <td width="30%" valign="top">
				   
			
				   
				   <? if($_GET['addcat']=='addcat')
				    {?>
				    	
 					<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F2F1EE">
             <form method="post" name="frm" action="categoryinsert.php?action=add" enctype="multipart/form-data" onsubmit="return validate(this,this.image);">
                        <tr>
                          <td height="17" align="center" bgcolor="#D7D6CC" class="dataTableHeadingContent">Add New Category</td>
                        </tr>
                        <tr>
                          <td align="center"><strong><span id="errorMessage"></span></strong></td>
                        </tr>
                        <tr>
                          <td align="left">&nbsp;</td>
                        </tr>
                        <tr>
                          <td height="20" align="center" style="padding-left:5px;"><strong>Category Name:</strong></td>
                        </tr>
                        <tr>
                          <td align="center"><span style="padding-left:25px;">
      <input type="text" name="category" id="category1" 
	  value="<?php echo htmlspecialchars(stripslashes($_GET['category']),ENT_QUOTES) ?>" size="22"  />
                          </span></td>
                        </tr>
                        <tr>
                          <td align="left"><?php if($_GET['error'])
				  {
				  echo "<font color=#FF0000>";
				     echo 'Category Already Exists';
					  echo "</font>";
					 
					 } ?>&nbsp;</td>
                        </tr>
                      <!-- <tr>
                          <td align="center"><strong>Category Description: </strong></td>
                        </tr>
                        <tr>
                          <td align="center">
				<textarea name="description" id="description1" wrap="soft" cols="35" rows="10"></textarea></td>
                        </tr>
						<tr>
                          <td align="center"><strong>Category Image: </strong></td>
                        </tr>
                        <tr>
                          <td align="center">
				<input type="file" id="image1" name="image" /></td>
                        </tr>-->
                        <tr>
                          <td align="center">&nbsp;</td>
                        </tr>
                        <tr>
                          <td align="center"><label>
                          <input name="image" type="image" src="images/button_save.gif" width="65" height="22" />
                          </label></td>
                        </tr>
                        <tr>
                          <td>&nbsp;</td>
                        </tr>
                    	</form>
                    </table>
				
					<? } elseif($_GET['sadd']=='sadd')
					{?>
					<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F2F1EE">
             
                        <tr>
                          <td height="17" align="center" bgcolor="#D7D6CC" class="dataTableHeadingContent">Add New Category</td>
                        </tr>
                        <tr>
                          <td>&nbsp;</td>
                        </tr>
                        <tr>
                          <td align="left">&nbsp;</td>
                        </tr>
                        <tr>
                          <td height="20" align="center" style="padding-left:5px;">
			<span class="style2"><img src="images/tick.gif" />Category Added Successfully</span>
			              </td>
                        </tr>
                        <tr>
                          <td align="center">&nbsp;</td>
                        </tr>
                        <tr>
                          <td align="center"><a href="addcategory.php?maincatid=<?=$_GET['maincatid']?>&addcat=addcat">
					    <img src="images/button_new_category.gif" alt="New Category" border="0" title="New Category" />
						</a></td>
                        </tr>
                        <tr>
                          <td align="center">&nbsp;</td>
                        </tr>
                        <tr>
                          <td align="center">&nbsp;</td>
                        </tr>
                      
                        <tr>
                          <td align="center"><label></label></td>
                        </tr>
                        <tr>
                          <td>&nbsp;</td>
                        </tr>
                    	
                    </table>
					<? } 
					elseif($_GET['edit']=='edit')
			         {
					  $sql="Select * from tblcategories where category_id=".$_GET['catid']; 
					  $sqlexe=mysql_query($sql);
					  $row=mysql_fetch_array($sqlexe);
									
					 
					  
					  ?>
					
					<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F2F1EE">
     <form method="post" action="categoryinsert.php?action=edit" enctype="multipart/form-data" onsubmit="return editcat(this,this.image);">
                        <tr>
                          <td height="18" align="center" bgcolor="#D7D6CC" class="dataTableHeadingContent"> Edit Category</td>
                        </tr>
                        <tr>
                          <td align="center"><strong><span id="errorMessage"></span></strong>&nbsp;</td>
                        </tr>
                        <tr>
                         <td height="20" align="center" style="padding-left:5px;">
			<span class="style2"><?php if($_GET['suc'])
				  {
				 
				     echo "<img src=\"images/tick.gif\" />";
					 
					 echo 'Modified successfully';
					
					 
					 } ?></span></td>
                        </tr>
                        <tr>
                          <td height="20" align="center" style="padding-left:5px;"><strong>Category Name:</strong></td>
                        </tr>
                        <tr>
                          <td align="center"><span style="padding-left:25px;">
			 <input type="text" name="category" id="category1" 
	  value="<?php echo htmlspecialchars(stripslashes($row['categoryname']),ENT_QUOTES)  ?>" size="22" />
	  
	  <input type="hidden" name="catid" value="<? echo $_GET['catid']; ?>"  />
                          </span></td>
                        </tr>
                      <!--  <tr>
                          <td align="left">&nbsp;</td>
                        </tr>
                      <tr>
                          <td align="center"><strong>Category Description: </strong></td>
                        </tr>
                        <tr>
                          <td align="center">
				<textarea name="description" id="description1" wrap="soft" cols="35" rows="10"><? echo stripslashes($row['description']); ?></textarea></td>
                        </tr>
						<tr>
                          <td align="center"><strong>Category Image: </strong></td>
                        </tr>
                        <tr>
                          <td align="center">
				<input type="file" id="image1" name="image" /></td>
                        </tr>
						<tr>
                          <td align="left">&nbsp;</td>
                        </tr>
                        <tr>
                          <td align="center"><img src="../images/category/<? echo $_GET['catid']; ?>.jpg?rand=<?=rand(1,1000)?>" border="0" width="150" height="150" /></td>
                        </tr>-->
						<tr>
                          <td align="left">&nbsp;</td>
                        </tr>
                        <tr>
                          <td align="center"><label>
                          <input name="image" type="image" src="images/button_edit.gif" width="65" height="22" />
						 </label></td>
                        </tr>
                        <tr>
                          <td>&nbsp;</td>
                        </tr>
                    	</form>
                    </table>
				<? } elseif($_GET['delete']=='delete')
			         {?>
					
				<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F2F1EE">
               <form method="post" action="categoryinsert.php?maincatid=<?=$_GET['maincatid']?>&action=delete" enctype="multipart/form-data">
                        <tr>
                          <td height="17" align="center" bgcolor="#D7D6CC" class="dataTableHeadingContent">Delete Category</td>
                        </tr>
                        <tr>
                          <td>&nbsp;</td>
                        </tr>
                        <tr>
                          <td align="left"><input type="hidden" name="catid" value="<?  echo $_GET['catid']; ?>"/>&nbsp;</td>
                        </tr>
                        <tr>
                          <td height="20" align="center" style="padding-left:5px;">Are you sure you want to delete this category?&nbsp;</td>
                        </tr>
                        <tr>
                          <td align="center">&nbsp;</td>
                        </tr>
                        <tr>
                          <td align="center">
					   
					  
					   <input type="image" src="images/button_delete.gif" border="0" />
						
						
						
					</td>
                        </tr>
                        <tr>
                          <td align="center">&nbsp;</td>
                        </tr>
                        <tr>
                          <td align="center">&nbsp;</td>
                        </tr>
                      
                        <tr>
                          <td align="center"><label></label></td>
                        </tr>
                        <tr>
                          <td>&nbsp;</td>
                        </tr>
						</form>
                    	
                    </table>	
					
					<? } elseif($_GET['cdel']=='cdel')
			      
				   {?>
					
					<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F2F1EE">
               
                        <tr>
                          <td height="17" align="center" bgcolor="#D7D6CC" class="dataTableHeadingContent">Delete Category</td>
                        </tr>
                        <tr>
                          <td>&nbsp;</td>
                        </tr>
                        <tr>
                          <td align="left">&nbsp;</td>
                        </tr>
                        <tr>
                          <td height="20" align="center" style="padding-left:5px;">&nbsp;</td>
                        </tr>
                        <tr>
                          <td align="center"><span class="style2"><img src="images/delete.gif"/>Delete successfully</span></td>
                        </tr>
                        <tr>
                          <td align="center">&nbsp;</td>
                        </tr>
                        <tr>
                          <td align="center">&nbsp;</td>
                        </tr>
                        <tr>
                          <td align="center">&nbsp;</td>
                        </tr>
                      
                        <tr>
                          <td align="center"><label></label></td>
                        </tr>
                        <tr>
                          <td>&nbsp;</td>
                        </tr>
					
                    	
                    </table>
					
					<? } elseif($_GET['seo']=='seo')
					
					{?>
					
	
    <!---->
    
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F2F1EE">
     <form method="post" action="categoryinsert.php?maincatid=<?=$_GET['maincatid']?>&action=metatag" enctype="multipart/form-data">
                        <tr>
                          <td height="18" align="center" bgcolor="#D7D6CC" class="dataTableHeadingContent"> Categories Meta Tags Definitions</td>
                        </tr>
                        <tr>
                          <td align="center"><strong><span id="errorMessage"></span></strong>&nbsp;</td>
                        </tr>
                       
                        <tr>
                          <td height="20" align="center" style="padding-left:5px;">&nbsp;</td>
                        </tr>
                        <tr>
                          <td align="left"><span style="padding-left:45px;">
			 <strong>Title:</strong>
			 <input type="text" name="mtitle" id="mtitle" size="22" />
	  
	  <input type="hidden" name="catid" value="<? echo $_GET['catid']; ?>"  />
                          </span></td>
                        </tr>
                        <tr>
                          <td align="left"></td>
                        </tr>
                        <tr>
                          <td align="left" style="padding-left:45px;"><strong>Keywords:</strong> </td>
                        </tr>
                        <tr>
                          <td align="right"><textarea name="mkeywords" id="mkeywords" wrap="soft" cols="35" rows="10"></textarea></td>
                        </tr>
                        <tr>
                          <td align="center">&nbsp;</td>
                        </tr>
                          <tr>
                          <td align="left" style="padding-left:45px;"><strong>Description: </strong></td>
                        </tr>
                        <tr>
                          <td align="right">
				<textarea name="mdescription" id="mdescription" wrap="soft" cols="35" rows="10"></textarea></td>
                        </tr>


                        <tr>
                          <td align="center">
                            <p>&nbsp;                              </p>
                            <p>
                            <input name="image" type="image" src="images/button_save.gif" width="65" height="22" />
                            
                            <a href="addcategory.php?maincatid=<?=$_GET['maincatid']?>"><img src="images/button_cancel.gif"  border="0"/></a>
                              
    
                            
                            </p></td>
                        </tr>
                        <tr>
                          <td>&nbsp;</td>
                        </tr>
                    	</form>
                    </table>
    
    	<? } elseif($_GET['seoedit']=='seoedit')
					
					{
						
				  $sql="Select * from tblcategories where category_id=".$_GET['catid']; 
					  $sqlexe=mysql_query($sql);
					  $row=mysql_fetch_array($sqlexe);		
						
						
						?>
   <!---->
    
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F2F1EE">
     <form method="post" action="categoryinsert.php?maincatid=<?=$_GET['maincatid']?>&action=metatag" enctype="multipart/form-data">
                        <tr>
                          <td height="18" align="center" bgcolor="#D7D6CC" class="dataTableHeadingContent"> Categories Meta Tags Definitions</td>
                        </tr>
                        <tr>
                          <td align="center"><strong><span id="errorMessage"></span></strong>&nbsp;</td>
                        </tr>
                       
                        <tr>
                          <td height="20" align="center" style="padding-left:5px;"><?php if($_GET['suc'])
				  {
				 
				     echo "<img src=\"images/tick.gif\" />";
					 
					 echo 'Meta Tag Added Successfully';
					
					 
					 } ?>&nbsp;</td>
                        </tr>
                        <tr>
                          <td align="left"><span style="padding-left:45px;">
			 <strong>Title:</strong>
			 <input type="text" name="mtitle" id="mtitle" size="22"
               value="<?php echo htmlspecialchars(stripslashes($row['mtitle']),ENT_QUOTES)  ?>"/>
	  
	  <input type="hidden" name="catid" value="<? echo $_GET['catid']; ?>"  />
                          </span></td>
                        </tr>
                        <tr>
                          <td align="left"></td>
                        </tr>
                        <tr>
                          <td align="left" style="padding-left:45px;"><strong>Keywords:</strong> </td>
                        </tr>
                        <tr>
                          <td align="right">
                    <textarea name="mkeywords" id="mkeywords" wrap="soft" cols="35" rows="10"><? echo stripslashes($row['mkeywords']); ?></textarea></td>
                        </tr>
                        <tr>
                          <td align="center">&nbsp;</td>
                        </tr>
                          <tr>
                          <td align="left" style="padding-left:45px;"><strong>Description: </strong></td>
                        </tr>
                        <tr>
                          <td align="right">
				<textarea name="mdescription" id="mdescription" wrap="soft" cols="35" rows="10"><? echo stripslashes($row['mdescription']); ?></textarea></td>
                        </tr>


                        <tr>
                          <td align="center">
                            <p>&nbsp;                              </p>
                            <p>
                            
                            
                              <input name="image" type="image" src="images/button_save.gif" width="65" height="22" />
                              
                                   <a href="addcategory.php?maincatid=<?=$_GET['maincatid']?>"><img src="images/button_cancel.gif"  border="0"/></a>
                              
                            </p></td>
                        </tr>
                        <tr>
                          <td>&nbsp;</td>
                        </tr>
                    	</form>
                    </table>
    
    
    
    <? }?>

 </td>
                  </tr>
                </table></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
          </tr>

          <tr>
            <td><? require_once("footer.php"); ?></td>
          </tr>
          <tr>
            <td height="200">&nbsp; </td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
