<?php header('Content-Type: text/html; charset=utf-8');?>
<?php 


include("cnf.php");?>
<?php include("selects.php");$queries = new DatabaseFunctions($db5);?>
<?php


if(isset($_POST['p3']) && 
   isset($_POST['factorid']) &&
   isset($_POST['countkala']) &&
   isset($_POST['numb']) &&
   isset($_POST['prices']) 
  ){


$p3 = $_POST['p3'];
$factorid = $_POST['factorid'];
$countkala = $_POST['countkala'];
$numb = $_POST['numb'];
$prices = $_POST['prices'];
  	
	
$valdataCheck = $queries -> getFactorValidation("EXEC check_send_factor @factorid = '$factorid', @ucid = '$p3'");	

$res = json_decode($valdataCheck,true);
$res = $res[0]["factorvalidation"][0];

if(sizeof($res) > 0){
	
$g_fid = $res["factoridz"]."";
$g_ck = $res["countkala"]."";
$g_sn = $res["sumnumb"]."";
$g_sp = $res["sumprice"]."";
$g_spzz = $res["sumprice"]."";	
$g_sp = bcadd($g_sp, 0, 6);	
$prices = bcadd($prices, 0, 6);	

//if((strcmp($factorid, $g_fid) == 0) && (strcmp($countkala, $g_ck) == 0) && (strcmp($numb, $g_sn) == 0) && (strcmp($prices, $g_sp) == 0)){	
	
if((strcmp($factorid, $g_fid) == 0) && (strcmp($countkala, $g_ck) == 0) && (strcmp($numb, $g_sn) == 0)){
	
	echo "1200";
	
}else{
	//$queries -> deleteFactor("EXEC delete_send_factor @factorid = '$factorid', @ucid = '$p3'");	
	echo "2400---".$g_fid."---".$prices;
	
}	



}else{
	
	echo "3600";
	
}


}else{


exit("Direct access not permitted.");
}
 

?>
