当前位置: 首页>>代码示例>>PHP>>正文


PHP safe_w_sql函数代码示例

本文整理汇总了PHP中safe_w_sql函数的典型用法代码示例。如果您正苦于以下问题:PHP safe_w_sql函数的具体用法?PHP safe_w_sql怎么用?PHP safe_w_sql使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了safe_w_sql函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_text

require_once 'Tournament/Fun_Tournament.local.inc.php';
if (!CheckTourSession() || !isset($_REQUEST['New_ClId']) || !isset($_REQUEST['New_ClSex']) || !isset($_REQUEST['New_ClDescription']) || !isset($_REQUEST['New_ClAthlete']) || !isset($_REQUEST['New_ClViewOrder']) || !isset($_REQUEST['New_ClAgeFrom']) || !isset($_REQUEST['New_ClAgeTo']) || !isset($_REQUEST['New_ClValidClass']) || !isset($_REQUEST['New_ClValidDivision'])) {
    print get_text('CrackError');
    exit;
}
$Errore = intval(IsBlocked(BIT_BLOCK_TOURDATA) && !defined('dontEditClassDiv'));
$MsgErrore = '';
if (!$Errore) {
    if (!is_numeric($_REQUEST['New_ClAgeFrom']) || !is_numeric($_REQUEST['New_ClAgeTo']) || $_REQUEST['New_ClAgeFrom'] <= 0 || $_REQUEST['New_ClAgeTo'] <= 0 || $_REQUEST['New_ClAgeFrom'] > $_REQUEST['New_ClAgeTo']) {
        $Errore = 1;
    }
}
if (!$Errore) {
    // Aggiungo la nuova riga
    $Insert = "INSERT IGNORE INTO Classes (ClId,ClTournament,ClDescription,ClAthlete,ClViewOrder,ClAgeFrom,ClAgeTo,ClValidClass,ClDivisionsAllowed,ClSex) " . "VALUES(" . StrSafe_DB($_REQUEST['New_ClId']) . "," . StrSafe_DB($_SESSION['TourId']) . "," . StrSafe_DB($_REQUEST['New_ClDescription']) . "," . StrSafe_DB(intval($_REQUEST['New_ClAthlete'])) . "," . StrSafe_DB($_REQUEST['New_ClViewOrder']) . ", " . StrSafe_DB($_REQUEST['New_ClAgeFrom']) . ", " . StrSafe_DB($_REQUEST['New_ClAgeTo']) . ", " . StrSafe_DB(CreateValidClass($_REQUEST['New_ClId'], $_REQUEST['New_ClValidClass'])) . ", " . StrSafe_DB($_REQUEST['New_ClValidDivision']) . ", " . StrSafe_DB($_REQUEST['New_ClSex']) . " " . ") ";
    $RsIns = safe_w_sql($Insert);
    //duplicate entries is OK
    if (!safe_w_affected_rows()) {
        $Errore = 2;
        $MsgErrore = get_text('DuplicateEntry', 'Tournament');
    }
}
header('Content-Type: text/xml');
print '<response>' . "\n";
print '<error>' . $Errore . '</error>' . "\n";
print '<errormsg><![CDATA[' . $MsgErrore . ']]></errormsg>' . "\n";
print '<new_clid><![CDATA[' . $_REQUEST['New_ClId'] . ']]></new_clid>' . "\n";
print '<new_cldescr><![CDATA[' . ManageHTML($_REQUEST['New_ClDescription']) . ']]></new_cldescr>' . "\n";
print '<new_clathleteyes><![CDATA[' . ManageHTML(get_text('Yes')) . ']]></new_clathleteyes>' . "\n";
print '<new_clathleteno><![CDATA[' . ManageHTML(get_text('No')) . ']]></new_clathleteno>' . "\n";
print '<new_clathlete><![CDATA[' . $_REQUEST['New_ClAthlete'] . ']]></new_clathlete>' . "\n";
开发者ID:brian-nelson,项目名称:ianseo,代码行数:31,代码来源:AddCl.php

示例2: GetSetupFile

/**
 * Serve per intefacciarsi a ProcessSetupFile(...)
 *
 * @param Int $Id: id del torneo
 *
 * @return void
 *
 */
function GetSetupFile($TourId, $ToType = 0, $Lang = '', $SubRule = '1', $useOldRules = false)
{
    static $ciclo = 0;
    global $CFG;
    if (!$ciclo) {
        // reset data if any
        $ToDelete = array('Divisions' => 'Div', 'Classes' => 'Cl', 'SubClass' => 'Sc', 'TournamentDistances' => 'Td', 'DistanceInformation' => 'Di', 'Eliminations' => 'El', 'Events' => 'Ev', 'EventClass' => 'Ec', 'Finals' => 'Fin', 'TeamFinals' => 'Tf', 'TargetFaces' => 'Tf');
        foreach ($ToDelete as $table => $pre) {
            safe_w_sql("delete from {$table} where {$pre}Tournament = {$TourId}");
        }
        /** search for $ToType file, and for localisation $Lang **/
        // cerco il file per il tipo  localizzato per $Lang
        if (file_exists($file = $CFG->DOCUMENT_PATH . 'Modules/Sets/' . $Lang . '/Setup_' . $ToType . '_' . $Lang . '.php') or file_exists($file = $CFG->DOCUMENT_PATH . 'Modules/Sets/FITA/Setup_' . $ToType . '.php')) {
            if (empty($SubRule)) {
                $SubRule = 1;
            }
            require_once $file;
        } else {
            die('No Setup File!');
        }
        // reset entries fields if any
        safe_w_sql("update Entries set EnDivision='' where EnTournament={$TourId} and EnDivision not in (select DivId from Divisions where DivTournament={$TourId})");
        safe_w_sql("update Entries set EnClass='' where EnTournament={$TourId} and EnClass not in (select ClId from Classes where ClTournament={$TourId})");
        safe_w_sql("update Entries set EnAgeClass='' where EnTournament={$TourId} and EnAgeClass not in (select ClId from Classes where ClTournament={$TourId})");
        safe_w_sql("update Entries set EnSubClass='' where EnTournament={$TourId} and EnSubClass not in (select ScId from SubClass where ScTournament={$TourId})");
        safe_w_sql("update Entries set EnTargetFace='' where EnTournament={$TourId} and EnTargetFace not in (select TfId from TargetFaces where TfTournament={$TourId})");
    }
    $ciclo++;
}
开发者ID:brian-nelson,项目名称:ianseo,代码行数:37,代码来源:Fun_ScriptsOnNewTour.inc.php

