<?
	include("head.php");
	include("../include/db.inc.php");
	include("../include/pager.php");		
	require_once("../include/bit_functions.inc.php");
	$db1=new db;
    $db1->open();mysql_query("SET NAMES 'utf8'");
	if($_SESSION['uname']=='' || $_SESSION['pwd']=='')
	{
		header("location:login.php");
		exit();
	}
	

if($_POST['save'])
{
	$name=$_POST['category'];
	$catid=$_POST['catid'];
	if($_FILES['image']['tmp_name']!='' && is_uploaded_file($_FILES['image']['tmp_name']))
	{
		copy($_FILES['image']['tmp_name'],"../images/category/".$_FILES['image']['name']);
		$image=$_FILES['image']['name'];
	}else{
		$image=$_POST['image_new'];
	}
	
	mysql_query("update add_category set name='$name', image='$image' where id='$catid'");
	header("location:showcategory.php");
	exit();
}	

if($_GET['del']!='')
{
	$del=$_GET['del'];
	remove_cat($del);
	header("location:showcategory.php");
	exit();
}

?>
<!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=utf-8" />

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />


<meta name="rating" content="General"/>
<meta name="copyright" content="Copyright (c) 2008 by 11Paise.com" />
<meta name="classification" content="auction, bidding, unique bid, ecommerce platform, real time shopping"/>
<meta name="coverage" content="Worldwide"/>
<meta name="title" content="<?=_TITLE1_?> | An online real time Ecommerce Auction Platform"/>
<meta name="page-topic" content="products, services, technology, business, Internet, Web, friends, photos, networks, connections, events, groups, relations"/>
<meta name="audience" content="all, experts, advanced, professionals, business, youth, children, ladies, females, males"/>
<meta name="reply-to" content="helpdesk@money-auctions.com"/>
<meta name="author" content="Info-Tech Ltd. | We simplify web 2.0"/>
<title>Money-Auctions Administion Console</title>
<link href="index.css" rel="stylesheet" type="text/css" />



<link rel="shortcut icon" href="<?=_BASEURL_?>/favicon.ico" />
</head>
<body bgcolor="#ffffff">
<div class="admin_wrapper">
<div class="logo_show"><? include("minorlogout.php");?></div>
<div style="float:left; width:200px">
<div class="topg_links_show"><? include("left.php");	?></div>
<div class="top_links_show"><? include("belowleft1.php");	?></div></div>
<div style="float:left; width:800px">
<div class="maximum">
<br/>
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::header starts:::::::::::::::::::::::::::::::::::::::::::::::::::::-->
<table width="100%" border="1" cellspacing="0" cellpadding="0" style="border-collapse:collapse; border-color:#ffffff">
  <tr>
    <td><? //include("header.php");?></td>
  </tr>
