<?php 

$serviceID = $network;

$query_pol = mysqli_query($conn,"SELECT * FROM portal_billing");
$pol = mysqli_fetch_array($query_pol);

$query_rec = mysqli_query($conn,"SELECT * FROM billing");
$bill = mysqli_fetch_array($query_rec);

$query_agent = mysqli_query($conn,"SELECT * FROM agent_billing");
$agentbil = mysqli_fetch_array($query_agent);

$query_regular = mysqli_query($conn,"SELECT * FROM regular_billing");
$Regbil = mysqli_fetch_array($query_regular);
	
$Portal = 'portal';
$Reseller  = 'paid';
$Agent  = 'agent';
$free  = 'free';


if($level == $Portal ){

$dstv = $pol['dstv'];
$gotv = $pol['gotv'];
$startimes = $pol['startimes'];
$smile = $pol['smile'];
$charge = 0;


}elseif($level == $Reseller ){

$dstv = $bill['dstv'];
$gotv = $bill['gotv'];
$startimes = $bill['startimes'];
$smile = $bill['smile'];
$charge = 0;

		
}elseif($level == $Agent){

$dstv = $agentbil['dstv'];
$gotv = $agentbil['gotv'];
$startimes = $agentbil['startimes'];
$smile = $agentbil['smile'];
$charge = $agentbil['conv'];

	
}elseif($level == $free){
		
$dstv = $Regbil['dstv'];
$gotv = $Regbil['gotv'];
$startimes = $Regbil['startimes'];
$smile = $Regbil['smile'];
$charge = $regbil['conv'];

                                         
                                                
}else{

$dstv = 0;
$gotv = 0;
$startimes = 0;
$smile = 0;
$charge = 50;

 }




$query_go = mysqli_query($conn,"SELECT * FROM gotv");
	$mygotv = mysqli_fetch_array($query_go);

$query_ds = mysqli_query($conn,"SELECT * FROM dstv");
	$mydstv = mysqli_fetch_array($query_ds);

$query_st = mysqli_query($conn,"SELECT * FROM startimes");
	$mystar = mysqli_fetch_array($query_st);

	$gotv_smallieA = $mygotv['smallieA'];
	$gotv_smallieB = $mygotv['smallieB'];
	$gotv_smallieC = $mygotv['smallieC'];
	$gotv_jinja = $mygotv['jinja'];
	$gotv_jolli = $mygotv['jolli'];
	$gotv_max = $mygotv['max'];
	
	
	$startimes_novaA = $mystar['novaA'];
        $startimes_novaB = $mystar['novaB'];
        $startimes_nova = $mystar['nova'];

	$startimes_basicA = $mystar['basicA'];
        $startimes_basicB = $mystar['basicB'];
        $startimes_basic = $mystar['basic'];

	$startimes_smartA = $mystar['smartA'];
        $startimes_smartB = $mystar['smartB'];
        $startimes_smart = $mystar['smart'];

	$startimes_classicA = $mystar['classicA'];
        $startimes_classicB = $mystar['classicB'];
        $startimes_classic = $mystar['classic'];

	$startimes_uniqueA = $mystar['uniqueA'];
        $startimes_uniqueB = $mystar['uniqueB'];
        $startimes_unique = $mystar['uniqueC'];

	$startimes_superA = $mystar['superA'];
        $startimes_superB = $mystar['superB'];
        $startimes_super = $mystar['super'];
	
	$dstv_padi = $mydstv['padi'];
	$dstv_yanga = $mydstv['yanga'];
	$dstv_confam = $mydstv['confam'];
	$dstv_compact = $mydstv['compact'];
	$dstv_compact_plus = $mydstv['compact_plus'];
	$dstv_premium = $mydstv['premium'];
	$dstv_asia = $mydstv['asia'];
	$dstv_premium_french = $mydstv['premium_french'];