示例3: SetElimArrowValue

function SetElimArrowValue($Phase, $Event, $Target, $ArIndex, $ArSymbol, $Output = 'XML', $CompId = '')
{
    require_once 'Common/Lib/Obj_RankFactory.php';
    $JsonResult = array();
    $JsonResult['error'] = 1;
    $JsonResult['qutarget'] = $_REQUEST['qutarget'];
    $JsonResult['distnum'] = $_REQUEST['distnum'];
    $JsonResult['arrowindex'] = $_REQUEST['arrowindex'];
    $JsonResult['arrowsymbol'] = '';
    $JsonResult['curscore'] = '';
    $JsonResult['curgold'] = '';
    $JsonResult['curxnine'] = '';
    $JsonResult['score'] = '';
    $JsonResult['gold'] = '';
    $JsonResult['xnine'] = '';
    if (empty($CompId)) {
        $CompId = $_SESSION['TourId'];
    }
    $q = safe_r_sql("select * from Eliminations\r\n\t\twhere ElElimPhase=" . ($Phase[1] - 1) . "\r\n\t\tand ElEventCode='{$Event}'\r\n\t\tand ElTargetNo='{$Target}'\r\n\t\tand ElTournament={$CompId}\r\n\t\t");
    if ($r = safe_fetch($q)) {
        $Arrowstring = str_pad($r->ElArrowString, $ArIndex + 1, ' ', STR_PAD_RIGHT);
        $xx = GetLetterFromPrint($ArSymbol);
        $Arrowstring[$ArIndex] = str_pad($xx, 1, ' ', STR_PAD_RIGHT);
        list($CurScore, $CurGold, $CurXNine) = ValutaArrowStringGX($Arrowstring);
        safe_w_sql("update Eliminations\r\n\t\t\tset ElArrowString='{$Arrowstring}',\r\n\t\t\tElScore={$CurScore},\r\n\t\t\tElGold={$CurGold},\r\n\t\t\tElXnine={$CurXNine}\r\n\t\t\twhere ElElimPhase=" . ($Phase[1] - 1) . "\r\n\t\t\tand ElEventCode='{$Event}'\r\n\t\t\tand ElTargetNo='{$Target}'\r\n\t\t\tand ElTournament={$CompId}");
        if (safe_w_affected_rows()) {
            if ($Phase[1] == 1) {
                require_once 'Common/Fun_Sessions.inc.php';
                ResetElimRows($Event, 2);
            }
            Obj_RankFactory::create('ElimInd', array('tournament' => $CompId, 'eventsC' => array($Event . '@' . $Phase[1])))->calculate();
        }
        $JsonResult['error'] = 0;
        $JsonResult['arrowsymbol'] = $xx ? strtoupper($ArSymbol) : '';
        $JsonResult['curscore'] = $CurScore;
        $JsonResult['curgold'] = $CurGold;
        $JsonResult['curxnine'] = $CurXNine;
        $JsonResult['score'] = $CurScore;
        $JsonResult['gold'] = $CurGold;
        $JsonResult['xnine'] = $CurXNine;
    }
    return $JsonResult;
}
开发者ID:brian-nelson,项目名称:ianseo,代码行数:43,代码来源:Fun_Eliminations.local.inc.php

示例4: SetAccreditation

function SetAccreditation($Id, $SetRap = 0, $return = 'RicaricaOpener', $TourId = 0, $AccOp = 0)
{
    $RicaricaOpener = false;
    if (!$TourId) {
        $TourId = $_SESSION['TourId'];
    }
    if (!$AccOp) {
        $AccOp = $_SESSION['AccOp'];
    }
    /*
     * Devo prevenire l'insert se l'id è in stato 7.
     * Per farlo cerco lo stato del tizio.
     * Se è 7 vuol dire che uno ha cliccato sul bottone dopo aver aperto il popup e io non scrivo in db
     */
    $Select = "SELECT EnId FROM Entries\n\t\tWHERE EnId=" . StrSafe_DB($Id) . " AND EnTournament={$TourId} AND EnStatus='7' ";
    $Rs = safe_r_sql($Select);
    //TODO Patchare la query per supportare bene IpV6
    if (safe_num_rows($Rs) == 0) {
        $Insert = "INSERT INTO AccEntries\n\t\t\t(AEId,AEOperation,AETournament,AEWhen,AEFromIp,AERapp)\n\t\t\tVALUES(\n\t\t\t\t{$Id}," . StrSafe_DB($AccOp) . "," . StrSafe_DB($TourId) . "," . StrSafe_DB(date('Y-m-d H:i')) . "," . "INET_ATON('" . ($_SERVER['REMOTE_ADDR'] != '::1' ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1') . "'), " . StrSafe_DB($SetRap) . "" . ") ON DUPLICATE KEY UPDATE " . "AEWhen=" . StrSafe_DB(date('Y-m-d H:i')) . "," . "AEFromIp=INET_ATON('" . ($_SERVER['REMOTE_ADDR'] != '::1' ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1') . "') ";
        $RsIns = safe_w_sql($Insert);
        $RicaricaOpener = $return == 'RicaricaOpener' ? true : (safe_w_affected_rows() ? 'AccreditationOK' : 'AccreditationTwice');
    }
    return $RicaricaOpener;
}
开发者ID:brian-nelson,项目名称:ianseo,代码行数:24,代码来源:Lib.php

