1, 'INCSCORE' => 1, 'INCALL' => 1, 'INCCLUBPTS' => 1); $Assign=array('INCALL' => 'IncludeAll', 'INCCLUBPTS' => 'IncludeClubPoints', 'INCNAME' => 'IncludeName', 'INCSCORE' => 'IncludeScore'); foreach ($Len as $tag => $maxlen) { $LenChk=(!array_key_exists($tag, $_POST) || empty($_POST[$tag])) ? 'N' : chk_str($_POST[$tag], $maxlen); ${$Assign[$tag]}=(in_array($LenChk, array('N', 'Y')) ? $LenChk : 'N'); } // // Build line in results table // function TableLine ($res_file, $place, $brewer, $brewname, $type_seq, $cat, $sub_cat, $score) { global $IncludeName; global $IncludeScore; global $db; fwrite($res_file, '= 1 && $place <=4 ? 'class="place'.$place.'"' : '').'>'."\n"); fwrite($res_file, ''."\n"); if ($place >= 1 && $place <= 4) { fwrite($res_file, (($place == 4) ? 'HM' : $place)."\n"); } else { fwrite($res_file, '-'."\n"); } fwrite($res_file, ''."\n"); $query='select brewer_type, fname, lname, groupname, brewclub from brewer where brewer="'.$brewer.'"'; $brewer_res=mysqli_query($db, $query); $brewer_row=mysqli_fetch_assoc($brewer_res); fwrite($res_file, ''."\n"); fwrite($res_file, ($brewer_row['brewer_type'] != 'G' ? safe($brewer_row['fname'])." ".safe($brewer_row['lname']) : safe($brewer_row['groupname']))."\n"); if ($IncludeName == 'Y' && !empty($brewname)) { fwrite($res_file, '
'.$brewname."\n"); } fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, disp_cat($type_seq, $cat, $sub_cat)."\n"); fwrite($res_file, ''."\n"); if ($IncludeScore == 'Y') { fwrite($res_file, ''."\n"); fwrite($res_file, ($score > 0 ? $score : 'N/A')."\n"); fwrite($res_file, ''."\n"); } fwrite($res_file, ''."\n"); if (empty($brewer_row['brewclub']) || $brewer_row['brewclub'] == 'None') { fwrite($res_file, ' '); } else { fwrite($res_file, safe($brewer_row['brewclub'])); } fwrite($res_file, "\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); } // ?>

Building Results Page