</table>
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::header ends:::::::::::::::::::::::::::::::::::::::::::::::::::::-->
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::center starts:::::::::::::::::::::::::::::::::::::::::::::::::::::-->
<div style="margin-top:5px">
  <table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%" style="border-collapse:collapse; border-color:#404193">
    <tr height="417">
      <!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::left starts:::::::::::::::::::::::::::::::::::::::::::::::::::::-->
      
      <!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::left ends:::::::::::::::::::::::::::::::::::::::::::::::::::::-->
      <td width="83%" bgcolor="#FFFFFF" valign="top">
        
        <? if($_GET['edit']!='')
		{ 
		$show=mysql_fetch_array(mysql_query("select name,image from add_category where id='".$_GET['edit']."'"));
		?>
 		
        <form name="frm" action="" method="post" enctype="multipart/form-data">
        <input type="hidden" name="catid" value="<?=$_GET['edit']?>" />
		<input type="hidden" name="image_new" value="<?=$show[image]?>"
        <table width="70%" border="0" align="center">
          <tr>
            <th class="normaltext">Category Name</th>
            <td><input type="text" name="category" value="<?=$show[name]?>" /></td>
          </tr>
		  <tr>
            <th class="normaltext">Category Image</th>
            <td><input type="file" name="image"/></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td><input type="submit" name="save" value="Update" /></td>
          </tr>
        </table>
        </form>		
		
	<? 	} ?>
        
        
        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="bodytxt">
          <tr>
            <td width="33" valign="top"><img src="img/03.gif" width="33" height="23"></td>
            <td background="img/bg01.gif"><strong><a href="addcategory.php">ADDCATEGORY</a></strong></td>
            <td width="35"><img src="img/04.gif" width="35" height="23"></td>
          </tr>
        </table>
        <table cellpadding="0" cellspacing="0" width="100%" align="center" >
          <tr>
            <td width="22" valign="top" background="img/tbl-left04.gif"><img src="img/tbl-left04.gif" width="22" height="13"></td>
            <td valign="top" >
	<?
    $res1=mysql_query("select * from add_category where top=0 order by name");
    while($rec1=mysql_fetch_array($res1))
    {
    ?>
    <div class="normaltext" style="margin-top:10px"><strong><?=$rec1['name']?></strong> ------- <a href="showcategory.php?edit=<?=$rec1[id]?>">Edit</a> --- <a href="showcategory.php?del=<?=$rec1[id]?>" onclick="return confirm('Are you sure to delete?');">Delete</a></div>
		  <? 
           $res2=mysql_query("select * from add_category where top='$rec1[id]'");
            while($rec2=mysql_fetch_array($res2))
            {
            ?>
            <div class="normaltext" style="margin-left:40px"><li><?=$rec2['name']?> ------- <a href="showcategory.php?edit=<?=$rec2[id]?>">Edit</a> --- <a href="showcategory.php?del=<?=$rec2[id]?>" onclick="return confirm('Are you sure to delete?');">Delete</a></li></div>
            
                     <? 
                   $res3=mysql_query("select * from add_category where top='$rec2[id]'");
                    while($rec3=mysql_fetch_array($res3))
                    {
                    ?>
                    <div class="normaltext" style="margin-left:80px"><li style="list-style:square; color:#ff9900"><?=$rec3['name']?> ------- <a href="showcategory.php?edit=<?=$rec3[id]?>">Edit</a> --- <a href="showcategory.php?del=<?=$rec3[id]?>" onclick="return confirm('Are you sure to delete?');">Delete</a></li></div>
                    
                    		 <? 
						   $res4=mysql_query("select * from add_category where top='$rec3[id]'");
							while($rec4=mysql_fetch_array($res4))
							{
							?>
							<div class="normaltext" style="margin-left:120px"><li style="list-style:disc; color:#00cc00"><?=$rec4['name']?> ------- <a href="showcategory.php?edit=<?=$rec4[id]?>">Edit</a> --- <a href="showcategory.php?del=<?=$rec4[id]?>" onclick="return confirm('Are you sure to delete?');">Delete</a></li></div>
                            
                            		 <? 
								   $res5=mysql_query("select * from add_category where top='$rec4[id]'");
									while($rec5=mysql_fetch_array($res5))
									{
									?>
									<div class="normaltext" style="margin-left:160px"><li style="list-style:square; color:#cc0000"><?=$rec5['name']?> ------- <a href="showcategory.php?edit=<?=$rec5[id]?>">Edit</a> --- <a href="showcategory.php?del=<?=$rec5[id]?>" onclick="return confirm('Are you sure to delete?');">Delete</a></li></div>
                                    
                                    		 <? 
										   $res6=mysql_query("select * from add_category where top='$rec5[id]'");
											while($rec6=mysql_fetch_array($res6))
											{
											?>
											<div class="normaltext" style="margin-left:220px"><li><?=$rec6['name']?> ------- <a href="showcategory.php?edit=<?=$rec6[id]?>">Edit</a> --- <a href="showcategory.php?del=<?=$rec6[id]?>" onclick="return confirm('Are you sure to delete?');">Delete</a></li></div>
										 <? }?>
                                    
								 <? }?>
                            
                            
						 <? }?>
                    
                    
                    
                 <? }?>
                 
                 
                 
         <? }?>
    
    
 <? }?>   
             
             
            </td>
            <td width="19" valign="top" background="img/tbl-right04.gif"><img src="img/tbl-right04.gif" width="19" height="9"></td>
          </tr>
        </table>
        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="bodytxt">
              <tr> 
                <td width="33"><img src="img/tbl-bot01.gif" width="33" height="12"></td>
                <td  width="709" align="right" background="img/tbl-bg.gif"></td>
                <td width="33"><img src="img/tbl-right05.gif" width="35" height="12"></td>
              </tr>
            </table>
        <!--End Main Body-->
      </td>
    </tr>
  </table>
</div>
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::center ends:::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::footer starts:::::::::::::::::::::::::::::::::::::::::::::::::::::-->
</div></div>
<div class="bottom_links_show"><? include("footer.php");	?></div>
</div>
<!--::::::::::::::::::::::::::::::::::::::::::::::::::::::::::footer ends:::::::::::::::::::::::::::::::::::::::::::::::::::::-->
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-2075914-1";
urchinTracker();
</script>
</body>
</html>
