<?php 
header("Access-Control-Allow-Headers: Authorization, Content-Type");
header("Access-Control-Allow-Origin: *");


$input = file_get_contents("php://input");
$post = json_decode($input, true);
if((isset($_SERVER['PHP_AUTH_USER'])) && (isset($_SERVER['PHP_AUTH_PW'])))
{
if(($_SERVER['PHP_AUTH_USER']=="Xh83!sA") && ($_SERVER['PHP_AUTH_PW']=="HshFla72nsFa,s==ds0adsd028-=29ndgala")){


$unit=$post["unit"];
$npsn=$post["npsn"];
include("confiq.php");
$koneksi=koneksi_tabungan($npsn);

									//cek saldo siswa	
									$qry_rek=mysqli_query($koneksi,"SELECT * FROM `tb_rekening_kantin` WHERE idanggota='".$unit."' order by id desc limit 1");
									$row_rek=mysqli_fetch_array($qry_rek);
									if(mysqli_num_rows($qry_rek)<>0){
									$saldo=$row_rek['saldo'];
									
										$MyJson['status']='00';		
										$MyJson['saldo']=$saldo;
										$MyJson['information']='Transaksi Sukses';
										echo json_encode($MyJson); 
									}else {

										if($res){$MyJson['status']='01';	
										$MyJson['saldo']='0';	
										$MyJson['information']='Transaksi Gagal';
										echo json_encode($MyJson);} 
									}
							
					
				
} //end api
}  //end get api      

?>