示例5: calcMaxTeamPerson

/**
 * calcMaxTeamPerson()
 * Calcola ed eventualmente scrive il numero massimo di persone in una squadra
 *
 * @param mixed $e: eventi di cui fare il calcolo. Se stringa verrà considerato l'evento;
 * 					se array verranno considerati gli eventi nel vettore
 * 					se array vuoto verranno considerati tutti gli eventi team del torneo
 * @param bool $write: true per scrivere il valore nella tabella; false altrimenti
 * @param int $t: torneo, se null prende quello aperto
 * @return mixed: false se ci sono stati errori; un array key=>value con key l'evento e value il numero
 */
function calcMaxTeamPerson($e = array(), $write = true, $t = null)
{
    $tournament = $t === null ? $_SESSION['TourId'] : $t;
    $events = array();
    if (!is_array($e)) {
        $events[] = StrSafe_DB($e);
    } elseif (count($e) > 0) {
        foreach ($e as $ee) {
            $events[] = StrSafe_DB($ee);
        }
    }
    $eventsFilter = "";
    if (count($events) > 0) {
        $eventsFilter = " AND EcCode IN(" . implode(',', $events) . ") ";
    }
    $q = "\n\t\t\tSELECT\n\t\t\t\tSUM(sqEcNumber) AS q,sqEcCode\n\t\t\tFROM\n\t\t\t\t(\n\t\t\t\t\tSELECT DISTINCT\n\t\t\t\t\t\tEcCode AS sqEcCode,EcTeamEvent AS sqEcTeamEvent,EcTournament AS sqEcTournament,EcNumber AS sqEcNumber\n\t\t\t\t\tFROM\n\t\t\t\t\t\tEventClass\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tEcTournament={$tournament} AND EcTeamEvent<>0 {$eventsFilter}\n\t\t\t\t) AS sq\n\t\t\tGROUP BY sqEcCode\n\t\t";
    //print $q.'<br><br>';
    $r = safe_r_sql($q);
    $ret = false;
    if (safe_num_rows($r) > 0) {
        $ret = array();
        while ($row = safe_fetch($r)) {
            $ret[] = array('event' => $row->sqEcCode, 'num' => $row->q);
            if ($write) {
                $q = "\n\t\t\t\t\t\tUPDATE\n\t\t\t\t\t\t\tEvents\n\t\t\t\t\t\tSET\n\t\t\t\t\t\t\tEvMaxTeamPerson={$row->q}\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tEvTournament={$tournament} AND EvTeamEvent=1 AND EvCode='{$row->sqEcCode}'\n\t\t\t\t\t";
                //print $q.'<br><br>';
                $rr = safe_w_sql($q);
            }
        }
    }
    return $ret;
}
开发者ID:brian-nelson,项目名称:ianseo,代码行数:43,代码来源:Fun_Various.inc.php

示例6: UpdateTourDetails

function UpdateTourDetails($TourId, $Field, $Value = '')
{
    if (!is_array($Field)) {
        $Field = array($Field => $Value);
    }
    $q = array();
    foreach ($Field as $k => $v) {
        $q[] = $k . '=' . StrSafe_DB($v);
    }
    safe_w_sql("update Tournament set " . implode(',', $q) . " where ToId={$TourId}");
}
开发者ID:brian-nelson,项目名称:ianseo,代码行数:11,代码来源:lib.php

示例7: dirname

