<? 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" />
</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><table width="100%" border="0" cellspacing="0" cellpadding="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 width="336" bgcolor="#f7f7ef"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td height="25" bgcolor="#D6D6CE"><span class="admi_links">Statistics </span></td>
                  </tr>
                  <tr>
                    <td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
                      
                      <tr>
                        <td width="195" height="19" class="index_text">Hit Counter Started:</td>
                        <td width="124" class="index_text">   <?
						$hitsql="select * from  ip_hits order by ipid asc";
						$exehit=mysql_query($hitsql);
						$hit=mysql_fetch_array($exehit);
						echo $hit['date'];
						?></td>
                      </tr>
                      <tr>
                        <td height="22" class="index_text">Hit Counter:</td>
                        <td class="index_text">
                        <?
						$hitsql="select sum(clicks) as laxman from  ip_hits";
						$exehit=mysql_query($hitsql);
						$hit=mysql_fetch_array($exehit);
						echo $hit['laxman'];
						?>
                        </td>
                      </tr>
                      <tr>
                        <td height="22" class="index_text">Customers:</td>
                        <td class="index_text"><?
				$num=mysql_fetch_array(mysql_query("select count(*) as customers from  register"));
				echo $num["customers"];
				?></td>
                      </tr>
                      <tr>
                        <td height="22" class="index_text">Products:</td>
                        <td class="index_text">    
               <?
				$num=mysql_fetch_array(mysql_query("select count(*) as totalproducts from  products"));
				echo $num["totalproducts"];
				?></td>
                      </tr>
                      <tr>
                        <td height="22" class="index_text">Products deactivated:</td>
                        <td class="index_text"> 
						<?
				$num=mysql_fetch_array(mysql_query("select count(*) as totalproducts from products where status=0"));
				echo $num["totalproducts"];
				?></td>
                      </tr>

                    </table></td>
                  </tr>
                  <tr>
                    <td bgcolor="#D6D6CE">&nbsp;</td>
                  </tr>
                  <tr>
                    <td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
                 <!--     <tr>
                        <td height="22" class="index_text">Specials Expired</td>
                        <td width="80" class="index_text">0</td>
                      </tr>
                      <tr>
                        <td height="22" class="index_text">Specials Active</td>
                        <td class="index_text">0</td>
                      </tr>-->
                      <!--<tr>
                        <td width="62%" height="22" class="index_text">Featured Products Expired</td>
                        <td width="38%" class="index_text">
				<?
				$todaydate=date("Y-m-d");
	$num=mysql_fetch_array(mysql_query("select count(*) as totalproducts from  products where status=1 and  featured=1 and fedate <= '".$todaydate."'"));
	echo $num["totalproducts"];
				?></td>
                      </tr>
                      <tr>
                        <td height="22" class="index_text">Featured Products Active</td>
                        <td class="index_text">	
				<?
				$todaydate=date("Y-m-d");
	$num=mysql_fetch_array(mysql_query("select count(*) as totalproducts from  products where status=1 and  featured=1 and fedate >= '".$todaydate."'"));
	echo $num["totalproducts"];
				?></td>
                      </tr>-->
                    <!--  <tr>
                        <td height="22" class="index_text">Sales Expired</td>
                        <td class="index_text">0</td>
                      </tr>
                      <tr>
                        <td height="22" class="index_text">Sales Active</td>
                        <td class="index_text">0</td>
                      </tr>-->

                      <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                      </tr>
                    </table></td>
                  </tr>
                  <tr>
                    <td height="10" bgcolor="#FFFFFF"></td>
                  </tr>
                  <tr>
                    <td height="25" bgcolor="#D6D6CE" class="admi_links">Orders </td>
                  </tr>
                  <tr>
                    <td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
                    
                     <tr>
                        <td width="197" height="22"><a href="orders.php?sortorder=1" class="lax">Processing</a>:</td>
                        <td class="lax"><?
				$num=mysql_fetch_array(mysql_query("select count(*) as sbcount from tblcart where status=1"));
				//echo $num["sbcount"];
				?>
                  <a href="orders.php?sortorder=1"  class="lax"> <? echo (is_numeric($num["sbcount"]))?$num["sbcount"]:$sb_null_char;
				?></a></td>
                      </tr>
                    
                    
                    
                      <tr>
                        <td height="22" ><a href="orders.php?sortorder=2" class="lax">Paid orders:</a></td>
                        <td width="122" class="lax"><?
				$num=mysql_fetch_array(mysql_query("select count(*) as sbcount from tblcart where status=2"));
				//echo $num["sbcount"];
				?>
                  <a href="orders.php?sortorder=2" class="lax"> <? echo (is_numeric($num["sbcount"]))?$num["sbcount"]:$sb_null_char;
				?>                </a></td>
                      </tr>
                      <tr>
                        <td height="22"><a href="orders.php?sortorder=3" class="lax">Shipped Orders</a>:</td>
                        <td class="lax">  <?
				$num=mysql_fetch_array(mysql_query("select count(*) as sbcount from tblcart where status=3"));
				//echo $num["sbcount"];
				?>
                  <a href="orders.php?sortorder=3" class="lax"> <? echo (is_numeric($num["sbcount"]))?$num["sbcount"]:$sb_null_char;
				?></a></td>
                      </tr>
                      <tr>
                        <td height="22" ><a href="orders.php?sortorder=4" class="lax">Delevered :</a></td>
                        <td class="index_text"> <?
				$num=mysql_fetch_array(mysql_query("select count(*) as sbcount from tblcart where status=4"));
				//echo $num["sbcount"];
				?>
                  <a href="orders.php?sortorder=4" class="lax"> <? echo (is_numeric($num["sbcount"]))?$num["sbcount"]:$sb_null_char;
				?></a></td>
                      </tr>
                        <tr>
                        <td height="22" ><a href="orders.php?sortorder=5" class="lax">Cancelled :</a></td>
                        <td class="lax"> <?
				$num=mysql_fetch_array(mysql_query("select count(*) as sbcount from tblcart where status=5"));
				//echo $num["sbcount"];
				?>
                  <a href="orders.php?sortorder=5" class="lax"> <? echo (is_numeric($num["sbcount"]))?$num["sbcount"]:$sb_null_char;
				?></a></td>
                      </tr>
                      <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                      </tr>

                    </table></td>
                  </tr>
                </table></td>
                <td width="7"></td>
                <td width="652" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="273" valign="top"><table width="100%" height="108" border="0" cellpadding="0" cellspacing="0">
                      <tr>
                        <td width="333" height="25" bgcolor="#D6D6CE" class="admi_links">New customers:</td>
                        </tr>
                      <tr>
                        <td height="10" bgcolor="#F7F7EF">
                        <!---->
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <? $sqlus="select * from  register ORDER BY user_id DESC LIMIT 0,5";
						   $exeus=mysql_query($sqlus); 
						   while($rowus=mysql_fetch_array($exeus))
						   {
							
						 ?>
                          <tr>
                            <td height="18" style=" padding-left:10px;"> 
                            <a href="customersid.php?userid=<? echo $rowus['user_id']; ?>" class="lax">
							<? 	echo $rowus['Fname']." ".$rowus['Lname']; ?> 
                          </a></td>  
                            </tr>
                            
                            <? }?>
                           </table>
                           <!---->
                          <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                              <td bgcolor="#D6D6CE" class="admi_links">Counter History for <br />
                                last 10 recorded days    Session - Total</td>
                            </tr>
                            <tr>
                              <td bgcolor="#F7F7EF" class="index_text"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                               <?php /*?> <tr>
                                
                                  <td height="18" style=" padding-left:10px;">
								  <?php

$sql = mysql_query("SELECT * FROM `ip_hits`");
while ($hit = mysql_fetch_array($sql)) {
  echo $hit["ip"]. ' - ' .$hit["clicks"]. ' (Last visit: ' .$hit["date"]. ')';
}
?></td>
                                </tr><?php */?>
                                
                                					  <?php

