<?php 	
            include_once('../../config.php');  
  
  
  
			if(isset($_POST['submitF']))
			{   
    			
    			$encrypted_pwd = bin2hex(openssl_encrypt(($_POST['password']),'AES-128-CBC', $Pwdkey));   
    			$stmt=$conn->prepare("update  pw__usr set  passwprd=:password,is_active=:is_active   where cust_id=:cust_id  "); 
                $stmt->bindValue(':password',$encrypted_pwd, PDO::PARAM_STR); 
                $stmt->bindValue(':is_active', $_POST['Isactive'], PDO::PARAM_STR); 
                $stmt->bindValue(':cust_id', $_REQUEST['cust_id'], PDO::PARAM_STR);  
                $stmt->execute(); 
				header("Location: registered_users.php ");  
			} 

 
		
            $stmt=$conn->prepare("select * from   pw__usr where cust_id=:cust_id  ");     
            $stmt->bindValue(':cust_id', $_REQUEST['cust_id'], PDO::PARAM_STR);  
            $stmt->execute();  
            $starlineRT = $stmt->fetch(PDO::FETCH_OBJ);    
		    $decrypted = openssl_decrypt(hex2bin($starlineRT->passwprd),'AES-128-CBC',$Pwdkey);  
		 
?>  
<?php  include ABS_PATH.'/admin/header.php';	?>  


 <script>
	$(function() {
		$( "#datepicker" ).datepicker(); 
	}); 
  
	$(document).ready(function()
	{   

	
	$("#product_frm").validate({
		
		errorElement:'div',
		rules:{ 
			city:{
				required: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> Edit   Update</h3></div>    
								
								<div class="panel-options"> 

								   <input type="button"  class="btn btn-warning" name="btnback" id="btnback" value=" Back " onClick="javascript:location.href='registered_users.php';" />
								  
								</div>
							  
								 
							</div>
							
							
			  				<div class="panel-body">    
			  					<form class="form-horizontal" role="form" method="post" enctype="multipart/form-data" id="product_frm"> 
							   	 <div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">Name</label>
								    <div class="col-sm-10">
								      <input name="Ctname" class="form-control"   placeholder="Username"   required value="<?php echo $starlineRT->name; ?>" readonly>
								    </div>
								 </div>
								 <hr>
								  <div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">Password</label>
								    <div class="col-sm-10">
								      <input name="password" class="form-control"   placeholder="Password"   required value="<?php echo $decrypted;?>">
								    </div>
								 </div>
								 <hr>
								 
								  <div class="form-group">
								    <label for="inputEmail3" class="col-sm-2 control-label">Active</label>
								    <div class="col-sm-10">
								      <select class="form-control" name="Isactive">
								          <option value="1" <?php if($starlineRT->is_active==1) echo "selected";?> > Active</option>
								          <option value="0" <?php if($starlineRT->is_active==0) echo "selected";?> > Inactive</option>
								      </select>
								    </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="submitF" value="Update">
										</div>
								  </div>   
								</form>
								
								
							
			  				</div>
			  			</div>
	  				</div>
	  				 
	  			</div>

	  			 


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

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