<?php session_start();  //Developed by ITechScripts
   require 'include/configurations.php'; // ITECHBIDS Configuration File
?> 
<html>
<head>
<title>Admin</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>
<body>
<? 
 require 'include/header.php';
 $id=$_GET[id];
$default_currency="select * from genaralsettings where set_id=55";
$default_res=mysql_query($default_currency);
$default_row=mysql_fetch_array($default_res);
$default_cur=$default_row[set_value];
	$user_id=$_SESSION[userid];
	$query="select * from addfunds where member_id='$id'";
	$table=mysql_query($query);
	$total_fund_amount=0;
	
	if(mysql_num_rows($table)>0)
	while($row=mysql_fetch_array($table))
	$total_fund_amount +=$row['fund_amount'];
    //calculate total referral amount
	 $query="select * from referral_commission where user_id='$id'";
	 $table=mysql_query($query);
	$total_referral_commission=0;
	
	if(mysql_num_rows($table)>0)	
	{
	while($row=mysql_fetch_array($table))
	$total_referral_commission +=$row['referral_commission'];
    }
?>
 <table border="0" align="center" cellpadding="5" cellspacing="2" width="100%">
<tr align="center">
<td align="center"><a href="useritechds.php?id=<?=$id?>&type=gen">General</a></td>
<td><a href="useritechds.php?id=<?=$id?>&type=per">Personal</a></td>
<td><a href="useritechds.php?id=<?=$id?>&type=sell">Selling Details</a></td>
<td><a href="useritechds.php?id=<?=$id?>&type=buy">Buying Details</a></td>
<td><a href="usertrans.php?id=<?=$id?>">Transaction Details</a></td> 
</tr><tr align="center">
<td><a href="userauction.php?id=<?=$id?>">Posting Details</a></td>
<td><a href="userbid.php?id=<?=$id?>">Bid Details</a></td>
<td><a href="useraccount.php?id=<?=$id?>">Account Details</a></td> 
<td><a href="userref.php?id=<?=$id?>">Refferal Details</a></td>
<td><a href="addfunds.php?id=<?=$id?>">Add Funds</a></td>
</tr>
</table><BR><BR>
  <table border = "0" cellpadding="2" cellspacing="0" width=586 class="ft">
<tr height=20><td></td></tr>
	<tr>
	<td align="center">
	    
	     <table width="100%" >
		 <tr height=30 class="ct"><td align="center" colspan="2"><strong>Account</td></tr>
		 <tr height=30><td><b>Available Cash</td>  <td><b><? echo "$default_cur" ?> <? echo $total_fund_amount; ?></td></tr>
		 <tr height=30><td><b>Referral Income</td> <td><b><? echo "$default_cur" ?> <? echo $total_referral_commission; ?></td></tr>
		 <tr><td colspan="2"><hr></td></tr>
		 <tr height=30><td><b>Total Amount</td> <td><b><? echo "$default_cur" ?> <? echo ($total_fund_amount + $total_referral_commission);?></td></tr>
	     
</table>
	</td>
	</tr>
	</table>

<? require'include/footer.php'; ?>
  </body>
</html>