require_once dirname(dirname(__FILE__)) . '/config.php';
require_once 'Common/Lib/Fun_DateTime.inc.php';
require_once 'Common/Fun_FormatText.inc.php';
require_once 'Tournament/Fun_Tournament.local.inc.php';
if (!CheckTourSession()) {
    print get_text('CrackError');
    exit;
}
if (isset($_REQUEST['Command'])) {
    if ($_REQUEST['Command'] == 'ADD') {
        $Insert = "INSERT INTO TournamentInvolved (TiTournament,TiType,TiCode,TiName) " . "VALUES(" . StrSafe_DB($_SESSION['TourId']) . "," . StrSafe_DB($_REQUEST['new_Type']) . "," . StrSafe_DB($_REQUEST['new_Matr']) . "," . StrSafe_DB($_REQUEST['new_Name']) . " " . ") ";
        $RsIns = safe_w_sql($Insert);
    } elseif ($_REQUEST['Command'] == 'DELETE') {
        if (isset($_REQUEST['IdDel'])) {
            $Delete = "DELETE FROM TournamentInvolved WHERE TiId=" . StrSafe_DB($_REQUEST['IdDel']) . " ";
            $RsDel = safe_w_sql($Delete);
            header('Location: ' . $_SERVER['PHP_SELF']);
            exit;
        }
    }
}
$TypeOptions = array(0 => '------');
$Sel = "\r\n\t\tSELECT\r\n\t\t\t*\r\n\t\tFROM\r\n\t\t\tInvolvedType\r\n\t\tORDER BY\r\n\t\t\tIF(ItJudge!=0,1,IF(ItDoS!=0,2,IF(ItJury!=0,3,4))) ASC, IF(ItJudge!=0,ItJudge,IF(ItDoS!=0,ItDoS,IF(ItJury!=0,ItJury,ItOC))) ASC\r\n\t";
//print $Sel;exit;
$RsSel = safe_r_sql($Sel);
if (safe_num_rows($RsSel) > 0) {
    while ($RowSel = safe_fetch($RsSel)) {
        //$Attr = ($RowSel->ItJudge==1 ? 'J' : '') . ($RowSel->ItDoS==1 ? 'D' : '');
        $TypeOptions[$RowSel->ItId] = get_text($RowSel->ItDescription, 'Tournament');
        // .  (strlen($Attr)>0 ? ' [' . $Attr . ']' : '');
    }
开发者ID:brian-nelson,项目名称:ianseo,代码行数:31,代码来源:ManStaffField.php

示例8: safe_w_sql

    if (safe_num_rows($Rs) == 0 || $RowBn->Customized == 0) {
        safe_w_sql("INSERT INTO BackNumber (BnTournament, BnFinal) VALUES (" . StrSafe_DB($_SESSION['TourId']) . "," . StrSafe_DB($BackNoFinal) . ")");
    }
    safe_w_sql("UPDATE BackNumber SET " . substr($TmpUpdate, 0, -2) . " WHERE BnTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND BnFinal=" . StrSafe_DB($BackNoFinal));
    if (isset($_FILES['UploadedBgImage']) && $_FILES['UploadedBgImage']['error'] == UPLOAD_ERR_OK && $_FILES['UploadedBgImage']['size'] > 0 && $_FILES['UploadedBgImage']['size'] <= 1048576) {
        $TmpData = addslashes($ImgString = fread(fopen($_FILES['UploadedBgImage']['tmp_name'], "r"), filesize($_FILES['UploadedBgImage']['tmp_name'])));
        $Rs = safe_w_sql("UPDATE BackNumber SET BnBackground='" . $TmpData . "' WHERE BnTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND BnFinal=" . StrSafe_DB($BackNoFinal));
        unlink($_FILES['UploadedBgImage']['tmp_name']);
        if ($im = @imagecreatefromstring($ImgString)) {
            imagejpeg($im, $CFG->DOCUMENT_PATH . 'TV/Photos/' . $_SESSION['TourCodeSafe'] . '-BackNo-' . $BackNoFinal . '.jpg', 90);
        }
    } elseif (isset($_REQUEST["DeleteBgImage"]) && $_REQUEST["DeleteBgImage"] == 1) {
        $Rs = safe_w_sql("UPDATE BackNumber SET BnBackground='' WHERE BnTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND BnFinal=" . StrSafe_DB($BackNoFinal));
        @unlink($CFG->DOCUMENT_PATH . 'TV/Photos/' . $_SESSION['TourCodeSafe'] . '-BackNo-' . $BackNoFinal . '.jpg');
    } elseif ($RowBn->Customized == 0 && $RowBn->ImgSize > 0) {
        safe_w_sql("UPDATE BackNumber SET BnBackground=" . StrSafe_DB($RowBn->BnBackground) . " WHERE BnTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND BnFinal=" . StrSafe_DB($BackNoFinal));
    }
    $Rs = safe_r_sql($Select);
    $RowBn = safe_fetch($Rs);
}
$JS_SCRIPT = array('<script type="text/javascript" src="' . $CFG->ROOT_DIR . 'Common/Fun_JS.inc.js"></script>', '<script type="text/javascript" src="' . $CFG->ROOT_DIR . 'Qualification/Fun_AJAX_index.js.php"></script>', '<script type="text/javascript" src="' . $CFG->ROOT_DIR . 'Common/ColorPicker/302pop.js"></script>');
$PAGE_TITLE = get_text('BackNumbers', 'BackNumbers');
include 'Common/Templates/head.php';
echo '<form id="PrnParameters" method="post" action="" enctype="multipart/form-data"><input type="hidden" name="BackNo" value="' . $BackNoFinal . '">';
echo '<table class="Tabella">';
echo '<tr><th class="Title" colspan="3">' . get_text('BackNumbers', 'BackNumbers') . ' - ';
switch ($BackNoFinal) {
    case 0:
        echo get_text('QualRound');
        break;
    case 1:
开发者ID:brian-nelson,项目名称:ianseo,代码行数:31,代码来源:BackNumber.php

示例9: StrSafe_DB

                            $Last = $ee . '_' . $mm;
                        }
                        if ($_REQUEST['T_' . $First] == 2 && $_REQUEST['T_' . $Last] == 2) {
                            $TieOk = false;
                        } else {
                            $TieOk = true;
                        }
                    }
                    if ($TieOk) {
                        $Update .= ",FinTie=" . StrSafe_DB($t) . " ";
                    } else {
                        $Tie_Error[$ee . '_' . $mm] = true;
                    }
                }
                $Update .= ",FinDateTime=" . StrSafe_DB(date('Y-m-d H:i:s')) . " " . "WHERE FinEvent='" . $ee . "' AND FinMatchNo='" . $mm . "' AND FinTournament=" . StrSafe_DB($_SESSION['TourId']) . " ";
                $RsUp = safe_w_sql($Update);
                if (debug) {
                    print $Update . '<br><br>';
                }
            }
        }
    }
    // Faccio i passaggi di fase
    foreach ($AllowedEvents as $event => $phase) {
        move2NextPhase($phase, $event);
    }
}
$PAGE_TITLE = get_text('MenuLM_Data insert (Table view)');
$JS_SCRIPT = array('<script type="text/javascript" src="' . $CFG->ROOT_DIR . 'Final/Individual/Fun_JS.js"></script>');
include 'Common/Templates/head.php';
?>
开发者ID:brian-nelson,项目名称:ianseo,代码行数:31,代码来源:InsertPoint2.php

示例10: isset

