function delScout($s_id, $pilotid) { $qry = new DBQuery(true); $qry->execute("delete from kb3_scout where inp_kll_id = " . $this->killID_ . " and scout_id = " . $s_id . " limit 1"); //get pilot order to be deleted $pqry = new DBPreparedQuery(); $pqry->prepare("select ind_order from kb3_inv_detail where ind_kll_id = ? and ind_plt_id = ?"); $pqry->bind_param('ii', $this->killID_, $pilotid); $pqry->bind_result($scoutOrder); if (!$pqry->execute() || !$pqry->recordCount()) { return false; } else { $pqry->fetch(); } //get highest pilot order $pqry = new DBPreparedQuery(); $pqry->prepare("select max(ind_order) from kb3_inv_detail where ind_kll_id = ?"); $pqry->bind_param('i', $this->killID_); $pqry->bind_result($maxScoutOrder); if (!$pqry->execute() || !$pqry->recordCount()) { return false; } else { $pqry->fetch(); } $qry->execute("delete from kb3_inv_detail where ind_kll_id = " . $this->killID_ . " and ind_plt_id = " . $pilotid . " and ind_shp_id = '9999' limit 1"); //reorder remaining scouts for ($i = $scoutOrder + 1; $i <= $maxScoutOrder; $i++) { $qry->execute("update kb3_inv_detail set ind_order = '" . ($i - 1) . "' where ind_kll_id = '" . $this->killID_ . "' and ind_shp_id = '9999' and ind_order = '" . $i . "' limit 1"); } //remove from pilot's stats $qry->execute("SELECT 1 FROM kb3_sum_pilot WHERE psm_plt_id = '" . $pilotid . "'"); if ($qry->recordCount() > 0) { $this->kill = new Kill($this->killID_); $qry->execute("UPDATE kb3_sum_pilot SET psm_kill_count = psm_kill_count - 1, psm_kill_isk = psm_kill_isk - '" . $this->kill->getISKLoss() . "' WHERE psm_plt_id = '" . $pilotid . "' AND psm_shp_id = '" . $this->kill->getVictimShip()->getClass()->getID() . "'"); $qry->execute("UPDATE kb3_pilots SET plt_kpoints = plt_kpoints - '" . $this->kill->getKillPoints() . "' WHERE plt_id = '" . $pilotid . "'"); } //make sure involved count is shown correctly (it's generated before this class is loaded) header("Location: ?a=kill_detail&kll_id=" . $this->killID_); exit; }
switch ($_POST['add_type']) { case 0: $sql = "select crp.crp_id as id, crp.crp_name as name\n from kb3_corps crp\n where lower( crp.crp_name ) like '%" . $qry->escape(strtolower($_POST['add_name']), true) . "%'"; break; case 1: $sql = "select ali.all_id as id, ali.all_name as name\n from kb3_alliances ali\n where lower( ali.all_name ) like '%" . $qry->escape(strtolower($_POST['add_name']), true) . "%'"; break; case 2: $sql = "select reg_id as id, reg_name as name\n from kb3_regions\n where lower( reg_name ) like '%" . $qry->escape(strtolower($_POST['add_name']), true) . "%'"; break; case 3: $sql = "select sys_id as id, sys_name as name\n from kb3_systems\n where lower( sys_name ) like '%" . $qry->escape(strtolower($_POST['add_name']), true) . "%'"; break; } $qry->execute($sql) or die($qry->getErrorMsg()); if ($qry->recordCount()) { $html .= "<table class='kb-table' width='450'>"; $html .= "<tr class='kb-table-header'><td width='340'>Name</td><td width='80' align='center'>Action</td></tr>"; } else { $html .= "No matches found for '" . htmlentities($_POST['add_name']) . "'."; } while ($row = $qry->getRow()) { $html .= "<tr class='kb-table-row-even'>"; $editURL = edkuri::build(array(array('ctr_id', $ctrID, false), array('op', 'edit', false), array('add_type', (int) $_POST['add_type'], false), array('add_id', $row['id'], false))); switch ($_POST['add_type']) { case 0: $html .= '<td><a href="' . edkURI::page('corp_detail', $row['id'], 'crp_id') . '">' . $row['name'] . "</a></td><td align='center'><button id='submit' name='submit' onclick=\"window.location.href='" . $editURL . "'\">Select</button></td>"; break; case 1: $html .= '<td><a href="' . edkURI::page('alliance_detail', $row['id'], 'all_id') . '">' . $row['name'] . "</a></td><td align='center'><button id='submit' name='submit' onclick=\"window.location.href='" . $editURL . "'\">Select</button></td>"; break;
function validate() { $qry = new DBQuery(); $qry->execute("select * from kb3_contracts\n where ctr_id = " . $this->ctr_id_ . "\n\t\t and ctr_site = '" . KB_SITE . "'"); return $qry->recordCount() > 0; }