'."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); $Line=''; if (!empty($Comp_Annual)) { $Line.=$Comp_Annual.' Annual '; } $Line.=$Comp_Title; if (!empty($Comp_Year)) { $Line.=' '.$Comp_Year; } fwrite($res_file, $Line.' Results'."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); if (!empty($Comp_Club)) { fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); } fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, '
'."\n"); fwrite($res_file, $Comp_Club.' Proudly Presents'."\n"); fwrite($res_file, '
'."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, '
'."\n"); $Title=''; if (!empty($Comp_Annual)) { $Title.=$Comp_Annual.' Annual '; } $Title.=$Comp_Title; if (!empty($Comp_Year)) { $Title.=' '.$Comp_Year; } fwrite($res_file, $Title."\n"); fwrite($res_file, '
'."\n"); if (img_avail('COMP') || img_avail('AHAIMG') || img_avail('BJCPIMG')) { if (img_avail('COMP')) { $img_src=get_ctrl('COMPIMG'); $img_alt=get_ctrl('COMPALT'); $img_url=get_ctrl('COMPURL'); $img_height=get_ctrl('COMPY'); $img_width=get_ctrl('COMPX'); if (!empty($img_url)) { fwrite($res_file, ''); } fwrite($res_file, ''.$img_alt.''."\n"); if (!empty($img_url)) { fwrite($res_file, ''); } fwrite($res_file, "\n"); } if (img_avail('AHA')) { $img_src=get_ctrl('AHAIMG'); $img_alt='American Homebrewers Association'; $img_url='www.beertown.org'; $img_height=get_ctrl('AHAY'); $img_width=get_ctrl('AHAX'); if (!empty($img_url)) { fwrite($res_file, ''); } fwrite($res_file, ''.$img_alt.''."\n"); if (!empty($img_url)) { fwrite($res_file, ''); } fwrite($res_file, "\n"); } if (img_avail('BJCP')) { $img_src=get_ctrl('BJCPIMG'); $img_alt='Beer Judge Certification Program'; $img_url='www.bjcp.org'; $img_height=get_ctrl('BJCPY'); $img_width=get_ctrl('BJCPX'); if (!empty($img_url)) { fwrite($res_file, ''); } fwrite($res_file, ''.$img_alt.''."\n"); if (!empty($img_url)) { fwrite($res_file, ''); } fwrite($res_file, "\n"); } } else { fwrite($res_file, ' '."\n"); } fwrite($res_file, '
'."\n"); fwrite($res_file, '
'."\n"); if (img_avail('CLUB')) { $img_src=get_ctrl('CLUBIMG'); $img_alt=get_ctrl('CLUBALT'); $img_url=get_ctrl('CLUBURL'); $img_height=get_ctrl('CLUBY')*2; $img_width=get_ctrl('CLUBX')*2; if (!empty($img_url)) { fwrite($res_file, ''); } fwrite($res_file, ''.$img_alt.''); if (!empty($img_url)) { fwrite($res_file, ''); } fwrite($res_file, "\n"); } else { fwrite($res_file, ' '."\n"); } fwrite($res_file, '
'."\n"); fwrite($res_file, '
'."\n"); fwrite($res_file, ''."\n"); $query='select distinct flight from entry where removed!="Y" and flight is not null order by flight'; $flight_res=mysqli_query($db, $query); while ($flight_row=mysqli_fetch_assoc($flight_res)) { fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); } fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); if ($IncludeClubPoints == 'Y') { fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); } fwrite($res_file, '
'."\n"); fwrite($res_file, 'Flight '.$flight_row['flight'].'
'."\n"); $query='select distinct type_seq, cat from entry where flight="'.$flight_row['flight'].'" order by type_seq, cat'; $flight_cat_res=mysqli_query($db, $query); while ($flight_cat_row=mysqli_fetch_assoc($flight_cat_res)) { $query='select count(*) from entry where flight!="'.$flight_row['flight'].'" and type_seq="'.$flight_cat_row['type_seq'].'" and cat="'.$flight_cat_row['cat'].'"'; $other_flight_res=mysqli_query($db, $query); $other_flight_row=mysqli_fetch_row($other_flight_res); if ($other_flight_row[0] == 0) { list($Cat, $SubCat)=get_desc($flight_cat_row['type_seq'], $flight_cat_row['cat']); fwrite($res_file, $flight_cat_row['cat'].' - '.$Cat.'
'."\n"); } else { $query='select distinct sub_cat from entry where flight="'.$flight_row['flight'].'" and type_seq="'.$flight_cat_row['type_seq'].'" and cat="'.$flight_cat_row['cat'].'" order by sub_cat'; $flight_subcat_res=mysqli_query($db, $query); while ($flight_subcat_row=mysqli_fetch_assoc($flight_subcat_res)) { list($Cat, $SubCat)=get_desc($flight_cat_row['type_seq'], $flight_cat_row['cat'], $flight_subcat_row['sub_cat']); fwrite($res_file, $flight_cat_row['cat'].$flight_subcat_row['sub_cat'].' - '.$Cat.' - '.$SubCat.'
'."\n"); } } } fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); if ($IncludeScore == 'Y') { fwrite($res_file, ''."\n"); } fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); $query='select place, brewer, type_seq, cat, sub_cat, name, score, entry from entry'; $query.=' where flight="'.$flight_row['flight'].'" and place is not null and place between 1 and 4 order by place'; $entry_res=mysqli_query($db, $query); while ($entry_row=mysqli_fetch_assoc($entry_res)) { TableLine ($res_file, $entry_row['place'], $entry_row['brewer'], $entry_row['name'], $entry_row['type_seq'], $entry_row['cat'], $entry_row['sub_cat'], $entry_row['score']); } if ($IncludeAll == 'Y') { $query='select place, brewer, type_seq, cat, sub_cat, name, score, entry from entry'; $query.=' where flight="'.$flight_row['flight'].'" and score is not null and score > 0 and'; $query.=' (place is null or place < 1 or place > 4) order by score desc, entry'; $entry_res=mysqli_query($db, $query); while ($entry_row=mysqli_fetch_assoc($entry_res)) { TableLine ($res_file, $entry_row['place'], $entry_row['brewer'], $entry_row['name'], $entry_row['type_seq'], $entry_row['cat'], $entry_row['sub_cat'], $entry_row['score']); } } fwrite($res_file, '
PlaceNameCat/SubScoreClub
'."\n"); fwrite($res_file, '

'."\n"); fwrite($res_file, '
'."\n"); fwrite($res_file, 'Best of Show (Beer)'."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); $query='select bos_place, brewer, type_seq, cat, sub_cat, name from entry where bos_place is not null and bos_place between 1 and 4 order by bos_place'; $bos_res=mysqli_query($db, $query); while ($bos_row=mysqli_fetch_assoc($bos_res)) { fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); $query='select brewer_type, fname, lname, groupname, brewclub from brewer where brewer="'.$bos_row['brewer'].'"'; $brewer_res=mysqli_query($db, $query); $brewer_row=mysqli_fetch_assoc($brewer_res); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); } fwrite($res_file, '
BOS PlaceNameCat/SubClub
'."\n"); fwrite($res_file, (($bos_row['bos_place'] == 4) ? 'HM' : $bos_row['bos_place'])."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ($brewer_row['brewer_type'] != 'G' ? safe($brewer_row['fname'])." ".safe($brewer_row['lname']) : safe($brewer_row['groupname']))."\n"); if ($IncludeName == 'Y' && !empty($bos_row['name'])) { fwrite($res_file, '
'.$bos_row['name']."\n"); } fwrite($res_file, '
'."\n"); fwrite($res_file, disp_cat($bos_row['type_seq'], $bos_row['cat'], $bos_row['sub_cat'])."\n"); fwrite($res_file, ''."\n"); if (empty($brewer_row['brewclub']) || $brewer_row['brewclub'] == 'None') { fwrite($res_file, ' '); } else { fwrite($res_file, safe($brewer_row['brewclub'])); } fwrite($res_file, "\n"); fwrite($res_file, '
'."\n"); fwrite($res_file, '

'."\n"); fwrite($res_file, '
'."\n"); fwrite($res_file, 'Club Points'."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); foreach ($ClubPoints as $Club => $TotalPoints) { fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); } fwrite($res_file, '
ClubPoints
'.$Club.''.$TotalPoints.'
'."\n"); fwrite($res_file, '
'."\n"); fwrite($res_file, ''."\n"); fwrite($res_file, ''."\n"); fclose($res_file); ?> Built File - - containing Results