$Rev2 = isset($_REQUEST['Review2']) ? $_REQUEST['Review2'] : null;
if ($match % 2 != 0) {
    $match--;
}
$Errore = 0;
$msg = '';
$isBlocked = $TeamEvent == 0 ? IsBlocked(BIT_BLOCK_IND) : IsBlocked(BIT_BLOCK_TEAM);
if (is_null($event) || is_null($TeamEvent) || is_null($match) || $isBlocked) {
    $Errore = 1;
} else {
    if (strlen($Rev1) == 0 && strlen($Rev2) == 0) {
        $sql = "DELETE FROM Reviews " . "WHERE RevEvent=" . StrSafe_DB($event) . " AND " . "RevMatchNo =" . $match . " AND " . "RevTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND " . "RevTeamEvent=" . StrSafe_DB($TeamEvent);
        $Rs = safe_w_sql($sql);
    } else {
        $sql = "INSERT INTO Reviews (RevEvent, RevMatchNo, RevTournament, RevTeamEvent, RevLanguage1, RevLanguage2, RevDateTime) " . "VALUES(" . StrSafe_DB($event) . ", " . StrSafe_DB($match) . ", " . StrSafe_DB($_SESSION['TourId']) . ", " . StrSafe_DB($TeamEvent) . ", " . StrSafe_DB(urldecode($Rev1)) . ", " . StrSafe_DB(urldecode($Rev2)) . ", " . StrSafe_DB(date('Y-m-d H:i:s')) . ") " . "ON DUPLICATE KEY UPDATE RevLanguage1=" . StrSafe_DB(urldecode($Rev1)) . ", RevLanguage2=" . StrSafe_DB(urldecode($Rev2)) . ", RevDateTime=" . StrSafe_DB(date('Y-m-d H:i:s'));
        $Rs = safe_w_sql($sql);
        if (!safe_w_affected_rows()) {
            $Errore = 1;
        }
    }
}
if ($Errore == 0) {
    $msg = get_text('CmdOk');
} else {
    $msg = get_text('Error');
}
header('Content-Type: text/xml');
print '<response>' . "\n";
print '<error>' . $Errore . '</error>' . "\n";
print '<msg>' . $msg . '</msg>' . "\n";
print '</response>' . "\n";
开发者ID:brian-nelson,项目名称:ianseo,代码行数:31,代码来源:UpdateCommentary.php

示例11: setRow

 /**
  * setRow().
  * Imposta le IndRank degli elementi passati.
  *
  * Questo è il metodo da chiamare quando si risolvono gli spareggi perchè chi non passa ha la rank a posto
  * grazie a calculate() e gli altri (sia quelli a cavallo che i buoni di sicuro) vanno impostati a mano.
  *
  *
  * @param mixed $items: array degli elementi da scrivere.
  * 		La struttra è la seguente:
  * 			array(
  * 				array(
  * 					ath 		=> <id>		(chiave)
  * 					event 		=> <ev>		(chiave)
  *					dist		=> <dist> 	(chiave)
  * 					rank 		=> <rank>
  * 					tiebreak 	=> <arrowstring>
  * 					so 			=> <so>
  * 				)
  * 			)
  *		con <id> l'id della persona <ev> l'evento, <arrowstring> l'arrowstring delle frecce di tie (opzionale), <dist> la distanza (0 vuol dire IndRank),
  *		<rank> la rank da impostare (opzionale), e e <so> prima degli spareggi vale come la rank se non ci sono spareggi; 0 per chi non passa e negativo come la rank in caso di gialli (opzionale).
  *		L'arrowstring, e l'so comunque sono considerati solo se <dist>==0
  *
  *		Deve essere presente almeno un campo opzionale se no il metodo ritorna errore.
  *
  *
  * @return mixed: ritorna le affected_rows oppure false se c'è qualche errore
  * 		(non salva gli eventuali elementi successivi a quello che ha generato l'errore)
  */
 public function setRow($items = array())
 {
     // campi mandatory per $item
     $params = array('ath', 'event', 'dist');
     $affected = 0;
     foreach ($items as $item) {
         /*print '<pre>';
         		print_r($item);
         		print '</pre>';*/
         $paramsOk = true;
         $canUp = false;
         /*
          *  controllo che ci siano i campi mandatory
          */
         foreach ($params as $p) {
             if (!array_key_exists($p, $item)) {
                 $paramsOk = false;
                 $ret = false;
                 break;
             }
         }
         if (!$paramsOk) {
             continue;
         }
         $dd = $item['dist'] ? 'D' . $item['dist'] : '';
         $date = date('Y-m-d H:i:s');
         $q = "UPDATE " . "Individuals " . "SET " . "IndTimestamp='{$date}' ";
         /* campi opzionali e basta */
         if (array_key_exists('rank', $item)) {
             $canUp = true;
             $q .= ",Ind{$dd}Rank={$item['rank']}";
         }
         /*
          *  campi opzionali (se dist==0).
          *  In ogni caso i valori vengono scritti se e solo se la rank nuova è diversa dalla vecchia!
          */
         if ($item['dist'] == 0) {
             if (array_key_exists('tiebreak', $item)) {
                 $canUp = true;
                 $q .= ",IndTiebreak='{$item['tiebreak']}'";
             }
             if (array_key_exists('so', $item)) {
                 $canUp = true;
                 $q .= ",IndSO={$item['so']}";
             }
         }
         $q .= " WHERE " . "IndId=" . $item['ath'] . " AND IndEvent='" . $item['event'] . "' AND IndTournament=" . $this->tournament . " ";
         //print $q.'<br><br>';
         if (!$canUp) {
             return false;
         }
         $r = safe_w_sql($q);
         if (!$r) {
             $affected = false;
         } else {
             $affected += safe_w_affected_rows();
         }
         if (empty($item['fist']) && array_key_exists('rank', $item) && array_key_exists('hits', $item) && $item['hits'] % 3 == 0) {
             $q = "INSERT INTO IndOldPositions (IopId, IopEvent, IopTournament, IopHits, IopRank) " . "VALUES(" . $item['ath'] . ",'" . $item['event'] . "'," . $this->tournament . "," . $item['hits'] . "," . $item['rank'] . ") " . "ON DUPLICATE KEY UPDATE IopRank=" . $item['rank'];
             safe_w_sql($q);
         }
     }
     return $affected;
 }