if($serviceID === 'GOTV' || $serviceID === 'gotv' ){
$ckcode = "02";
$per = $gotv;
$product = "GOTV Payment";
		
	
	
			
}elseif($serviceID === 'DSTV' || $serviceID === 'dstv'){
$ckcode = "01";
$per = $dstv;
$product = "DSTV Payment";
			
				
}elseif($serviceID === 'STARTIMES' || $serviceID === 'startimes'){
$per = $startimes;
$product = "Startimes Payment";
$ckcode = "03"; }


							
if($variation_code === 'gotv_smallie' ){

$amount = $gotv_smallieA;
$vcode = "gotv-smallie";
$smartcode = "gotv_smallie";
$mobcode = "gotv_smallie";
$nigcode = "";
$clubcode = "gotv-smallie";
$bizcode = "";		

			
				
}elseif($variation_code === 'gotv_smallie_3months' ){
				
$amount = $gotv_smallieB;
$vcode = "gotv-smallie-3months";
$smartcode = "";
$mobcode = "";
$nigcode = "";
$clubcode = "gotv-smallie-3months";
$bizcode = "";

	
			
}elseif($variation_code === 'gotv_smallie_1year' ){
					
$amount = $gotv_smallieC;
$vcode = "gotv-smallie-1year";
$smartcode = "";
$mobcode = "";
$nigcode = "";
$clubcode = "gotv-smallie-1year";
$bizcode = "";

				
}elseif($variation_code === 'gotv_jinja' ){

$amount = $gotv_jinja ;
$vcode = "gotv-jinja";
$smartcode = "gotv_jinja";
$mobcode = "gotv_jinja";
$nigcode = "";
$clubcode = "gotv-jinja";
$bizcode = "";


}elseif($variation_code === 'gotv_jolli' ){
				
$amount = $gotv_jolli;
$vcode = "gotv-jolli";
$smartcode = "gotv_jolli";
$mobcode = "gotv_jolli";
$nigcode = "";
$clubcode = "gotv-jolli";
$bizcode = "";	

	
			
}elseif($variation_code === 'gotv_max' ){
					
$amount = $gotv_max;
$vcode = "gotv-max";
$smartcode = "gotv_max";
$mobcode = "gotv_max";
$nigcode = "";
$clubcode = "gotv-max";
$bizcode = "";

		
				
}elseif($variation_code === 'startimes_nova_daily' ){

$amount = startimes_novaA;
$vcode = "nova-daily";
$smartcode = "";
$mobcode = "";
$nigcode = "";
$clubcode = "";
$bizcode = "";

}elseif($variation_code === 'startimes_nova_weekly' ){

$amount = startimes_novaB;
$vcode = "nova-weekly";
$smartcode = "";
$mobcode = "";
$nigcode = "";
$clubcode = "";
$bizcode = "";

}elseif($variation_code === 'startimes_nova' ){

$amount = $startimes_nova;
$vcode = "nova";
$smartcode = "startimes_nova";
$mobcode = "";
$nigcode = "";
$clubcode = "";
$bizcode = "";


}elseif($variation_code === 'startimes_basic_daily' ){
				
$amount = $startimes_basicA;
$vcode = "basic";
$smartcode = "";
$mobcode = "";
$nigcode = "";
$clubcode = "";
$bizcode = "";


}elseif($variation_code === 'startimes_basic_weekly' ){
				
$amount = $startimes_basicB;
$vcode = "basic";
$smartcode = "";
$mobcode = "";
$nigcode = "";
$clubcode = "";
$bizcode = "";


}elseif($variation_code === 'startimes_basic' ){
				
$amount = $startimes_basic;
$vcode = "basic";
$smartcode = "startimes_basic";
$mobcode = "";
$nigcode = "";
$clubcode = "";
$bizcode = "";	



}elseif($variation_code === 'startimes_smart_daily' ){
					
$amount = $startimes_smartA;
$vcode = "smart";
$smartcode = "";
$mobcode = "";
$nigcode = "";
$clubcode = "";
$bizcode = "";


}elseif($variation_code === 'startimes_smart_weekly' ){
					
$amount = $startimes_smartB;
$vcode = "smart";
$smartcode = "";
$mobcode = "";
$nigcode = "";
$clubcode = "";
$bizcode = "";

	
			
}elseif($variation_code === 'startimes_smart' ){
					
$amount = $startimes_smart;
$vcode = "smart";
$smartcode = "startimes_smart";
$mobcode = "";
$nigcode = "";
$clubcode = "";
$bizcode = "";


}elseif($variation_code === 'startimes_classic_daily' ){

$amount = $startimes_classicA;
$vcode = "classic";
$smartcode = "";
$mobcode = "";
$nigcode = "";
$clubcode = "";
$bizcode = "";


}elseif($variation_code === 'startimes_classic_weekly' ){

$amount = $startimes_classicB;
$vcode = "classic";
$smartcode = "";
$mobcode = "";
$nigcode = "";
$clubcode = "";
$bizcode = "";

				
}elseif($variation_code === 'startimes_classic' ){

$amount = $startimes_classic;
$vcode = "classic";
$smartcode = "startimes_classic";
$mobcode = "";
$nigcode = "";
$clubcode = "";
$bizcode = "";


}elseif($variation_code === 'startimes_super_daily' ){
				
$amount = $startimes_superA;
$vcode = "super";
$smartcode = "";
$mobcode = "";
$nigcode = "";
$clubcode = "";
$bizcode = "";


}elseif($variation_code === 'startimes_super_weekly' ){
				
$amount = $startimes_superB;
$vcode = "super";
$smartcode = "";
$mobcode = "";
$nigcode = "";
$clubcode = "";
$bizcode = "";


}elseif($variation_code === 'startimes_super' ){
				
$amount = $startimes_super;
$vcode = "super";
$smartcode = "startimes_super";
$mobcode = "";
$nigcode = "";
$clubcode = "";
$bizcode = "";


}elseif($variation_code === 'startimes_unique_daily' ){
					
$amount = $startimes_uniqueA;
$vcode = "unique";
$smartcode = "";
$mobcode = "";
$nigcode = "";
$clubcode = "";
$bizcode = "";


}elseif($variation_code === 'startimes_unique_weekly' ){
					
$amount = $startimes_uniqueB;
$vcode = "unique";
$smartcode = "";
$mobcode = "";
$nigcode = "";
$clubcode = "";
$bizcode = "";

	
			
}elseif($variation_code === 'startimes_unique' ){
					
$amount = $startimes_unique;
$vcode = "unique";
$smartcode = "startimes_unique";
$mobcode = "";
$nigcode = "";
$clubcode = "";
$bizcode = "";


                           	
				
}elseif($variation_code === 'dstv_padi' ){

$amount = $dstv_padi;
$vcode = "dstv-padi";
$smartcode = "dstv_padi";
$mobcode = "dstv_padi";
$nigcode = "";
$clubcode = "";
$bizcode = "";


}elseif($variation_code === 'dstv_yanga' ){
					
$amount = $dstv_yanga;
$vcode = "dstv-yanga";
$smartcode = "dstv_yanga";
$mobcode = "dstv_yanga";
$nigcode = "";
$clubcode = "";
$bizcode = "";	

				
}elseif($variation_code === 'dstv_confam' ){

$amount = $dstv_confam;
$vcode = "dstv-confam";
$smartcode = "dstv_confam";
$mobcode = "dstv_confam";
$nigcode = "";
$clubcode = "";
$bizcode = "";


}elseif($variation_code === 'dstv_compact' ){
					
$amount = $dstv_compact;
$vcode = "dstv79";
$smartcode = "dstv_compact";
$mobcode = "dstv_compact";
$nigcode = "";
$clubcode = "";
$bizcode = "";

				
}elseif($variation_code === 'dstv_compact_plus' ){

$amount = $dstv_compact_plus;
$vcode = "dstv7";
$smartcode = "dstv_compact_plus";
$mobcode = "dstv_compact_plus";
$nigcode = "";
$clubcode = "";
$bizcode = "";


}elseif($variation_code === 'dstv_premium' ){

$amount = $dstv_premium;
$vcode = "dstv3";
$smartcode = "dstv_premium";
$mobcode = "dstv_premium";
$nigcode = "";
$clubcode = "";
$bizcode = "";


}elseif($variation_code === 'dstv_asia' ){
					
$amount = $dstv_asia;
$vcode = "dstv6";
$smartcode = "";
$mobcode = "";
$nigcode = "";
$clubcode = "";
$bizcode = "";

				
}elseif($variation_code === 'dstv_premium_french'){ 

$amount = $dstv_premium_french;
$vcode = "dstv9"; 
$smartcode = "";
$mobcode = "";
$nigcode = "";
$clubcode = "";
$bizcode = "";


						
		}				
						
						
						
$amount = str_replace( array( '+', ',', '-', '/', '(', ')',   '_',  '//', 'drop', 'update', 'delete', 'insert', 'add',  '{',   '}',   '<',  '>',  '=', ' ', '  ', '   '), '', $amount);
	
$charge = str_replace( array( '+', ',', '-', '/', '(', ')',   '_',  '//', 'drop', 'update', 'delete', 'insert', 'add',  '{',   '}',   '<',  '>',  '=', ' ', '  ', '   '), '', $charge);
	
$per = str_replace( array( '+', ',', '-', '/', '(', ')',   '_',  '//', 'drop', 'update', 'delete', 'insert', 'add',  '{',   '}',   '<',  '>',  '=', ' ', '  ', '   '), '', $per);
							
						
						
				

?>