<?php session_start();  //Developed by ITechScripts
 require 'include/configurations.php'; // ITECHBIDS Configuration File 
 require 'include/header.php';
 $ldate=$_POST['ldate'];
 $update=$_POST['upd'];
 $sid=$_POST['sid'];
 $id=$_GET['id'];
                            $sql_reg="select * from member_details";
							$res_reg=mysql_query($sql_reg);
							$tot_reg=mysql_num_rows($res_reg);
							$sql_sold="select * from auction_details where quantity_sold > 0";
							$res_sold=mysql_query($sql_sold);
							$tot_sold=mysql_num_rows($res_sold);
							$sql_live="select * from auction_details where status='Active'";
							$res_live=mysql_query($sql_live);
							$tot_live=mysql_num_rows($res_live);
					
 /* if(empty($_SESSION[userid]))
{ */
?>
<form name="stat" action="statistics.php" method="post">
<table border="0" align="center" cellpadding="5" cellspacing="0" width="100%" class="ft">
	<tr>
	<td colspan="2" class="ct" height="30" valign="middle" align="center">&nbsp;&nbsp;
	<b>Site Statistics</b></td></tr>
 <?
 if($sid==1)
 {
 if($ldate)
 {
 $sql="update genaralsettings set set_value='$ldate' where set_id='16'";
 $exe=mysql_query($sql);
 }
 if($update)
 {
 $sql="update genaralsettings set set_value='$update' where set_id='17'";
 $exe=mysql_query($sql);
 }
 echo "<tr><td colspan=2 align=center><font size=2 color=red><b>Updated Successfully!</b></font></td></tr>";
 }
 ?>
	<tr><td>&nbsp;&nbsp;&nbsp;<b>Total Users:</b></td><td><? if($tot_reg!=0) ?><?= $tot_reg; ?></td>
	</tr>
	<tr><td>&nbsp;&nbsp;&nbsp;<b>Total Items Sold:</b></td><td>
	<?= $tot_sold; ?>
	</td>
	</tr>
	<tr><td>&nbsp;&nbsp;&nbsp;<b>Total Live Auctions:</b></td><td><?= $tot_live; ?></td>
	</tr>
    <? 
	$sql="select * from member_details where onlinestatus='Online'";
	$exe=mysql_query($sql);
	$numrows=mysql_num_rows($exe);
	$datsql="select * from genaralsettings where set_id='16'";
	$datexe=mysql_query($datsql);
	$dat=mysql_fetch_array($datexe);
	$sid=$dat['set_id'];
	
	$ldate=$dat['set_value'];
	

	$days="select (to_days(now())-to_days('$ldate')) as launch from genaralsettings";
	$dexe=mysql_query($days);
	$dret=mysql_fetch_array($dexe);
	$datsql="select * from genaralsettings where set_name='last_update'";
	$datexe=mysql_query($datsql);
	$dat=mysql_fetch_array($datexe);
	$sid=$dat['set_id'];
	$last_update=$dat['set_value'];	
	$ret=$dret['launch'];
	
	
	?>
	<input type="hidden" name="sid" value="1">
	<tr><td><b>&nbsp;&nbsp;&nbsp;&nbsp;Site Started:</b></td><td><input type="text" class="bluetext"name="ldate" value="<?=$ldate ?>"></td></tr>
	<tr><td><b>&nbsp;&nbsp;&nbsp;&nbsp;Days Running:</td><td></b><?=$ret; ?></td></tr>
	<tr><td><b>&nbsp;&nbsp;&nbsp;&nbsp;Last Update:</td><td><input type="text" class="bluetext"name="upd" value="<?=$last_update; ?>"></b></td></tr>
	<tr><td>&nbsp;</td></tr>
	<tr><td colspan="2" align="center"><input name="sub" type="submit" class="button" value="Update"></td></tr>
	
	</table>
	</form>
	<br>
	<?
	  //}
	 require 'include/footer.php'; ?>	