开发者ID:brian-nelson,项目名称:ianseo,代码行数:94,代码来源:Obj_Rank_Abs_calc.php

示例12: implode

        } else {
            $MyUpQuery .= "FinTiePosition='" . implode('|', ArrowPositionSx) . "',";
        }
        $MyUpQuery .= "FinDateTime=" . StrSafe_DB(date('Y-m-d H:i:s')) . " ";
        $MyUpQuery .= "WHERE FinMatchNo=" . $MyRow->MatchNo . " AND FinEvent=" . StrSafe_DB($_REQUEST['Event']) . " AND FinTournament=" . StrSafe_DB($_SESSION['TourId']);
        $RsUpdate = safe_w_sql($MyUpQuery);
        //Aggiorno posizione frecce DX
        $MyUpQuery = "UPDATE Finals SET ";
        if ($_REQUEST["Volee"] != 'T') {
            $MyUpQuery .= "FinArrowPosition='" . implode('|', $ArrowPositionDx) . "',";
        } else {
            $MyUpQuery .= "FinTiePosition='" . implode('|', ArrowPositionDx) . "',";
        }
        $MyUpQuery .= "FinDateTime=" . StrSafe_DB(date('Y-m-d H:i:s')) . " ";
        $MyUpQuery .= "WHERE FinMatchNo=" . $MyRow->OppMatchNo . " AND FinEvent=" . StrSafe_DB($_REQUEST['Event']) . " AND FinTournament=" . StrSafe_DB($_SESSION['TourId']);
        $RsUpdate = safe_w_sql($MyUpQuery);
    }
}
/*********************
  Dati dello Scontro
**********************/
$Select = "SELECT " . "e.EnId AS Athlete, e.EnCode as Code, e.EnName AS Name, upper(e.EnFirstName) AS FirstName, c.CoCode AS NationCode, c.CoName AS Nation, " . "f.FinMatchNo AS MatchNo, IF(EvMatchMode=0,f.FinScore,f.FinSetScore) AS FinalScore, f.FinScore AS Score, f.FinSetScore as SetScore, f.FinSetPoints as SetPoints, f.FinTie as Tie, f.FinArrowString AS ArrowString, f.FinArrowPosition AS ArrPos, f.FinTieBreak AS TieBreak, f.FinTiePosition AS TiePos, " . "e2.EnId AS OppAthlete, e.EnCode as OppCode, e2.EnName AS OppName, upper(e2.EnFirstName) AS OppFirstName, c2.CoCode AS OppNationCode, c2.CoName AS OppNation, " . "f2.FinMatchNo AS OppMatchNo, IF(EvMatchMode=0,f2.FinScore,f2.FinSetScore) AS OppFinalScore, f2.FinScore AS OppScore, f2.FinSetScore as OppSetScore, f2.FinSetPoints as OppSetPoints, f2.FinTie as OppTie, f2.FinArrowString AS OppArrowString, f2.FinArrowPosition AS OppArrPos, f2.FinTieBreak AS OppTieBreak, f2.FinTiePosition AS OppTiePos, " . "EvCode AS Event, EvEventName AS EventName, GrPhase as Phase, EvMatchMode as MatchMode, EvMatchArrowsNo " . "FROM Events " . "INNER JOIN Finals AS f ON EvTournament=f.FinTournament AND EvCode=f.FinEvent AND EvTeamEvent='0' " . "LEFT JOIN Entries AS e ON f.FinAthlete=e.EnId AND f.FinTournament=e.EnTournament " . "LEFT JOIN Countries AS c ON e.EnCountry=c.CoId AND e.EnTournament=c.CoTournament " . "INNER JOIN Finals AS f2 ON f.FinEvent=f2.FinEvent AND f.FinMatchNo=IF((f.FinMatchNo % 2)=0,f2.FinMatchNo-1,f2.FinMatchNo+1) AND f.FinTournament=f2.FinTournament " . "LEFT JOIN Entries AS e2 ON f2.FinAthlete=e2.EnId AND f2.FinTournament=e2.EnTournament " . "LEFT JOIN Countries AS c2 ON e2.EnCountry=c2.CoId AND e2.EnTournament=c2.CoTournament " . "INNER JOIN Grids ON f.FinMatchNo=GrMatchNo " . "WHERE EvCode=" . StrSafe_DB($Event) . " AND EvTournament=" . StrSafe_DB($_SESSION['TourId']) . " " . "AND f.FinMatchNo =" . StrSafe_DB($MatchNo % 2 == 0 ? $MatchNo : $MatchNo - 1) . " ";
//print $Select . '<br>';
if (debug) {
    print $Select . '<br>';
}
$JS_SCRIPT = array('<script type="text/javascript" src="' . $CFG->ROOT_DIR . 'Final/Individual/Fun_JS.js"></script>');
$PAGE_TITLE = get_text('IndFinal');
include 'Common/Templates/head.php';
?>
<form name="FrmVolee" method="post" action="<?php 
开发者ID:brian-nelson,项目名称:ianseo,代码行数:31,代码来源:SpotMatch.php

