'."\n"; ?> 1) { if (test_SubCat($entry['TYPE_SEQ'], $entry['CAT'], $entry['SUBCAT'])) { if ($Restrict == 'S') { $query='select count(*) from entry where brewer="'.$BrewerNo.'" and type_seq="'.$entry['TYPE_SEQ'].'"'; $query.=' and cat="'.$entry['CAT'].'" and sub_cat="'.$entry['SUBCAT'].'" and removed!="Y"'; if ($Edit) { $query.=' and entry!='.$Entry; } $cnt_res=mysqli_query($db, $query); $cnt_row=mysqli_fetch_row($cnt_res); if ($cnt_row[0] != 0) { $e_entry['SUBCAT_1']=TRUE; $Stage=2; } } if (count($e_entry) == 0) { if (!empty($o_entry['SUBCAT']) && $entry['SUBCAT'] != $o_entry['SUBCAT']) { $Stage=2; $Step=TRUE; } else { if ($Stage == 2) { $Step=TRUE; } } if (count($e_entry) == 0 && !empty($entry['BASECAT'])) { $Stage=3; } } } else { $e_entry['SUBCAT_2']=TRUE; $Stage=2; } } if ($Stage > 2) { $query='select * from style_sub where sg="'.$Comp_SG.'" and type_seq="'.$entry['TYPE_SEQ'].'" and cat="'.$entry['CAT'].'" and sub_cat="'.$entry['SUBCAT'].'"'; $scat_res=mysqli_query($db, $query); $scat_row=mysqli_fetch_assoc($scat_res); if ($scat_row['req_desc'] != 'N') { if (empty($entry['DESC'])) { $e_entry['DESC_R']=TRUE; } elseif ($entry['DESC'] == 'Custom' && empty($entry['CUSTOM'])) { $e_entry['CUSTOM_R']=TRUE; } } if ($scat_row['req_base'] != 'N') { if (!empty($o_entry['BASECAT']) && $entry['BASECAT'] != $o_entry['BASECAT']) { $Stage=3; $entry['BASESUBCAT']=''; } if (empty($entry['BASECAT'])) { if ($scat_row['req_base'] == 'Y') { $e_entry['BASECAT_R']=TRUE; } } else { if (test_Cat($entry['BASE_TYPE_SEQ'], $entry['BASECAT'])) { $Step=TRUE; } else { $e_entry['BASECAT_2']=TRUE; } } } } else { $scat_row=array(); } if ($Stage > 2 && !empty($Submit) && $Submit != 'SKIP') { if ($scat_row['req_comment'] == 'Y') { if (empty($entry['COMMENT']) || strlen($entry['COMMENT']) == 0) { $e_entry['COMMENT_1']=TRUE; } } if ($scat_row['req_strength'] != 'N') { if (empty($entry['STRENGTH']) || (!in_array($entry['STRENGTH'], array('1', '2', '3')))) { $e_entry['STRENGTH_1']=TRUE; } } if ($scat_row['req_sweetness'] != 'N') { if (empty($entry['SWEETNESS']) || (!in_array($entry['SWEETNESS'], valid_sweetness($scat_row['req_sweetness'], $scat_row['type_seq'])))) { $e_entry['SWEETNESS_1']=TRUE; } } if ($scat_row['req_carbonation'] != 'N') { if (empty($entry['CARBONATION']) || (!in_array($entry['CARBONATION'], valid_carbonation($scat_row['req_carbonation'])))) { $e_entry['CARBONATION_1']=TRUE; } } if ($scat_row['req_color'] != 'N') { if (empty($entry['COLOR']) || !in_array($entry['COLOR'], valid_color($scat_row['req_color']))) { $e_entry['COLOR_1']=TRUE; } } } if ($Stage > 3) { if ($scat_row['req_base'] != 'N') { if (!empty($entry['BASESUBCAT'])) { if (test_SubCat($entry['BASE_TYPE_SEQ'], $entry['BASECAT'], $entry['BASESUBCAT'])) { if (!empty($o_entry['BASESUBCAT']) && $entry['BASESUBCAT'] != $o_entry['BASESUBCAT']) { $Stage=4; } } else { $e_entry['BASESUBCAT_2']=TRUE; } } elseif ($scat_row['req_base'] == 'Y') { $e_entry['BASESUBCAT_R']=TRUE; } } } if ($Step && ($Stage < 4)) { ++$Stage; } if (strpos('!Y!N!', '!'.$entry['SHOWNOTE'].'!') === FALSE) { $entry['SHOWNOTE']='Y'; } ?>
0 ? 'EP' : ''), $Key, $BrewerNo, $Entry); } else { links_bar('BEMG'.($EntryCnt > 0 ? 'EP' : '').($Edit ? 'I' : ''), $Key, '', $Entry); } ?>