$sql = mysql_query("SELECT * FROM ip_hits order by ipid desc limit 0,10");
while ($hit = mysql_fetch_array($sql)) {
	
	?>
                                
                                <tr>
                            <td height="18" style=" padding-left:10px;"> 
                          
							<? 	echo $hit["ip"]. ' - ' .$hit["clicks"]. ' (Last visit: ' .$hit["date"]. ')';?> 
                          </td>  
                            </tr> 
                                
                              <? } ?>  
                                
                                
                                
                                <tr>
                                  <td height="18">&nbsp;</td>
                                </tr>
                              </table></td>
                            </tr>
                          </table></td>
                        </tr>
                      </table></td>
                    <td width="10">&nbsp;</td>
                    <td width="390" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="250" height="25" bgcolor="#D6D6CE" class="admi_links">New Orders:</td>
                        </tr>
                      <tr>
                        <td height="10" bgcolor="#F7F7EF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                        
                             <? $cat="Select a.Fname,a.Lname,b.status,b.CARTID,b.USERID from register as a, tblcart as b where a.user_id=b.USERID order by CARTID desc limit 0,4"; 
										     $catres=mysql_query($cat);
											 while($catrow=mysql_fetch_array($catres))
											 {
							
						 ?>
                          <tr>
                            <td height="18" style="padding-left:10px;">
							 <a href="orderdetails.php?cartid=<? echo $catrow[3]; ?>"class="lax">
							<?php echo ucfirst($catrow[0])." ".$catrow[1]; ?>&nbsp;&nbsp;&nbsp;
                         
      <?php if($catrow[2]==1)  echo "Not Verified"; if($catrow[2]==2)  echo "Paid"; if($catrow[2]==3)  echo "Shipped"; if($catrow[2]==4)  echo "delivered"; if($catrow[2]==5)  echo "Cancelled"; if($catrow[2]==0)  echo "NULL";?>
      
          </a></td>
                            </tr>
                            <? } ?>
                         
                          </table></td>
                        </tr>
                      </table></td>
                  </tr>
                  </table></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
          </tr>

          <tr>
            <td><? require_once("footer.php"); ?></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