示例13: calcFromPhase

 /**
  * calcFromPhase()
  * Calcola la FinalRank per un evento in una certa fase
  * @param string $event: evento
  * @param int $phase: fase
  * @return boolean: true ok false altrimenti. In un ciclo il primo errore fa terminare il metodo con false!
  */
 protected function calcFromPhase($event, $phase)
 {
     // trasformo la fase
     $phase = valueFirstPhase($phase);
     $date = date('Y-m-d H:i:s');
     // reset delle RankFinal della fase x le persone di quell'evento e quella fase
     $q = "\r\n\t\t\t\tUPDATE\r\n\t\t\t\t\tIndividuals\r\n\t\t\t\t\tINNER JOIN\r\n\t\t\t\t\t\tFinals\r\n\t\t\t\t\tON IndId=FinAthlete AND IndTournament=FinTournament AND IndEvent=FinEvent\r\n\t\t\t\t\tINNER JOIN\r\n\t\t\t\t\t\tGrids\r\n\t\t\t\t\tON FinMatchNo=GrMatchNo AND GrPhase={$phase}\r\n\t\t\t\tSET\r\n\t\t\t\t\tIndRankFinal=0,\r\n\t\t\t\t\tIndTimestampFinal='{$date}'\r\n\t\t\t\tWHERE\r\n\t\t\t\t\tGrPhase={$phase} AND IndTournament={$this->tournament} AND IndEvent='{$event}'\r\n\t\t\t";
     //print $q.'<br><br>';
     $r = safe_w_sql($q);
     if (!$r) {
         return false;
     }
     /*
      *  Tiro fuori gli scontri con i perdenti nei non Opp
      */
     $q = "\r\n\t\t\t\tSELECT\r\n\t\t\t\t\tf.FinAthlete AS AthId,\r\n\t\t\t\t\tf2.FinAthlete AS OppAthId,\r\n\t\t\t\t\tIF(EvMatchMode=0,f.FinScore,f.FinSetScore) AS Score, f.FinScore AS CumScore,f.FinTie AS Tie,\r\n\t\t\t\t\tIF(EvMatchMode=0,f2.FinScore,f2.FinSetScore) as OppScore, f2.FinScore AS OppCumScore,f2.FinTie as OppTie\r\n\t\t\t\tFROM\r\n\t\t\t\t\tFinals AS f\r\n\r\n\t\t\t\t\tINNER JOIN\r\n\t\t\t\t\t\tFinals AS f2\r\n\t\t\t\t\tON f.FinEvent=f2.FinEvent AND f.FinMatchNo=IF((f.FinMatchNo % 2)=0,f2.FinMatchNo-1,f2.FinMatchNo+1) AND f.FinTournament=f2.FinTournament\r\n\r\n\t\t\t\t\tINNER JOIN\r\n\t\t\t\t\t\tGrids\r\n\t\t\t\t\tON f.FinMatchNo=GrMatchNo\r\n\r\n\t\t\t\t\tINNER JOIN\r\n\t\t\t\t\t\tEvents\r\n\t\t\t\t\tON f.FinEvent=EvCode AND f.FinTournament=EvTournament AND EvTeamEvent=0\r\n\r\n\t\t\t\tWHERE\r\n\t\t\t\t\tf.FinTournament={$this->tournament} AND f.FinEvent='{$event}' AND GrPhase={$phase}\r\n\t\t\t\t\tAND (IF(EvMatchMode=0,f.FinScore,f.FinSetScore) < IF(EvMatchMode=0,f2.FinScore,f2.FinSetScore) OR (IF(EvMatchMode=0,f.FinScore,f.FinSetScore)=IF(EvMatchMode=0,f2.FinScore,f2.FinSetScore) AND f.FinTie < f2.FinTie))\r\n\t\t\t\tORDER BY\r\n\t\t\t\t\tIF(EvMatchMode=0,f.FinScore,f.FinSetScore) DESC,f.FinScore DESC\r\n\t\t\t";
     //print $q.'<br><br>';
     $rs = safe_r_sql($q);
     if ($rs) {
         if (safe_num_rows($rs) > 0) {
             /*
              * Se fase 0 (oro) il perdente ha la rank=2 e il vincente piglia 1,
              * se fase 1 (bronzo) il perdente ha la rank=4 e il vincete piglia 3
              * e in entrambi i casi avrò sempre e solo una riga.
              *
              * Se fase 2 (semi) non succede nulla.
              *
              * Per le altre fasi si cicla nel recordset che ha il numero di righe >=0
              */
             if ($phase == 0 || $phase == 1) {
                 $myRow = safe_fetch($rs);
                 $toWrite = array();
                 if ($phase == 0) {
                     // vincente
                     $toWrite[] = array('event' => $event, 'id' => $myRow->OppAthId, 'rank' => 1);
                     // perdente
                     $toWrite[] = array('event' => $event, 'id' => $myRow->AthId, 'rank' => 2);
                 } elseif ($phase == 1) {
                     // vincente
                     $toWrite[] = array('event' => $event, 'id' => $myRow->OppAthId, 'rank' => 3);
                     // perdente
                     $toWrite[] = array('event' => $event, 'id' => $myRow->AthId, 'rank' => 4);
                 }
                 foreach ($toWrite as $values) {
                     $x = $this->writeRow($values['id'], $values['event'], $values['rank']);
                     if ($x === false) {
                         return false;
                     }
                 }
             } elseif ($phase == 2) {
                 // non faccio nulla!
             } else {
                 // qui posso avere tante righe
                 $pos = 0;
                 /*
                  * Le posizioni partono dal numero della fase perchè poi l'incremento avverrà sempre.
                  * (@see Obj_Rank_FinalInd_calc base)
                  * I 1/48 quindi andranno inizializzati a 56 perchè la prima rank buona è 57.
                  * Con tutte le fase avverrno gli incrementi
                  */
                 switch ($phase) {
                     case 4:
                         $pos = 4;
                         // si parte da 5 quindi qui metto 4 dato che la fase è 4 (vedi commento qui sopra)
                         break;
                     case 8:
                         $pos = 8;
                         break;
                     case 16:
                         $pos = 16;
                         break;
                     case 32:
                         // (e 24)
                         $pos = 32;
                         break;
                     case 48:
                         $pos = 56;
                         break;
                     case 64:
                         $pos = 64;
                         break;
                     default:
                         return false;
                 }
                 $rank = $pos + 1;
                 $scoreOld = 0;
                 $cumOld = 0;
                 while ($myRow = safe_fetch($rs)) {
                     ++$pos;
                     //print $pos . ' - ';
                     if (!($myRow->Score == $scoreOld && $myRow->CumScore == $cumOld)) {
                         $rank = $pos;
                     }
//.........这里部分代码省略.........
开发者ID:brian-nelson,项目名称:ianseo,代码行数:101,代码来源:Obj_Rank_FinalInd_calc.php

示例14: correctQualTargetsForSession

function correctQualTargetsForSession($SesTournament, $SesOrder, $oldSesTar4Session, $oldSesAth4Target)
{
    // info attuali della sessione
    $SesTar4Session = 0;
    $SesAth4Target = 0;
    $x = getQualTargetsInfoForSession($SesTournament, $SesOrder);
    if ($x !== false) {
        list($SesTar4Session, $SesAth4Target) = $x;
        /*
         * Il problema si presenta se $oldSesTar4Session>$SesTar4Session oppure $oldSesAth4Target>$SesAth4Target.
         * Se i numeri aumentano non ci sono problemi perchè la "vecchia" sessione è contenuta nella "nuova".
         *
         * Se il numero di persone si riduce occorre sganciare tutti quelli che sono nelle lettere superiori
         * all'ultima buona dopo l'update.
         *
         * Se il numero di paglioni si riduce occorre sganciare tutti i bersagli dalle persone nelle piazzole
         * dopo l'ultima buona dopo l'update.
         */
        // si riducono le persone
        if ($SesAth4Target < $oldSesAth4Target) {
            /*
             *  in base al numero di persone posso ricavare l'ultima lettera buona
             *  chr(64) = '@'
             *  chr(65) = 'A'
             */
            $lastLetter = chr($SesAth4Target + 64);
            /*
             * Quindi tutte le lettere oltre $lastLetter vanno resettate.
             * In pratica si annullano le righe di Qualifications che hanno
             * QuSession=$SesOrder e QuTargetNo<>'' e l'ultima lettera di QuTargetNo>$lastLetter
             */
            $q = "UPDATE " . "Qualifications INNER JOIN Entries ON QuId=EnId " . "SET " . "QuSession=0,QuTargetNo='',QuBacknoPrinted=0 " . "WHERE " . "EnTournament=" . StrSafe_DB($SesTournament) . " AND " . "QuSession=" . StrSafe_DB($SesOrder) . " AND " . "QuTargetNo<>'' AND " . "SUBSTRING(QuTargetNo,-1)>'" . $lastLetter . "' ";
            $r = safe_w_sql($q);
        }
        // si riducono i  bersagli
        if ($SesTar4Session < $oldSesTar4Session) {
            /*
             * L'ultimo target è dato dal numero di bersagli
             */
            $lastTarget = $SesTar4Session;
            /*
             * Ora tutte le persone della sessione in bersagli più alti di $lastTarget
             * vengono sganciate
             */
            $q = "UPDATE " . "Qualifications INNER JOIN Entries ON QuId=EnId " . "SET " . "QuSession=0,QuTargetNo='',QuBacknoPrinted=0 " . "WHERE " . "EnTournament=" . StrSafe_DB($SesTournament) . " AND " . "QuSession=" . StrSafe_DB($SesOrder) . " AND " . "CAST(SUBSTRING(QuTargetNo,2, " . TargetNoPadding . ") AS UNSIGNED)>" . $lastTarget . " ";
            $r = safe_w_sql($q);
        }
    } else {
        return false;
    }
}
开发者ID:brian-nelson,项目名称:ianseo,代码行数:51,代码来源:Fun_ManSessions.inc.php

示例15: imagecreatefromgif

            case 'image/gif':
                $img = imagecreatefromgif($_FILES['JPG']['tmp_name'][$edit]);
                if ($img) {
                    imagejpeg($img, $imgJPG, 95);
                }
                break;
            case 'image/jpg':
            case 'image/jpeg':
                $imgJPG = $_FILES['JPG']['tmp_name'][$edit];
                break;
            default:
                debug_svela($_FILES['JPG']);
                cd_redirect('Countries.php#' . $edit);
        }
        $Image = addslashes(base64_encode(file_get_contents($imgJPG)));
        safe_w_sql("insert into Flags set FlCode='{$edit}', FlJPG='{$Image}', FlTournament={$_SESSION['TourId']} " . " on duplicate key update FlJPG='{$Image}'");
        unlink($imgJPG);
    }
    cd_redirect('Countries.php#' . $edit);
}
require_once 'Common/CheckPictures.php';
CheckPictures();
$PAGE_TITLE = get_text('TourCountries', 'Tournament');
include 'Common/Templates/head.php';
echo '<form method="POST" ENCTYPE="multipart/form-data">';
echo '<table class="Tabella">';
echo '<tr>';
echo '<td colspan="4">';
echo '<a href="../Final/Team/PrnName.php?TeamLabel=1" target="_blank">' . get_text('TeamPlace', 'Tournament') . '</a>';
echo '&nbsp;&nbsp;<a href="../Final/Team/PrnName.php?TeamLabel=1&local=1" target="_blank">' . get_text('TeamPlaceLocal', 'Tournament') . '</a>';
echo '</td>';
开发者ID:brian-nelson,项目名称:ianseo,代码行数:31,代码来源:Countries.php


注:本文中的safe_w_sql函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。