Validating Entry Information

$row) { if ($tag == 'BASECAT') { $Chk=empty($entry['BASECAT']) ? '0' : $entry['BASECAT']; } else { $Chk=$entry[$tag]; } if ($Chk != $entry_row[$row]) { $Notify=TRUE; $query='update entry set '.$row.'="'.$Chk.'" where entry="'.$Entry.'" and brewer='.$BrewerNo; if (!mysqli_query($db, $query)) { $e_entry['UPDATE']=TRUE; } else { $query='insert into changelog values(null, null, "'.$Key.'", "entry", "C", "'.$row.'", "'.$Entry.'", "'.$entry_row[$row].'", "'.$Chk.'")'; mysqli_query($db, $query); } } } } if (count($e_entry) == 0 && !$LimitMax) { $rank=array(); $query='select rank from style_prefs where brewer="'.$BrewerNo.'" and rank>0 and '; $query.='cat="'.$entry['CAT'].'" and (sub_cat="" or sub_cat="'.$entry['SUBCAT'].'")'; $cnt_res=mysqli_query($db, $query); while ($cnt_row=mysqli_fetch_assoc($cnt_res)) { $rank[]=$cnt_row['rank']; } if (count($rank) != 0) { $ChgPrefs=TRUE; foreach ($rank as $rank_rem) { $query='select type_seq, cat, sub_cat from style_prefs where brewer="'.$BrewerNo.'" and rank="'.$rank_rem.'"'; $prefs_res=mysqli_query($db, $query); $prefs_row=mysqli_fetch_assoc($prefs_res); $query='delete from style_prefs where brewer="'.$BrewerNo.'" and rank="'.$rank_rem.'"'; mysqli_query($db, $query); $query='insert into changelog values (null, null, "'.$Key.'", "style_prefs", "C", "cat", "'.$BrewerNo.':'.$rank_rem.'", "'.$prefs_row['type_seq'].':'.$prefs_row['cat'].':'.$prefs_row['sub_cat'].'", "")'; mysqli_query($db, $query); $query='insert into changelog values(null, null, "'.$Key.'", "style_prefs", "D", "", "'.$BrewerNo.':'.$rank_rem.'", "", "")'; mysqli_query($db, $query); } foreach (array('1', '2') as $Outer) { foreach (array('2', '1') as $Inner) { $query='select count(*) from style_prefs where brewer="'.$BrewerNo.'" and rank="'.$Inner.'"'; $cnt_res=mysqli_query($db, $query); $cnt_row=mysqli_fetch_row($cnt_res); if ($cnt_row[0] != 0) { continue; } $query='select count(*) from style_prefs where brewer="'.$BrewerNo.'" and rank="'.($Inner+1).'"'; $cnt_res=mysqli_query($db, $query); $cnt_row=mysqli_fetch_row($cnt_res); if ($cnt_row[0] != 0) { continue; } $query='update style_prefs set rank="'.$Inner.'" where brewer="'.$BrewerNo.'" and rank="'.($Inner+1).'"'; mysqli_query($db, $query); $query='insert into changelog values (null, null, "'.$Key.'", "style_prefs", "C", "rank", "'.$BrewerNo.':'.($Inner+1).'", "'.($Inner+1).'", "'.$Inner.'")'; mysqli_query($db, $query); } } } } } if (count($e_entry) == 0 && !empty($Submit)) { list($CatDesc, $SubCatDesc)=get_desc($entry['TYPE_SEQ'], $entry['CAT'], $entry['SUBCAT']); list($BaseCatDesc, $BaseSubCatDesc)=get_desc($entry['BASE_TYPE_SEQ'], $entry['BASECAT'], $entry['BASESUBCAT']); echo '

'."\n"; echo 'Congratulations, Brewer # '.$BrewerNo.'
'."\n"; echo safe($brew_row['brewer_type'] != 'G' ? $brew_row['fname'].' '.$brew_row['lname'] : $brew_row['groupname']).'
'."\n"; echo '

'."\n"; echo '

'."\n"; echo 'Your '.disp_cat($entry['TYPE_SEQ'], $entry['CAT'], $entry['SUBCAT']).'
'."\n"; echo $CatDesc; if (strlen($SubCatDesc) != 0) { echo ' - '.$SubCatDesc; } echo '
'."\n"; echo 'has been '.($Edit ? 'updated' : 'accepted').' as Entry '.$Entry."\n"; echo '

'."\n"; if ($LimitMax) { echo '

'."\n"; echo 'Unfortunately, '.ExcessDesc(KindOfLimit($BrewerNo, $entry['TYPE_SEQ'], $entry['CAT'], $entry['SUBCAT'])).' Limit was reached while you were making your entry.
'."\n"; echo 'Entry information was saved, but marked as Removed'."\n"; if (cntEntry($BrewerNo) > 0) { echo '
You might be able to Remove one of your other entries and Restore this one.'; } echo '

'."\n"; } if ($ChgPrefs == 'y') { echo '

'."\n"; echo 'This entry was in a previously specified Liked style preference.
'."\n"; echo 'That Liked style preference has been removed.'."\n"; echo '

'."\n"; } echo ''."\n"; echo ''."\n"; if ($Comp_Stage != 'POST') { echo ''."\n"; } echo ''."\n"; echo ''."\n"; echo ''."\n"; echo '
'."\n"; echo '
'."\n"; echo ''."\n"; echo '
'."\n"; echo '
'."\n"; echo '
'."\n"; echo ''."\n"; echo '
'."\n"; echo '
'."\n"; echo '
'."\n"; echo ''."\n"; echo '
'."\n"; echo '
'."\n"; } else { echo '
'."\n"; if (empty($Submit) || (count($e_entry) != 0 && $Submit != 'SKIP')) { BuildHidden($e_entry); BuildHidden($entry, TRUE); } echo '
'."\n"; echo ''."\n"; } ?>
0) { $message.='-'.$SubCatDesc; } $message.="\n"; if (strlen($entry['NAME']) > 0) { $message.='Name: '.$entry['NAME']."\n"; } if ($entry['BASECAT'] > 0) { $message.='Base Category: '.disp_cat($entry['BASE_TYPE_SEQ'], $entry['BASECAT'], $entry['BASESUBCAT']).' - '.$BaseCatDesc; if (strlen($BaseSubCatDesc) > 0) { $message.='-'.$BaseSubCatDesc; } $message.="\n"; } if ($entry['STRENGTH'] > 0) { $message.='Strength: '.disp_strength($entry['STRENGTH'], $entry['TYPE_SEQ'], $entry['CAT'])."\n"; } if ($entry['SWEETNESS'] > 0) { $message.='Sweetness: '.disp_sweetness($entry['SWEETNESS'], $entry['TYPE_SEQ'])."\n"; } if ($entry['CARBONATION'] > 0) { $message.='Carbonation: '.disp_carbonation($entry['CARBONATION'], $entry['TYPE_SEQ'])."\n"; } if ($entry['COLOR'] > 0) { $message.='Color: '.disp_color($entry['COLOR'], $entry['TYPE_SEQ'], $entry['CAT'], $entry['SUBCAT'])."\n"; } if (strlen($entry['COMMENT']) > 0) { $message.='Comment:'."\n".$entry['COMMENT']; } $headers=email_reply(); if (($AdminAcct && $GenMail=='A') || (!$AdminAcct && ($GenMail == 'U' || ($GenMail == 'C' && !$Edit)))) { $res=mail($brew_row['email'], $subject, $message, $headers); } } } ?>