<?php 	
            include_once('../../config.php');     
			if(isset($_POST['submit']))
			{   
		 	    mysql_query("update players set  isActive = $_POST[status] where custId = '$_REQUEST[id]'   "); 
			 	
			 	if($_POST[amount]!='')
			 	{
    			 	mysql_query("update   wallet set amount  = amount +  $_POST[amount]  where custId = '$_REQUEST[id]'   "); 
    				$wlt = mysql_fetch_object(mysql_query("select amount from wallet  where custId = '$_REQUEST[id]' "));
    				
    				$Gdate = date("d-M-Y H:i");
    				$adminDate = date("d-M-Y");
    			 	
    			 	mysql_query("insert into  biddings (custId,Points,Gdate,adminDate,balance,creditDebit) values('$_REQUEST[id]',$_POST[amount],'$Gdate','$adminDate',$wlt->amount,1)");
			 	}
			    header("Location: users.php ");  
			    die;
			}   
			
			$SingleCloseResult = mysql_query("select * from  players where custId = '$_REQUEST[id]'   "); 
			$SingleClose  = mysql_fetch_object($SingleCloseResult);
			 
		 
?>  
<?php  include ABS_PATH.'/admin/header.php';	?>  


 <script>
	$(function() {
		$( "#datepicker" ).datepicker(); 
		$("#ShowSingleAn").hide();
		$("#ShowJodi").hide();
		$("#ShowPanni").hide();
		
            $('#OptionSelect').on('change', function() 
            {
                if($(this).val()==1)
                {
                    $("#ShowSingleAn").show(500);
                	$("#ShowJodi").hide(500);
            		$("#ShowPanni").hide(500);
            		$("#AddValue").val(1);
                    
                }else if($(this).val()=='')
                {
                    
                    $("#ShowSingleAn").hide(500);
                	$("#ShowJodi").hide(500);
            		$("#ShowPanni").hide(500);
                }
            });

	}); 
  
	$(document).ready(function()
	{   

	
	$("#product_frm").validate({
		
		errorElement:'div',
		rules:{ 
			amount:{
				number:true				 
			} 
			
			
			
		},
		messages:{				
			 
			 city:{
				required:"Enter city name"				 
			} 
		}
	});


	});
 


</script>
		 
		 <div class="col-md-10">

	  			<div class="row">
	  				<div class="col-md-12">
	  					<div class="content-box-large">
							<div class="panel-heading">
								<div class="panel-title"> <h3>   Update  User</h3></div>    
								
								<div class="panel-options"> 

								   <input type="button"  class="btn btn-warning" name="btnback" id="btnback" value=" Back " onClick="javascript:location.href='users.php';" />
								  
								</div>
							  
								 
							</div>
							
							
			  				<div class="panel-body">    
			  					<form class="form-horizontal" role="form" method="post" enctype="multipart/form-data" id="product_frm" autocomplete ="off"> 
							   	 <div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">Status</label>
								    <div class="col-sm-3"> 
								        <select name="status"   class="form-control" >  
								            <option value="1" <?php if($SingleClose->isActive==1) echo "selected";?> > Active</option>  
								            <option value="0" <?php if($SingleClose->isActive==0) echo "selected";?> > Deactive</option>  
								        </select>
								    </div>
								 </div>
								 <hr>
								 
							 
								 
								 <div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">Add Wallet</label>
								    <div class="col-sm-3"> 
								        <input type="text" placeholder="Enter amount" class="form-control" name="amount" />
								    </div>
								 </div>
								 <hr>
								  
								  
								  
								  
								  <div class="form-group">
										<label for="inputEmail3" class="col-sm-2 control-label">Update</label>
										<div class="col-sm-10">
										  <input type="submit"    class="btn btn-primary"  name="submit" value="Update">
										  <input type="hidden" name="AddValue" id="AddValue">
										  
										  
										</div>
								  </div>   
								</form>
								
								
							
			  				</div>
			  			</div>
	  				</div>
	  				 
	  			</div>

	  			 


	  		<!--  Page content -->
		  </div>
		</div>
    </div>

<?php  include ABS_PATH.'/admin/footer.php';	?>    