Example #1
0
    $divs[] = $MyRow->DivId;
}
$Divisions = implode(',', array_unique($divs));
// get the classes based on the division selected
$Select2 = "select ClId, ClValidClass, DivId from Classes" . " inner join Divisions on DivTournament=ClTournament and DivAthlete=ClAthlete" . ($Div ? " AND DivId='{$Div}'" : '') . " where ClTournament={$_SESSION['TourId']}" . " AND (ClDivisionsAllowed='' or find_in_set(DivId, ClDivisionsAllowed))" . " AND ClSex in (-1, {$Sex})" . ($Age ? " and (ClAthlete!='1' or (ClAgeFrom<={$Age} and ClAgeTo>={$Age}))" : '') . " order by ClViewOrder, DivViewOrder ";
$RsCl = safe_r_sql($Select2);
while ($MyRow = safe_fetch($RsCl)) {
    $clas[] = $MyRow->ClId;
}
// get the VALID classes based on the division and class selected
$Select3 = "select ClId, ClValidClass, DivId from Classes" . " inner join Divisions on DivTournament=ClTournament and DivAthlete=ClAthlete" . ($Div ? " AND DivId='{$Div}'" : '') . " where ClTournament={$_SESSION['TourId']}" . " AND (ClDivisionsAllowed='' or find_in_set(DivId, ClDivisionsAllowed))" . " AND ClSex in (-1, {$Sex})" . ($Clas ? " AND ClId='{$Clas}'" : '') . ($Age ? " and (ClAthlete!='1' or (ClAgeFrom<={$Age} and ClAgeTo>={$Age}))" : '') . " order by ClViewOrder, DivViewOrder ";
$RsCl = safe_r_sql($Select3);
while ($MyRow = safe_fetch($RsCl)) {
    $vald = array_merge($vald, explode(',', $MyRow->ClValidClass));
}
if ($Age or $Sex !== false or $Div) {
    $AgeClass = implode(',', array_unique($clas));
    $Classes = implode(',', array_unique($vald));
}
header('Content-Type: text/xml');
print '<response>' . "\n";
print '<error>' . $Errore . '</error>' . "\n";
print '<dob><![CDATA[' . RevertDate($ctrlCode) . ']]></dob>' . "\n";
print '<divisions><![CDATA[' . $Divisions . ']]></divisions>' . "\n";
print '<ageclass><![CDATA[' . $AgeClass . ']]></ageclass>' . "\n";
print '<classes><![CDATA[' . $Classes . ']]></classes>' . "\n";
print '<sql><![CDATA[' . "{$Select1}\n{$Select2}\n{$Select3}" . ']]></sql>' . "\n";
print '</response>' . "\n";
?>

function GoodDate($TheDate)
{
    return RevertDate($TheDate) === false ? false : true;
}