while ($myRow = safe_fetch($Rs)) { $Msg .= get_text('Importing', 'HTT', substr($myRow->HdTargetNo, 1)) . '...'; $Start = $myRow->HdArrowStart - 1; $Len = $myRow->HdArrowEnd - $myRow->HdArrowStart + 1; $ArrowString = substr_replace(str_pad($myRow->ArrowString, 90, " ", STR_PAD_RIGHT), substr($myRow->HdArrowString, 0, $Len), $Start, $Len); //print $myRow->HdTargetNo . ' ...' . $ArrowString . '...<br><br>'; // Ora posso calcolare i punti della distanza $Score = 0; $Gold = 0; $XNine = 0; $Update = ""; list($Score, $Gold, $XNine) = ValutaArrowStringGX($ArrowString, $G, $X); // Ora posso aggiornare la riga di Qualifications $Update = "UPDATE Qualifications SET " . "QuD" . $Dist . "Score=" . StrSafe_DB($Score) . "," . "QuD" . $Dist . "Gold=" . StrSafe_DB($Gold) . "," . "QuD" . $Dist . "Xnine=" . StrSafe_DB($XNine) . "," . "QuD" . $Dist . "ArrowString=" . StrSafe_DB($ArrowString) . "," . "QuD" . $Dist . "Hits=GREATEST(LENGTH(RTRIM(QuD" . $Dist . "ArrowString))," . StrSafe_DB($LastArr) . ")," . "QuScore=QuD1Score+QuD2Score+QuD3Score+QuD4Score+QuD5Score+QuD6Score+QuD7Score+QuD8Score," . "QuGold=QuD1Gold+QuD2Gold+QuD3Gold+QuD4Gold+QuD5Gold+QuD6Gold+QuD7Gold+QuD8Gold," . "QuXnine=QuD1Xnine+QuD2Xnine+QuD3Xnine+QuD4Xnine+QuD5Xnine+QuD6Xnine+QuD7Xnine+QuD8Xnine, " . "QuHits=QuD1Hits+QuD2Hits+QuD3Hits+QuD4Hits+QuD5Hits+QuD6Hits+QuD7Hits+QuD8Hits, " . "QuTimestamp=" . StrSafe_DB(date('Y-m-d H:i:s')) . " " . "WHERE QuId=" . StrSafe_DB($myRow->HdEnId) . " "; $RsUp = safe_w_sql($Update); useArrowsSnapshot($xSession, $Dist, substr($myRow->HdTargetNo, 1, -1), substr($myRow->HdTargetNo, 1, -1), $LastArr); recalSnapshot($xSession, $Dist, substr($myRow->HdTargetNo, 1, -1), substr($myRow->HdTargetNo, 1, -1)); //print $Update . '<br><br>'; // if() if ($RsUp) { $Msg .= get_text('CmdOk') . '<br>'; } else { $Msg .= '<br>'; } } // rank distanza CalcQualRank($Dist, '%'); // rank totale CalcQualRank(0, '%'); // rank abs sulla distanza CalcRank($Dist);
// Qualification require_once 'Qualification/Fun_Qualification.local.inc.php'; $ArrowsPerEnd = 3; $SQL = "Select QuId, QuSession from Qualifications\n\t\t\tinner join Entries on QuId=EnId\n\t\t\twhere EnTournament={$CompId} and QuTargetNo=" . StrSafe_DB($_REQUEST['qutarget']); $q = safe_r_SQL($SQL); $ArrowSearch = safe_fetch($q); // debug_svela($r); $PageOutput = 'JSON'; $_REQUEST['Index'] = $_REQUEST['arrowindex']; $_REQUEST['Dist'] = $_REQUEST['distnum']; $_REQUEST['Id'] = $ArrowSearch->QuId; $_REQUEST['Point'] = $_REQUEST['arrowsymbol']; $BlockApi = false; require_once 'Qualification/UpdateArrow.php'; if (!$BlockApi and !$JsonResult['error']) { useArrowsSnapshot($ArrowSearch->QuSession, $_REQUEST['distnum'], substr($_REQUEST['qutarget'], 1, -1), substr($_REQUEST['qutarget'], 1, -1), $_REQUEST['arrowindex'] + 1); recalSnapshot($ArrowSearch->QuSession, $_REQUEST['distnum'], substr($_REQUEST['qutarget'], 1, -1), substr($_REQUEST['qutarget'], 1, -1)); } } } else { require_once 'Final/Fun_MatchTotal.inc.php'; $tgtType = 0; $Error = 1; $SQL = "SELECT EvFinalTargetType FROM Events WHERE EvCode='" . $Event . "' AND EvTeamEvent={$EventType} AND EvTournament={$CompId}"; $Rs = safe_r_sql($SQL); if ($r = safe_fetch($Rs)) { $tgtType = $r->EvFinalTargetType; $Error = 0; } $arrowIndex = $_REQUEST['arrowindex'] + 1; if (empty($_REQUEST['arrowsymbol'])) {
*/ define('debug', false); // settare a true per l'output di debug require_once dirname(dirname(__FILE__)) . '/config.php'; require_once 'Qualification/Fun_Qualification.local.inc.php'; $Errore = 0; $xmlReturn = ''; if (!IsBlocked(BIT_BLOCK_QUAL)) { if (isset($_REQUEST["Session"]) && preg_match("/^[1-9]{1}\$/", $_REQUEST["Session"]) && isset($_REQUEST["Distance"]) && preg_match("/^[1-8]{1}\$/", $_REQUEST["Distance"]) && isset($_REQUEST["fromTarget"]) && preg_match("/^[0-9]{1,3}\$/", $_REQUEST["fromTarget"]) && isset($_REQUEST["toTarget"]) && preg_match("/^[0-9]{1,3}\$/", $_REQUEST["toTarget"])) { if (isset($_REQUEST["numArrows"]) && preg_match("/^[0-9]{1,2}\$/", $_REQUEST["numArrows"])) { if ($_REQUEST["numArrows"] == 0) { for ($i = 3; $i <= 30; $i += 3) { $xmlReturn .= '<numArrows>' . useArrowsSnapshot($_REQUEST["Session"], $_REQUEST["Distance"], $_REQUEST["fromTarget"], $_REQUEST["toTarget"], $i) . '</numArrows>' . "\n"; } } else { $xmlReturn .= '<numArrows>' . useArrowsSnapshot($_REQUEST["Session"], $_REQUEST["Distance"], $_REQUEST["fromTarget"], $_REQUEST["toTarget"], $_REQUEST["numArrows"]) . '</numArrows>' . "\n"; } } else { $xmlReturn .= '<numArrows>' . recalSnapshot($_REQUEST["Session"], $_REQUEST["Distance"], $_REQUEST["fromTarget"], $_REQUEST["toTarget"]) . '</numArrows>' . "\n"; } } else { $Errore = 1; } } else { $Errore = 1; } // produco l'xml di ritorno if (!debug) { header('Content-Type: text/xml'); } print '<response>' . "\n";