<?php 

include("code.php");
authorize();
$name=$_SESSION['admin_name'];
$id=getmemberid($link,$name);

if(isset($_POST['Approve'])){
$appcode=$_POST['appcode'];
$status=$_POST['status'];	
$gcode=rand(0,7729);
		if($status=='Null')
		{
			echo "<script>alert('Please Select Status')</script>";
			echo "<script>location='AppRecharge.php'</script>";
		
		}else{
			$result=mysqli_query($link,"select * from ticket where code='$code'");
			$num=mysqli_num_rows($result);
			if($num>0){		
				$sql="update ticket set status='$status' where code='$apppcode'";
				echo "<script>alert('Member Approval Updated Succesfully')</script>";
					echo "<script>location='dashboard.php'</script>";
			}else{
				$rest=mysqli_query($link,"insert into ticket values('Null','$appcode','$gcode','$status')");
				echo "<script>alert('Member Approved Succesfully')</script>";
					echo "<script>location='dashboard.php'</script>";
				
			}
			
		}
}
?>

<!DOCTYPE html>
<html lang="en">

  <head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>OSEM COMPANY INTL | Recharge Now</title>

    <!-- Bootstrap core CSS-->
    <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="img/GreenPics/logo.jpg" rel="icon">
    <!-- Custom fonts for this template-->
    <link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">

    <!-- Custom styles for this template-->
    <link href="css/sb-admin.css" rel="stylesheet">

  </head>

  <body class="bg-dark">

    <div class="container">
      <div class="card card-login mx-auto mt-5">
        <div class="card-header">Online Recharge Approval</div>
        <div class="card-body">
          <div class="text-center mb-4">
            <h4>Approve With OCI-CODE</h4>
            <p>Select Approve Status.</p>
          </div>
          <form action="" method="post" enctype="multipart/form-data" name="register" class="left" id="upload">
            <div class="form-group">
              <div class="form-label-group">
                <input type="text" id="inputEmail" class="form-control" name="appcode" placeholder="Enter Oci-Code" required="required" autofocus="autofocus">
                <label for="inputEmail">Enter OCI-CODE</label>
              </div>
              
            </div>
            <div class="form-group">
              <div class="form-label-group">
               <select id="w3_country" name="status" onchange="change_country(this.value)" class="form-control">
						<option value="Null">Select Amount</option>
						<option value="YES">YES</option>   
						<option value="NO">NO</option>   
												
					</select>
              </div>
              
            </div>
            <input type="submit" name="Approve" class="form-control" style="background-color:#036; color:#FFF;" value="Recharge Now" />
             <a class="form-control" href="dashboard.php" style="background-color:#036; color:#FFF;">Go Back</a>
          </form>
          
        </div>
      </div>
    </div>

    <!-- Bootstrap core JavaScript-->
    <script src="vendor/jquery/jquery.min.js"></script>
    <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>

    <!-- Core plugin JavaScript-->
    <script src="vendor/jquery-easing/jquery.easing.min.js"></script>

  </body>

</html>
