// break; // case 'cancel_suspend': // $trans_id = $_REQUEST['trans_id']; // CancelSuspended($trans_id); // break; case 'payment_done': $object_id = $_REQUEST['obj_id']; $user_id = $_COOKIE['USERID']; //$trans_id = $_REQUEST['trans_id']; $pay_type = $_REQUEST['pay_type']; $payed_money = $_REQUEST['payed_money']; //RestoreSuspended($object_id, $trans_id); $sum_cost = GetSumPrice($object_id); $sum_self_cost = GetSumSelfPrice($object_id); if ($sum_cost <= $payed_money) { $calculate = Calculate($object_id); PayDone($user_id, $object_id, $sum_cost, $sum_self_cost, $payed_money, $pay_type); } else { $error = "დაფიქსირდა შეცდომა პროდუქტების შეყვანისას! **სცადეთ თავიდან."; } break; case 'get_main_menu': //$object_id = $_REQUEST['obj_id']; $data = array('page' => getMainMenu()); break; case 'prod_ing_page': $object_id = $_REQUEST['obj_id']; $prod_id = $_REQUEST['prod_id']; $check = CheckProdType($prod_id); if (!$check) { $data = array('page' => GetProdPage($object_id, $prod_id));
define("FORMAT", "%.2f"); // Initiate curl $ch = curl_init(); // Disable SSL verification curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Will return the response, if false it print the response curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Set the url curl_setopt($ch, CURLOPT_URL, $url); // Execute $result = curl_exec($ch); // Closing curl_close($ch); // Will dump a beauty json :3 $dataset = json_decode($result, true); $calc = Calculate($dataset); //Display the response in table format print "<strong>Functional Water Points</strong>: " . $calc['functional_water_points'] . "<br>"; echo "<table><th>Number of Water Points<br></th>"; foreach ($calc['number_of_water_points'] as $waterpts => $item) { echo "<tr><td>" . $waterpts . "</td><td>" . $item . "</td></tr>"; } echo "</table>"; echo "<table><th>Community Name Rating</th>"; foreach ($calc['community_ranking'] as $ranking => $item) { echo "<tr><td>" . $ranking . "</td><td>" . $item . "</td></tr>"; } echo "</table>"; function Calculate($dataset) { $counts = array();