本文整理汇总了PHP中safe_num_rows函数的典型用法代码示例。如果您正苦于以下问题:PHP safe_num_rows函数的具体用法?PHP safe_num_rows怎么用?PHP safe_num_rows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了safe_num_rows函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: read
/**
* read()
*
* @Override
*
* (non-PHPdoc)
* @see ianseo/Common/Rank/Obj_Rank#calculate()
*/
public function read()
{
$f = $this->safeFilter();
$filter = $f !== false ? $f : "";
if (array_key_exists('cutRank', $this->opts) && is_numeric($this->opts['cutRank']) && $this->opts['cutRank'] > 0) {
$filter .= "AND Teams.teRank<={$this->opts['cutRank']} ";
}
$q = "\r\n\t\t\t\tSELECT\r\n\t\t\t\t\tTeTournament,CoId,TeSubTeam,CoCode,CoName, TeEvent,EvEventName,ToNumEnds,ToNumDist,ToMaxDistScore,FlContAssoc,\r\n\t\t\t\t\tEvMaxTeamPerson, EvProgr, EvFinalFirstPhase,\r\n\t\t\t\t\tClDescription, DivDescription,\r\n\t\t\t\t\tEnId,EnCode,EnFirstName,upper(EnFirstName) EnFirstNameUpper,EnName,EnClass,EnDivision,EnAgeClass,EnSubClass,\r\n\t\t\t\t\tIF(EvFinalFirstPhase=48, 104, IF(EvFinalFirstPhase=24, 56, (EvFinalFirstPhase*2))) AS QualifiedNo,\tEvQualPrintHead,\r\n\t\t\t\t\tSUBSTRING(QuTargetNo,1,1) AS Session, SUBSTRING(QuTargetNo,2) AS TargetNo,\r\n\t\t\t\t\tQuHits*EvMaxTeamPerson AS Arrows_Shot, QuScore, TeScore,TeRank, TeGold, TeXnine, ToGolds, ToXNine,TeHits,\r\n\t\t\t\t\tTeRank, EvRunning, IF(EvRunning=1,IFNULL(ROUND(TeScore/TeHits,3),0),0) as RunningScore,\r\n\t\t\t\t\tABS(TeSO) AS RankBeforeSO,\r\n\t\t\t\t\ttie.Quanti,\r\n\t\t\t\t\tTeTieBreak,(TeSO>0) AS isSO,IFNULL(sqY.Quanti,1) AS `NumCT`,\r\n\t\t\t\t\tIFNULL(Td1,'.1.') as Td1, IFNULL(Td2,'.2.') as Td2, IFNULL(Td3,'.3.') as Td3, IFNULL(Td4,'.4.') as Td4, IFNULL(Td5,'.5.') as Td5, IFNULL(Td6,'.6.') as Td6, IFNULL(Td7,'.7.') as Td7, IFNULL(Td8,'.8.') as Td8,\r\n\t\t\t\t\tTeTimeStamp, DiEnds, DiArrows\r\n\t\t\t\tFROM\r\n\t\t\t\t\tTournament\r\n\t\t\t\t\tINNER JOIN\r\n\t\t\t\t\t\tTeams\r\n\t\t\t\t\tON ToId=TeTournament AND TeFinEvent=1\r\n\t\t\t\t\tINNER JOIN\r\n\t\t\t\t\t\tCountries\r\n\t\t\t\t\tON TeCoId=CoId AND TeTournament=CoTournament\r\n\t\t\t\t\tINNER JOIN\r\n\t\t\t\t\t\tEvents\r\n\t\t\t\t\tON TeEvent=EvCode AND ToId=EvTournament AND EvTeamEvent=1\r\n\t\t\t\t\tINNER JOIN\r\n\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\tSELECT\r\n\t\t\t\t\t\t\t\tTeEvent as tieEvent, TeFinEvent as tieFinEvent, TeTournament as tieTournament, TeScore as tieScore, Count(*) as Quanti\r\n\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t\tTeams\r\n\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\tTeTournament = {$this->tournament} {$filter}\r\n\t\t\t\t\t\t\tGROUP BY\r\n\t\t\t\t\t\t\t\tTeEvent, TeFinEvent, TeTournament, TeScore\r\n\t\t\t\t\t\t) AS tie\r\n\t\t\t\t\tON Teams.TeEvent=tie.tieEvent AND Teams.TeTournament=tie.tieTournament AND Teams.TeFinEvent=tie.tieFinEvent AND Teams.TeScore=tie.tieScore\r\n\t\t\t\t\tINNER JOIN\r\n\t\t\t\t\t\tTeamComponent AS tc\r\n\t\t\t\t\tON Teams.TeCoId=tc.TcCoId AND Teams.TeSubTeam=tc.TcSubTeam AND Teams.TeEvent=tc.TcEvent AND Teams.TeTournament=tc.TcTournament AND Teams.TeFinEvent=tc.TcFinEvent\r\n\t\t\t\t\tINNER JOIN\r\n\t\t\t\t\t\tEntries\r\n\t\t\t\t\tON TcId=EnId\r\n\t\t\t\t\tINNER JOIN\r\n\t\t\t\t\t\tQualifications\r\n\t\t\t\t\tON EnId=QuId\r\n\t\t\t\t\tINNER JOIN\r\n\t\t\t\t\t\tDivisions\r\n\t\t\t\t\tON EnDivision=DivId AND EnTournament=DivTournament\r\n\t\t\t\t\tINNER JOIN\r\n\t\t\t\t\t\tClasses\r\n\t\t\t\t\tON EnClass=ClId AND EnTournament=ClTournament\r\n\t\t\t\t/* Contatori per CT (gialli)*/\r\n\t\t\t\t\tLEFT JOIN\r\n\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\tSELECT\r\n\t\t\t\t\t\t\t\tTeEvent as sqyEvent,Count(*) as Quanti, TeSO as sqyRank, TeTournament as sqyTournament\r\n\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t\tTeams\r\n\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\tTeTournament = {$this->tournament} AND TeFinEvent=1 AND TeSO!=0 {$filter}\r\n\t\t\t\t\t\t\tGROUP BY\r\n\t\t\t\t\t\t\t\tTeSO, TeEvent, TeTournament\r\n\t\t\t\t\t\t) AS sqY\r\n\t\t\t\t\tON sqY.sqyRank=TeSO AND sqY.sqyEvent=Teams.TeEvent AND Teams.TeFinEvent=1 AND sqY.sqyTournament=Teams.TeTournament\r\n\t\t\t\t\tLEFT JOIN\r\n\t\t\t\t\t\tTournamentDistances\r\n\t\t\t\t\tON ToType=TdType AND TdTournament=ToId AND TeEvent like TdClasses\r\n\t\t\t\t\tLEFT JOIN\r\n\t\t\t\t\t\tFlags\r\n\t\t\t\t\t\tON FlIocCode='FITA' and FlCode=CoCode and FlTournament=-1\r\n\t\t\t\t\tleft join DistanceInformation on EnTournament=DiTournament and DiSession=1 and DiDistance=1 and DiType='Q'\r\n\r\n\t\t\t\t\tWHERE\r\n\t\t\t\t\tTeams.TeTournament={$this->tournament}\r\n\t\t\t\t\t{$filter}\r\n\t\t\t\tORDER BY\r\n\t\t\t\t\tEvProgr,TeEvent, RunningScore DESC, TeRank ASC, TeGold DESC, TeXnine DESC, CoCode, TeSubTeam ,tc.TcOrder\r\n\t\t\t";
$r = safe_r_sql($q);
$this->data['meta']['title'] = get_text('ResultSqAbs', 'Tournament');
$this->data['meta']['lastUpdate'] = '0000-00-00 00:00:00';
$this->data['sections'] = array();
$myEv = '';
$myTeam = '';
if (safe_num_rows($r) > 0) {
$section = null;
while ($row = safe_fetch($r)) {
if ($myEv != $row->TeEvent) {
if ($myEv != '') {
foreach ($section["meta"]["arrowsShot"] as $k => $v) {
if ($v) {
$section["meta"]["sesArrows"][$k] = get_text('AfterXArrows', 'Common', $v);
}
}
$this->data['sections'][$myEv] = $section;
$section = null;
}
$myEv = $row->TeEvent;
$fields = array('id' => 'Id', 'countryCode' => get_text('CountryCode'), 'countryName' => get_text('Country'), 'subteam' => get_text('PartialTeam'), 'athletes' => array('name' => get_text('Athletes'), 'fields' => array('id' => 'Id', 'bib' => get_text('Code', 'Tournament'), 'session' => get_text('Session'), 'target' => get_text('Target'), 'athlete' => get_text('Athlete'), 'familyname' => get_text('FamilyName', 'Tournament'), 'givenname' => get_text('Name', 'Tournament'), 'div' => get_text('Division'), 'class' => get_text('Cl'), 'ageclass' => get_text('AgeCl'), 'subclass' => get_text('SubCl', 'Tournament'), 'quscore' => get_text('TotaleScore'))), 'rank' => get_text('PositionShort'), 'rankBeforeSO' => '', 'score' => $row->EvRunning == 1 ? get_text('ArrowAverage') : get_text('TotaleScore'), 'gold' => $row->ToGolds, 'xnine' => $row->ToXNine, 'hits' => get_text('Arrows', 'Tournament'), 'tiebreak' => get_text('TieArrows'), 'tie' => get_text('Tie'), 'ct' => get_text('CoinTossShort', 'Tournament'), 'so' => get_text('ShotOffShort', 'Tournament'));
$distFields = array();
$distValid = $row->ToNumDist;
foreach (range(1, 8) as $n) {
$distFields['dist_' . $n] = $row->{'Td' . $n};
if ($distFields['dist_' . $n] == '-') {
$distValid--;
}
}
$section = array('meta' => array('event' => $myEv, 'firstPhase' => $row->EvFinalFirstPhase, 'descr' => get_text($row->EvEventName, '', '', true), 'qualifiedNo' => $row->QualifiedNo, 'printHeader' => $row->EvQualPrintHead, 'order' => $row->EvProgr, 'numDist' => $distValid, 'maxScore' => $row->ToMaxDistScore * $row->EvMaxTeamPerson, 'maxArrows' => ($row->DiEnds ? $row->DiEnds * $row->DiArrows : $row->ToNumEnds * 3) * $row->EvMaxTeamPerson, 'arrowsShot' => array(), 'sesArrows' => array(), 'running' => $row->EvRunning == 1 ? 1 : 0, 'fields' => $fields), 'items' => array());
}
if ($myTeam != $row->CoId . $row->TeSubTeam . $row->TeEvent) {
$tmpArr = array();
for ($countArr = 0; $countArr < strlen(trim($row->TeTieBreak)); $countArr = $countArr + $row->EvMaxTeamPerson) {
$tmpArr[] = ValutaArrowString(substr(trim($row->TeTieBreak), $countArr, $row->EvMaxTeamPerson)) . ",";
}
$item = array('id' => $row->CoId, 'countryCode' => $row->CoCode, 'contAssoc' => $row->FlContAssoc, 'countryName' => $row->CoName, 'subteam' => $row->TeSubTeam, 'athletes' => array(), 'rank' => $row->TeRank, 'rankBeforeSO' => $row->RankBeforeSO, 'score' => $row->EvRunning == 1 ? $row->RunningScore : $row->TeScore, 'gold' => $row->TeGold, 'xnine' => $row->TeXnine, 'hits' => $row->TeHits, 'recordGap' => $row->Arrows_Shot * 10 - $row->TeScore, 'tiebreak' => $row->TeTieBreak, 'tiebreakDecoded' => $row->TeTieBreak ? 'T.' . implode(',', $tmpArr) : '', 'ct' => $row->NumCT, 'tie' => $row->Quanti > 1, 'so' => $row->isSO);
//Gestisco il numero di frecce tirate per sessione
if (empty($section["meta"]["arrowsShot"][$row->Session]) || $section["meta"]["arrowsShot"][$row->Session] <= $row->Arrows_Shot) {
$section["meta"]["arrowsShot"][$row->Session] = $row->Arrows_Shot;
}
$section['items'][] = $item;
if ($row->TeTimeStamp > $this->data['meta']['lastUpdate']) {
$this->data['meta']['lastUpdate'] = $row->TeTimeStamp;
}
$myTeam = $row->CoId . $row->TeSubTeam . $row->TeEvent;
}
if (!array_key_exists('components', $this->opts) || $this->opts['components']) {
$athlete = array('id' => $row->EnId, 'bib' => $row->EnCode, 'session' => $row->Session, 'target' => $row->TargetNo, 'athlete' => $row->EnFirstNameUpper . ' ' . $row->EnName, 'familyname' => $row->EnFirstName, 'familynameUpper' => $row->EnFirstNameUpper, 'givenname' => $row->EnName, 'div' => $row->EnDivision, 'class' => $row->EnClass, 'ageclass' => $row->EnAgeClass, 'subclass' => $row->EnSubClass, 'quscore' => $row->QuScore);
$section['items'][count($section['items']) - 1]['athletes'][] = $athlete;
}
}
foreach ($section["meta"]["arrowsShot"] as $k => $v) {
if ($v) {
$section["meta"]["sesArrows"][$k] = str_replace("<br/>", " ", get_text('AfterXArrows', 'Common', $v));
}
}
// ultimo giro
$this->data['sections'][$myEv] = $section;
}
}
示例2: getStatEntriesByCountriesQuery
function getStatEntriesByCountriesQuery($ORIS = false, $Athletes = false)
{
$Sql = "";
if ($ORIS) {
$Sql = "SELECT SUM(IF((DivAthlete AND ClAthlete AND EnSex=0), 1,0)) as M, SUM(IF((DivAthlete AND ClAthlete AND EnSex=1), 1,0)) as W, SUM(IF((DivAthlete AND ClAthlete), 0,1)) as Of, ";
$Sql .= "CoCode as NationCode, CoName as NationName ";
$Sql .= "FROM Entries ";
$Sql .= "INNER JOIN Countries ON EnCountry = CoId ";
$Sql .= "LEFT JOIN Divisions ON EnDivision=DivId AND DivTournament=" . StrSafe_DB($_SESSION['TourId']) . " ";
$Sql .= "LEFT JOIN Classes ON EnClass=ClId AND ClTournament=" . StrSafe_DB($_SESSION['TourId']) . " ";
$Sql .= "WHERE EnTournament = " . StrSafe_DB($_SESSION['TourId']) . " ";
$Sql .= "GROUP BY CoCode ";
$Sql .= "ORDER BY CoCode ";
} else {
$Sql = "SELECT DISTINCT CONCAT(TRIM(EnDivision),'|',TRIM(EnClass)) as Id, (DivAthlete AND ClAthlete) as isAthlete " . "FROM Entries " . "LEFT JOIN Divisions ON EnDivision=DivId AND DivTournament=" . StrSafe_DB($_SESSION['TourId']) . " " . "LEFT JOIN Classes ON EnClass=ClId AND ClTournament=" . StrSafe_DB($_SESSION['TourId']) . " " . "WHERE EnTournament = " . StrSafe_DB($_SESSION['TourId']) . " " . ($Athletes ? 'AND DivAthlete=1 AND ClAthlete=1 ' : '') . "ORDER BY LENGTH(EnDivision) DESC, DivViewOrder, EnDivision, LENGTH(EnClass) DESC, ClViewOrder, EnClass";
$Rs = safe_r_sql($Sql);
$Sql = "SELECT ";
if (safe_num_rows($Rs) > 0) {
while ($MyRow = safe_fetch($Rs)) {
$Sql .= "SUM(IF(CONCAT(TRIM(EnDivision),'|',TRIM(EnClass))='" . $MyRow->Id . "',1,0)) as `" . $MyRow->Id . "`, ";
}
safe_free_result($Rs);
}
$Sql .= "CoCode as NationCode, CoName as NationName ";
$Sql .= "FROM Entries ";
$Sql .= "INNER JOIN Countries ON EnCountry = CoId ";
$Sql .= "WHERE EnTournament = " . StrSafe_DB($_SESSION['TourId']) . " ";
$Sql .= "GROUP BY CoCode ";
$Sql .= "ORDER BY CoCode ";
}
return $Sql;
}
示例3: __construct
function __construct($TemplateID = 0)
{
parent::__construct('BackNumber');
$Select = "SELECT BackNumber.*, LENGTH(BnBackground) as ImgSize " . "FROM BackNumber " . "WHERE BnTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND BnFinal in (0," . $TemplateID . ") order by BnFinal desc limit 1";
//print $Select;exit;
$Rs = safe_r_sql($Select);
if (safe_num_rows($Rs) == 1) {
$this->RowBn = safe_fetch($Rs);
} else {
// fall back if no Backnumber creates from template!
include_once 'Tournament/BackNumberEmpty.php';
$this->RowBn = emptyBackNumber();
}
$this->Rotation = $this->RowBn->BnOffsetX != 0 || $this->RowBn->BnOffsetY != 0;
$this->RotX = $this->RowBn->BnWidth / 2;
$this->RotY = $this->RowBn->BnOffsetY / 2;
// TargetNo Specs
$this->TargetNoFont = ($this->RowBn->BnTargetNo & 4) == 4 ? $this->FontFix : (($this->RowBn->BnTargetNo & 2) == 2 ? 'dejavuserif' : $this->FontStd);
$this->TargetNoStyle = ($this->RowBn->BnTargetNo & 8 ? 'B' : '') . ($this->RowBn->BnTargetNo & 16 ? 'I' : '');
$this->TargetNoColor = array(base_convert(substr($this->RowBn->BnTnoColor, 0, 2), 16, 10), base_convert(substr($this->RowBn->BnTnoColor, 2, 2), 16, 10), base_convert(substr($this->RowBn->BnTnoColor, 4, 2), 16, 10));
$this->TargetNoAlign = ($this->RowBn->BnTargetNo & 96) == 64 ? 'L' : (($this->RowBn->BnTargetNo & 96) == 32 ? 'R' : 'C');
// Athlete Specs
$this->AthleteFont = ($this->RowBn->BnAthlete & 4) == 4 ? $this->FontFix : (($this->RowBn->BnAthlete & 2) == 2 ? 'dejavuserif' : $this->FontStd);
$this->AthleteStyle = ($this->RowBn->BnAthlete & 8 ? 'B' : '') . ($this->RowBn->BnAthlete & 16 ? 'I' : '');
$this->AthleteColor = array(base_convert(substr($this->RowBn->BnAthColor, 0, 2), 16, 10), base_convert(substr($this->RowBn->BnAthColor, 2, 2), 16, 10), base_convert(substr($this->RowBn->BnAthColor, 4, 2), 16, 10));
$this->AthleteAlign = ($this->RowBn->BnAthlete & 96) == 64 ? 'L' : (($this->RowBn->BnAthlete & 96) == 32 ? 'R' : 'C');
if ($this->RowBn->BnCapitalFirstName) {
$this->FirstNameAllCaps = true;
}
// Country Specs
$this->CountryFont = ($this->RowBn->BnCountry & 4) == 4 ? $this->FontFix : (($this->RowBn->BnCountry & 2) == 2 ? 'dejavuserif' : $this->FontStd);
$this->CountryStyle = ($this->RowBn->BnCountry & 8 ? 'B' : '') . ($this->RowBn->BnCountry & 16 ? 'I' : '');
$this->CountryColor = array(base_convert(substr($this->RowBn->BnCoColor, 0, 2), 16, 10), base_convert(substr($this->RowBn->BnCoColor, 2, 2), 16, 10), base_convert(substr($this->RowBn->BnCoColor, 4, 2), 16, 10));
$this->CountryAlign = ($this->RowBn->BnCountry & 96) == 64 ? 'L' : (($this->RowBn->BnCountry & 96) == 32 ? 'R' : 'C');
// background temp creation
if ($this->RowBn->ImgSize) {
$this->BackGroundFile = tempnam('/tmp', 'bgf');
$img = imagecreatefromstring($this->RowBn->BnBackground);
if (!imagepng($img, $this->BackGroundFile)) {
die('could not create image');
}
}
$Orientation = $this->RowBn->BnWidth > $this->RowBn->BnHeight ? 'L' : 'P';
$this->setPageOrientation($Orientation);
$this->setPageFormat(array($this->RowBn->BnWidth, $this->RowBn->BnHeight), $Orientation);
$this->SetFont($this->FontStd, '', 10);
$this->AliasNbPages();
$this->setPrintHeader(false);
$this->setPrintFooter(false);
$this->SetMargins(10, 10, 10);
$this->SetAutoPageBreak(false, 10);
$this->SetAuthor('http://www.ianseo.net');
$this->SetCreator('Software Design by Ianseo');
$this->SetTitle('IANSEO - Integrated Result System (release ' . ProgramVersion . ')');
$this->SetSubject('BackNo');
}
示例4: findClone
function findClone()
{
global $flags;
$Select = "\r\n\t\t\tSELECT\r\n\t\t\t\tCONCAT(e1.ElElimPhase,'_',e1.ElEventCode,'_',e1.ElQualRank,'_',e1.ElTournament) AS `Id`,e1.ElSession,IFNULL(sq.q,0) AS `q`\r\n\t\t\tFROM\r\n\t\t\t\tEliminations AS e1\r\n\t\t\t\tLEFT JOIN\r\n\t\t\t\t\t(\r\n\t\t\t\t\t\tSELECT\r\n\t\t\t\t\t\t\tElElimPhase,ElTargetNo,ElEventCode,ElSession,COUNT(ElTargetNo) AS `q`\r\n\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\tEliminations\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\tElTargetNo<>'' AND ElTournament={$_SESSION['TourId']}\r\n\t\t\t\t\t\tGROUP BY\r\n\t\t\t\t\t\t\tElTargetNo,ElElimPhase,ElSession\r\n\t\t\t\t\t) AS sq\r\n\t\t\t\tON e1.ElTargetNo=sq.ElTargetNo AND e1.ElElimPhase=sq.ElElimPhase AND e1.ElSession=sq.ElSession\r\n\t\t\tWHERE\r\n\t\t\t\te1.ElTournament={$_SESSION['TourId']}\r\n\t\t\tORDER BY\r\n\t\t\t\te1.ElElimPhase ASC,e1.ElQualRank ASC\r\n\t\t";
//print $Select;
$Rs = safe_r_sql($Select);
if (safe_num_rows($Rs) > 0) {
while ($MyRow = safe_fetch($Rs)) {
$flags[$MyRow->Id]['quantity'] = $MyRow->q > 1 ? 0 : 1;
$flags[$MyRow->Id]['out'] = 1;
/*$xml
.= '<target>' . "\n"
. '<id>' . $MyRow->Id . '</id>' . "\n"
. '<good>' . ($MyRow->q>1 ? 0:1). '</good>'
. '<q>' . ($MyRow->q). '</q>'
. '</target>' . "\n";*/
}
}
}
示例5: __construct
public function __construct($tourId, $phase)
{
$this->setTourId($tourId);
$this->setPhase($phase);
// Estraggo le info del torneo
/*$query
= "SELECT "
. "ToCode,ToName,IF(TtElabTeam=1 || TtElabTeam=2,'1',IF(INSTR(TtName,'Indoor')=0,'0','2' )) AS MyType "
. "FROM "
. "Tournament INNER JOIN Tournament*Type ON ToType=TtId "
. "WHERE "
. "ToId=" . $this->getTourId() . " ";*/
$query = "SELECT " . "ToCode,ToName,IF(ToElabTeam=1 || ToElabTeam=2,'1',IF(INSTR(ToTypeName,'Indoor')=0,'0','2' )) AS MyType " . "FROM " . "Tournament " . "WHERE " . "ToId=" . $this->getTourId() . " ";
$rs = safe_r_sql($query);
if (safe_num_rows($rs) == 1) {
$myRow = safe_fetch($rs);
$this->setTourCode($myRow->ToCode);
$this->setTourName($myRow->ToName);
$this->setType($myRow->MyType);
} else {
$this->setError(1);
}
}
示例6: FindLive
/**
* Cerca quale evento è live in questo momento
* Se trova più eventi contemporanei ritorna i dati di quello con modifiche più recenti.
*
* @param Int $Team: vale 0 se l'evento è individuale e 1 se è a squadre.
*
* @return Array: Un vettore formato dall'Evento e dal MatchNo oppure false in caso di errore.
* Se non ci sono eventi live viene ritornato array(NULL,NULL)
*/
function FindLive($Team = -1)
{
if ($Team == 0) {
$Select = "SELECT" . " '0' Team" . " , FinDateTime DateTime" . " , FinEvent AS Event" . " , FinMatchNo AS MatchNo" . " FROM" . " Finals " . " WHERE" . " FinTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND FinLive='1' " . "ORDER BY" . " Team," . " DateTime DESC," . " Event ASC," . " MatchNo ASC ";
} elseif ($Team == 1) {
$Select = "SELECT" . " '1' Team " . " , TfDateTime DateTime" . " , TfEvent AS Event " . " , TfMatchNo AS MatchNo " . " FROM" . " TeamFinals " . " WHERE" . " TfTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND TfLive='1' " . "ORDER BY" . " Team," . " DateTime DESC," . " Event ASC," . " MatchNo ASC";
} elseif ($Team == -1) {
$Select = "(SELECT" . " '0' Team" . " , FinDateTime DateTime" . " , FinEvent AS Event" . " , FinMatchNo AS MatchNo" . " FROM" . " Finals " . " WHERE" . " FinTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND FinLive='1') " . "UNION " . "(SELECT" . " '1' Team " . " , TfDateTime DateTime " . " , TfEvent AS Event " . " , TfMatchNo AS MatchNo " . " FROM" . " TeamFinals " . " WHERE" . " TfTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND TfLive='1') " . "ORDER BY" . " Team," . " DateTime DESC," . " Event ASC," . " MatchNo ASC ";
} else {
return '';
}
$Rs = safe_r_sql($Select);
// at least 2 rows because "live" is set on both opponents!
if (safe_num_rows($Rs) < 2) {
return '';
}
$MyRow1 = safe_fetch($Rs);
$MyRow2 = safe_fetch($Rs);
// check if these are really 2 opponents in the same match!!
if ($MyRow1->Event == $MyRow2->Event and $MyRow1->Team == $MyRow2->Team and ($MyRow1->MatchNo == $MyRow2->MatchNo - 1 or $MyRow1->MatchNo == $MyRow2->MatchNo + 1)) {
return array($MyRow1->Event, min($MyRow1->MatchNo, $MyRow2->MatchNo), $MyRow1->Team);
}
return '';
}
示例7: 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;
}
示例8: CONCAT
if ($isEvent == 0) {
// individuali
/*
* IMPORTANTE!!!
* Questa query non tiene conto del flag di partecipazione alla classifica di classe.
* Un eventuale confronto con la classifica di classe potrebbe mostrare discrepanze
* (l'elenco delle persone di questa query ha un numero di righe >= a quello della classifica di classe)
*/
$query = "SELECT " . "QuId, EnFirstName, EnName, EnWChair, EnDoubleSpace, CONCAT(EnDivision,EnClass) AS `Event`, QuSession, QuTargetNo, QuClRank as Rank " . "FROM " . "Tournament " . "INNER JOIN " . "Entries " . "ON ToId=EnTournament " . "INNER JOIN " . "Qualifications " . "ON EnId=QuId " . "WHERE " . "CONCAT(EnDivision,EnClass) LIKE " . StrSafe_DB($filter) . " AND EnAthlete=1 AND EnStatus<=1 " . "AND EnTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND QuScore<>0 " . "ORDER BY " . "QuClRank ASC, EnFirstName, EnName ";
} else {
// assoluti individuali
$query = "SELECT " . "QuId, EnFirstName, EnName,EnWChair, EnDoubleSpace, CONCAT(EnDivision,EnClass) AS `Event`, QuSession, QuTargetNo, IndRank as Rank " . "FROM " . "Tournament " . "INNER JOIN " . "Entries " . "ON ToId=EnTournament " . "INNER JOIN " . "Qualifications " . "ON EnId=QuId " . "INNER JOIN " . "EventClass " . "ON EnClass=EcClass AND EnDivision=EcDivision AND EnTournament=EcTournament AND EcTeamEvent=0 " . "INNER JOIN " . "Events " . "ON EvCode=EcCode AND EvTeamEvent=EcTeamEvent AND EvTournament=EcTournament " . "INNER JOIN " . "Individuals " . "ON IndId=EnId AND IndEvent=EvCode AND IndTournament=EvTournament " . "WHERE " . "EnAthlete=1 AND EnIndFEvent=1 AND EnStatus <= 1 AND QuScore<>'0' AND ToId = " . StrSafe_DB($_SESSION['TourId']) . " " . "AND EvCode LIKE " . StrSafe_DB($filter) . " " . "ORDER BY " . "IndRank ASC, EnFirstName, EnName ";
}
$Rs = safe_r_sql($query);
$CurrentRow = -1;
if ($Rs && safe_num_rows($Rs) > 0) {
while ($MyRow = safe_fetch($Rs)) {
/*
* Se la persona ha la rank tra quelle selezionate, la sessione è quella selezionata
* E HO ancora bersagli di destinazione aggiungo in $data2up
*/
if ($index < count($targets)) {
if ($MyRow->Rank >= $rank1 && $MyRow->Rank <= $rank2 && ($startSession == 0 || $MyRow->QuSession != 0 && $MyRow->QuSession == $startSession)) {
$trgt = $targets[0];
$index = 0;
if ($MyRow->EnWChair) {
// cerca il target B successivo
while ($index < count($targets) and substr($targets[$index], -1) != 'B') {
$index++;
}
// se esiste sposta l'arciere su quel bersaglio ed elimina il 'D' relativo
示例9: nextPhase
/**
* Viene chiamata per fare i passaggi di fase delle finali
*
* @param array int $keys: vettore delle chiavi per il passaggio di fase
* @param array int $team: 0 individuali 1 squadre
* @param boolean &$error: true se il post processo genera un errore
*/
private function nextPhase($keys, $team, &$error)
{
/*
* Se non ci sono $keys buone non ho passaggi di fase e il post-processing fallisce
*/
if (count($keys) == 0) {
$error = true;
return;
}
foreach ($keys as $key => $value) {
$events = implode(',', array_keys($value));
$query = "";
if ($team == 0) {
$query = "SELECT GrPhase AS Phase,GrPosition AS Position,\t/* Grids*/ " . "FinMatchNo AS MatchNo,FinEvent AS Event, FinAthlete AS Id, FinScore AS Score,FinTie AS Tie, " . "IF(GrPhase>2, FLOOR(FinMatchNo/2),FLOOR(FinMatchNo/2)-2) AS NextMatchNo " . "FROM Finals INNER JOIN Grids ON FinMatchNo=GrMatchNo AND GrPhase=" . StrSafe_DB($key) . " " . "LEFT JOIN Entries ON FinAthlete=EnId AND FinEvent IN(" . $events . ') ' . "WHERE FinTournament=" . $this->getTourId() . " " . "ORDER BY FinEvent, NextMatchNo ASC, FinScore DESC, FinTie DESC ";
} else {
$query = "SELECT GrPhase AS Phase,GrPosition AS Position,\t/* Grids*/ " . "TfTeam AS Id,TfMatchNo AS MatchNo,TfEvent AS Event, TfScore AS Score,TfTie AS Tie, " . "IF(GrPhase>2, FLOOR(TfMatchNo/2),FLOOR(TfMatchNo/2)-2) AS NextMatchNo " . "FROM TeamFinals INNER JOIN Grids ON TfMatchNo=GrMatchNo AND GrPhase=" . StrSafe_DB($key) . " " . "WHERE TfTournament=" . $this->getTourId() . " AND TfEvent IN (" . $events . ") " . "ORDER BY TfEvent, NextMatchNo ASC, TfScore DESC, TfTie DESC ";
}
//print $query . '<br>';exit;
$rs = safe_r_SQL($query);
$myNextMatchNo = 'xx';
$row = array();
if (safe_num_rows($rs) > 0) {
while ($row0 = safe_fetch($rs)) {
$row1 = safe_fetch($rs);
$athProp = 0;
$myUpQuery = "";
if ($row0->Phase >= 2) {
if (($row0->Score > 0 || $row0->Tie > 0) && ($row0->Score != $row1->Score || $row0->Tie != $row1->Tie)) {
if ($team == 0) {
$myUpQuery = "UPDATE Finals SET ";
$myUpQuery .= "FinAthlete =" . StrSafe_DB($row0->Id) . ", ";
$myUpQuery .= "FinDateTime=" . StrSafe_DB(date('Y-m-d H:i:s')) . " ";
$myUpQuery .= "WHERE FinEvent=" . StrSafe_DB($row0->Event) . " AND FinMatchNo=" . StrSafe_DB($row0->NextMatchNo) . " AND FinTournament=" . $this->getTourId() . " ";
} else {
$myUpQuery = "UPDATE TeamFinals SET ";
$myUpQuery .= "TfTeam =" . StrSafe_DB($row0->Id) . ", ";
$myUpQuery .= "TfDateTime=" . StrSafe_DB(date('Y-m-d H:i:s')) . " ";
$myUpQuery .= "WHERE TfEvent=" . StrSafe_DB($row0->Event) . " AND TfMatchNo=" . StrSafe_DB($row0->NextMatchNo) . " AND TfTournament=" . $this->getTourId() . " ";
}
//print $myUpQuery . '<br><br>';
$rsUp = safe_w_sql($myUpQuery);
$athProp = $row0->Id;
} else {
if ($team == 0) {
$myUpQuery = "UPDATE Finals SET ";
$myUpQuery .= "FinAthlete ='0', ";
$myUpQuery .= "FinDateTime=" . StrSafe_DB(date('Y-m-d H:i:s')) . " ";
$myUpQuery .= "WHERE FinEvent=" . StrSafe_DB($row0->Event) . " AND FinMatchNo=" . StrSafe_DB($row0->NextMatchNo) . " AND FinTournament=" . $this->getTourId() . " ";
} else {
$myUpQuery = "UPDATE TeamFinals SET ";
$myUpQuery .= "TfTeam ='0', ";
$myUpQuery .= "TfDateTime=" . StrSafe_DB(date('Y-m-d H:i:s')) . " ";
$myUpQuery .= "WHERE TfEvent=" . StrSafe_DB($row0->Event) . " AND TfMatchNo=" . StrSafe_DB($row0->NextMatchNo) . " AND TfTournament=" . $this->getTourId() . " ";
}
$rsUp = safe_w_sql($myUpQuery);
}
}
if ($row1->Phase == 2) {
if (($row1->Score > 0 || $row1->Tie > 0) && ($row0->Score != $row1->Score || $row0->Tie != $row1->Tie)) {
if ($team == 0) {
$myUpQuery = "UPDATE Finals SET ";
$myUpQuery .= "FinAthlete =" . StrSafe_DB($row1->Id) . ", ";
$myUpQuery .= "FinDateTime=" . StrSafe_DB(date('Y-m-d H:i:s')) . " ";
$myUpQuery .= "WHERE FinEvent=" . StrSafe_DB($row1->Event) . " AND FinMatchNo=" . StrSafe_DB($row1->NextMatchNo + 2) . " AND FinTournament=" . $this->getTourId() . " ";
} else {
$myUpQuery = "UPDATE TeamFinals SET ";
$myUpQuery .= "TfTeam =" . StrSafe_DB($row1->Id) . ", ";
$myUpQuery .= "TfDateTime=" . StrSafe_DB(date('Y-m-d H:i:s')) . " ";
$myUpQuery .= "WHERE TfEvent=" . StrSafe_DB($row1->Event) . " AND TfMatchNo=" . StrSafe_DB($row1->NextMatchNo + 2) . " AND TfTournament=" . $this->getTourId() . " ";
}
$rsUp = safe_w_sql($myUpQuery);
$athProp = $Row1->FinAthlete;
} else {
if ($team == 0) {
$myUpQuery = "UPDATE Finals SET ";
$myUpQuery .= "FinAthlete =" . StrSafe_DB($row1->Id) . ", ";
// 0
$myUpQuery .= "FinDateTime=" . StrSafe_DB(date('Y-m-d H:i:s')) . " ";
$myUpQuery .= "WHERE FinEvent=" . StrSafe_DB($row1->Event) . " AND FinMatchNo=" . StrSafe_DB($row1->NextMatchNo + 2) . " AND FinTournament=" . $this->getTourId() . " ";
} else {
$myUpQuery = "UPDATE TeamFinals SET ";
$myUpQuery .= "TfTeam =" . StrSafe_DB($row1->Id) . ", ";
// 0
$myUpQuery .= "TfDateTime=" . StrSafe_DB(date('Y-m-d H:i:s')) . " ";
$myUpQuery .= "WHERE TfEvent=" . StrSafe_DB($row1->Event) . " AND TfMatchNo=" . StrSafe_DB($row1->NextMatchNo + 2) . " AND TfTournament=" . $this->getTourId() . " ";
}
$rsUp = safe_w_sql($myUpQuery);
}
// Devo fare la propagazione del nome se il matchno>7 (fase>2)
$oldId = $athProp != 0 ? StrSafe_DB($row1->Id) : StrSafe_DB($row0->Id) . ',' . StrSafe_DB($row1->Id);
$update = "";
if ($team == 0) {
$update = "UPDATE Finals SET " . "FinAthlete=" . StrSafe_DB($athProp) . " " . "WHERE FinAthlete IN (" . $oldId . ") AND FinTournament=" . $this->getTourId() . " AND FinEvent=" . StrSafe_DB($row0->Event) . " AND FinMatchNo<" . StrSafe_DB($row0->NextMatchNo) . " AND (FinScore<>0 OR FinTie<>0) ";
//.........这里部分代码省略.........
示例10: dirname
<?php
require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
CheckTourSession(true);
print_r($_COOKIE);
$JS_SCRIPT = array('<script type="text/javascript" src="Fun_AJAX_GetImage.js"></script>', '<script type="text/javascript" src="../Fun_JS.js"></script>');
$txtHeader = "";
$athId = empty($_REQUEST['AthId']) || $_REQUEST['AthId'] == 0 ? null : $_REQUEST['AthId'];
$sql = "SELECT EnCode, EnFirstName, EnName FROM Entries WHERE EnId=" . StrSafe_DB($athId) . " AND EnTournament=" . StrSafe_DB($_SESSION['TourId']);
$Rs = safe_r_sql($sql);
if (safe_num_rows($Rs) == 1) {
$MyRow = safe_fetch($Rs);
$txtHeader = $MyRow->EnCode . " - " . $MyRow->EnFirstName . " " . $MyRow->EnName;
}
$x = 168;
$y = 78;
$w = 300;
$camurl = empty($_REQUEST['CamUrl']) ? "" : urldecode($_REQUEST['CamUrl']);
if (!$camurl) {
$camurl = $_COOKIE['CamUrl'];
}
$boundary = "\n--";
$f = @fopen($camurl, "r");
if ($camurl and $f) {
$r = "";
$im = null;
if (preg_match('/\\.jpg$/i', $camurl) != 0) {
while (!feof($f)) {
$r .= fread($f, 4096);
}
$im = imagecreatefromstring($r);
示例11: get_text
if (safe_num_rows($Rs) > 0) {
echo get_text('Event') . '<br><select id="event1" name="Event[]" multiple="multiple" rows="' . (safe_num_rows($Rs) + 1) . '">';
while ($MyRow = safe_fetch($Rs)) {
echo '<option value="' . $MyRow->EvCode . '@1">' . $MyRow->EvCode . ' - ' . get_text($MyRow->EvEventName, '', '', true) . '</option>';
}
echo '</select>';
safe_free_result($Rs);
}
echo '<br><br><a class="Link" href="javascript:SelectAllOpt(\'event1\');">' . get_text('SelectAll') . '</a>';
print '</td>';
//2o girone eliminatorio
print '<td colspan="2" width="50%" class="Center">';
$MySql = "SELECT EvCode, EvEventName FROM Events WHERE EvTeamEvent='0' AND EvElim2!=0 AND EvTournament=" . StrSafe_DB($_SESSION['TourId']) . " ORDER BY EvProgr";
$Rs = safe_r_sql($MySql);
if (safe_num_rows($Rs) > 0) {
echo get_text('Event') . '<br><select id="event2" name="Event[]" multiple="multiple" rows="' . (safe_num_rows($Rs) + 1) . '">';
while ($MyRow = safe_fetch($Rs)) {
echo '<option value="' . $MyRow->EvCode . '@2">' . $MyRow->EvCode . ' - ' . get_text($MyRow->EvEventName, '', '', true) . '</option>';
}
echo '</select>';
safe_free_result($Rs);
}
echo '<br><br><a class="Link" href="javascript:SelectAllOpt(\'event2\');">' . get_text('SelectAll') . '</a>';
print '</td>';
echo '</tr>';
//Oris e Pulsante
echo '<tr>';
print '<td colspan="4" class="Center">';
echo '<br/><br/><input id="ShowOrisIndividual" name="ShowOrisIndividual" type="checkbox" value="1" onClick="javascript:CheckIfOris(\'ShowOrisIndividual\',\'PrnParametersInd\');"' . ($_SESSION['ISORIS'] ? ' checked="checked"' : '') . '> ' . get_text('StdORIS', 'Tournament') . '<br>';
echo '<br><input type="submit" name="Button" value="' . get_text('Print', 'Tournament') . '"><br> ';
print '</td>';
示例12: StrSafe_DB
$num4session = $ses[0]->SesTar4Session * $ses[0]->SesAth4Target;
}
// Mi serve la sessione attuale del tizio
$query = "SELECT " . "QuSession " . "FROM " . "Qualifications " . "WHERE QuId=" . StrSafe_DB($id) . " ";
$rs = safe_r_sql($query);
$old = 0;
if ($rs) {
if (safe_num_rows($rs) == 1) {
$myRow = safe_fetch($rs);
$old = $myRow->QuSession;
if ($session != 0 && $session != $old) {
// conto gli arcieri di $session sessione
$query = "SELECT " . "COUNT(QuId) AS HowMany " . "FROM " . "Qualifications INNER JOIN Entries ON QuId=EnId AND EnTournament=" . $tourId . " " . "WHERE QuSession=" . StrSafe_DB($session) . " ";
$rs = safe_r_sql($query);
if ($rs) {
if (safe_num_rows($rs) == 1) {
$myRow = safe_fetch($rs);
if ($num4session < $myRow->HowMany + 1) {
$tooMany = 1;
$msg = get_text('NoMoreAth4Session', 'Tournament');
}
}
}
}
if ($tooMany == 0) {
$query = "UPDATE " . "Qualifications " . "SET " . "QuSession=" . StrSafe_DB($session) . " " . "WHERE " . "QuId=" . StrSafe_DB($id) . " ";
$rs = safe_w_sql($query);
// se la riga è stata aggiornata significa che la session è cambiata quindi annullo il target
if (safe_w_affected_rows() == 1) {
$query = "UPDATE " . "Qualifications " . "SET " . "QuTargetNo='', QuBacknoPrinted=0 " . "WHERE " . "QuId=" . StrSafe_DB($id) . " ";
$rs = safe_w_sql($query);
示例13: while
if ($Rs) {
while ($RowEv = safe_fetch($Rs)) {
if ($RowEv->EvTeamEvent == '0') {
$FinEventInd = $RowEv->Quanti;
} elseif ($RowEv->EvTeamEvent == '1') {
$FinEventTeam = $RowEv->Quanti;
}
}
}
// Cerco gli eventi delle eliminatorie
$ElimEvent = array(1 => 0, 2 => 0);
for ($i = 1; $i <= 2; ++$i) {
$Select = "SELECT EvCode FROM Events " . "WHERE EvTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND EvElim" . $i . ">0 AND EvE" . $i . "ShootOff=1 ";
$Rs = safe_r_sql($Select);
if ($Rs && safe_num_rows($Rs) > 0) {
$ElimEvent[$i] = safe_num_rows($Rs);
}
}
list($asc, ) = ExportASC();
/*
* preparo il vettore con i file che non sono pdf
* Mentre lo faccio inizializzo il vettore per ciclare tra i pdf
*/
$pdfFiles = array($ToCode . '_report.pdf' => dirname(__FILE__) . '/FinalReport/PDFReport.php', $ToCode . '.pdf' => dirname(dirname(__FILE__)) . '/Qualification/PrnIndividual.php', $ToCode . '_team.pdf' => dirname(dirname(__FILE__)) . '/Qualification/PrnTeam.php');
$Tour = array();
$Tour[$ToCode . '.ianseo'] = gzcompress(serialize(export_tournament($_SESSION['TourId'], false)));
$Tour[$ToCode . '.asc'] = $asc;
$Tour[$ToCode . '.lst'] = ExportLSTInd();
$Tour[$ToCode . '_team.lst'] = ExportLSTTeam();
if ($ElimEvent[1] > 0 || $ElimEvent[2] > 0) {
//$Tour[$ToCode . '_elim.pdf'] = URLWrapper($CFG->ROOT_DIR .'Elimination/PrnIndividual.php?Lang=' . SelectLanguage(). '&TourId=' . $_SESSION['TourId'] . '&ToFitarco=ignored&Dest=S');
示例14: dirname
<?php
require_once dirname(dirname(__FILE__)) . '/config.php';
require_once 'Common/pdf/LabelPDF.inc.php';
require_once 'CommonCard.php';
$Rs = safe_r_sql($MyQuery);
if (!safe_num_rows($Rs)) {
include 'Common/Templates/head-popup.php';
echo '<table height="' . ($_SESSION['WINHEIGHT'] - 50) . '" width="100%"><tr><td>';
echo '<div align="center">' . get_text('BadgeNoData', 'Tournament') . '';
echo '<br/><br/><input type="button" onclick="window.close();" value="' . get_text('Close') . '">';
echo '</td></tr></table>';
include 'Common/Templates/tail-popup.php';
die;
}
$pdf = new LabelPDF();
$pdf->SetAutoPageBreak(false);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$cntPass = 0;
$ImgSxSize = NULL;
$ImgDxSize = NULL;
$ImgLowSize = NULL;
if (!empty($pdf->ToPaths['ToLeft'])) {
$ImgSxSize = getimagesize($pdf->ToPaths['ToLeft']);
}
if (!empty($pdf->ToPaths['ToRight'])) {
$ImgDxSize = getimagesize($pdf->ToPaths['ToRight']);
}
if (!empty($pdf->ToPaths['ToBottom'])) {
$ImgLowSize = getimagesize($pdf->ToPaths['ToBottom']);
示例15: date
//$year = date('Y') - $yy;
$year = date('Y', $_SESSION['ToWhenFromUTS']) - $yy;
// Estraggo l'ageclass dalla tabella
$Select = "SELECT ClId,ClValidClass " . "FROM Classes " . "WHERE ClTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND ClAgeFrom<=" . StrSafe_DB($year) . " AND ClAgeTo>=" . StrSafe_DB($year) . " ";
//. "AND ClSex = " . StrSafe_DB($Sex) . " ";
$cond = "AND ClSex = " . StrSafe_DB($_REQUEST['d_e_EnSex']) . " ";
$condUnisex = "AND ClSex = -1 ";
$RsCl = safe_r_sql($Select . $cond);
//print $Select.$cond;exit;
if (safe_num_rows($RsCl) == 1) {
$MyRow = safe_fetch($RsCl);
$AgeClass = $MyRow->ClId;
$Classes = $MyRow->ClValidClass;
} elseif (safe_num_rows($RsCl) == 0) {
$RsCl = safe_r_sql($Select . $condUnisex);
if (safe_num_rows($RsCl) == 1) {
$Row = safe_fetch($RsCl);
$AgeClass = $Row->ClId;
$Classes = $MyRow->ClValidClass;
}
}
}
} else {
$Errore = 1;
}
if (!debug) {
header('Content-Type: text/xml');
}
print '<response>' . "\n";
print '<error>' . $Errore . '</error>' . "\n";
print '<ageclass><![CDATA[' . $AgeClass . ']]></ageclass>' . "\n";