<?php session_start();  //Developed by ITechScripts
?>
<?
require 'include/configurations.php'; // ITECHBIDS Configuration File 
$id=$_GET['id'];

$cansave=$_POST['cansave'];
$famount=$_POST['txtfamount'];
$addtype=$_POST['addtype'];
$today=date('Y-m-d');
//------------validatating variables--------------------------

if($cansave==1){
if (preg_match('/[^0-9]/', $famount)){ 
$pcflag=1;
$pmessage="Please enter a valid amount";
}

if ($famount==""){ 
$pcflag=1;
$pmessage="Please enter a valid amount";
}
}

if(($pcflag!=1)&&($cansave==1))
{  
if($addtype=="deduct")
{
		    $sql = "update member_details set bid_num=bid_num-'$famount' where user_id='$id'";
			$result = mysql_query($sql);
}
else
{
		    $sql = "update member_details set bid_num=bid_num+'$famount' where user_id='$id'";
			$result = mysql_query($sql);
}
$up_flag=1;
$famount="";
}

?>
>
<style type="text/css">
<!--
.style1 {
	color: #666666;
	font-weight: bold;
}
.style3 {color: #666666; font-size: 11px; font-family:Arial, Helvetica, sans-serif}
-->
</style>
  <? require 'include/header.php'; ?>

<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="usertrans.php?id=<?=$id?>">Transaction Details</a></td> 
</tr><tr align="center">
<td><a href="userbid.php?id=<?=$id?>">Bid Details</a></td>
<td><a href="userref.php?id=<?=$id?>">Refferal Details</a></td>
<td><a href="addfunds.php?id=<?=$id?>">Add Bids</a></td>
</tr>
</table><BR><BR>

<table width="80%">
  <tr><td align="center" colspan="10"><font size=2 color=red><? if($up_flag==1) echo "Updated Successfully"; ?></font></td></tr>
  <tr><form name="frm" method="post" onSubmit="this.cansave.value=1; return true();">
    <td colspan="8">
	<table width="80%" align="center" cellpadding="5" cellspacing="2" class="ft">
	<tr><td colspan="2" class="ct" height="25">Add/Deduct Bids</td></tr>
	<tr><td colspan="2" align="center">
	<?php 
	if($pmessage!='')
	{
echo "$pmessage";
	}
	?>

	</td></tr>
	<tr><td>
	Add/Deduct Bids</td>
	<td><input type="text" class="bluetext"name="txtfamount" value="<? echo "$famount" ?>"></td></tr>
<tr><td>
	Type</td>
	<td>  <select size="1" name="addtype">
  <option selected value="add">Add</option>
  <option value="deduct">Deduct</option>
  </select></td></tr>
	<tr><td align="center" colspan="2">
	<input type="hidden" name="cansave" value="0">
	<input type="submit" class="button"   name="submit"  value="Submit"></td></tr>
	</table></td>
    </form></tr></table>
<? require 'include/footer.php'?>