0) { $Chk1=$Chk + 1; $Chg=FALSE; if (empty($prefs['TC'.$Chk]) && !empty($prefs['TC'.$Chk1])) { $prefs['TC'.$Chk]=$prefs['TC'.$Chk1]; $prefs['TC'.$Chk1]=''; $prefs['TYPE_SEQ'.$Chk]=$prefs['TYPE_SEQ'.$Chk1]; $prefs['TYPE_SEQ'.$Chk1]=0; $prefs['CAT'.$Chk]=$prefs['CAT'.$Chk1]; $prefs['CAT'.$Chk1]=0; $prefs['SUB'.$Chk]=$prefs['SUB'.$Chk1]; $prefs['SUB'.$Chk1]=''; $AnyProb=TRUE; $Chg=TRUE; } --$Chk; } } // // Check for conflict or errors // if ($Submit) { foreach ($A123 as $pref) { if (empty($prefs['SUB'.$pref]) && !empty($prefs['TC'.$pref])) { foreach ($A123 as $Chkpref) { if ($pref == $Chkpref) { continue; } if ($prefs['TC'.$pref] == $prefs['TC'.$Chkpref]) { $AnyProb=TRUE; $e_prefs['pref'.$pref.'_'.$Chkpref]=TRUE; } } if ($IsLikes) { $query='select count(*) from entry where brewer="'.$BrewerNo.'" and type_seq="'.$prefs['TYPE_SEQ'.$pref].'" and cat="'.$prefs['CAT'.$pref].'" and removed!="Y"'; $chk_res=mysqli_query($db, $query); $chk_row=mysqli_fetch_row($chk_res); if ($chk_row[0] > 0) { $AnyProb=TRUE; $e_prefs['pref'.$pref.'_E']=TRUE; } } } } $Ranks=$IsLikes ? array(-1, -2, -3) : $A123; foreach ($Ranks as $OtherRank) { $query='select * from style_prefs where brewer="'.$BrewerNo.'" and rank="'.$OtherRank.'"'; $rank_res=mysqli_query($db, $query); if (mysqli_num_rows($rank_res) == 0) { continue; } $rank_row=mysqli_fetch_assoc($rank_res); if (empty($rank_row['cat'])) { continue; } foreach ($A123 as $Rank) { if ($rank_row['type_seq'] == $prefs['TYPE_SEQ'.$Rank] && $rank_row['cat'] == $prefs['CAT'.$Rank] && (empty($prefs['SUB'.$Rank]) || empty($rank_row['sub_cat']) || $rank_row['sub_cat'] == $prefs['SUB'.$Rank])) { $e_prefs['pref'.$Rank.'_O'.abs($OtherRank)]=TRUE; $AnyProb=TRUE; } } } } // // Update Table // if ($Submit && !$AnyProb) { $Ranks=$IsLikes ? $A123 : array(-1, -2, -3); foreach ($Ranks as $Rank) { $AbsRank=abs($Rank); $query='select * from style_prefs where brewer="'.$BrewerNo.'" and rank="'.$Rank.'"'; $rank_res=mysqli_query($db, $query); if (mysqli_num_rows($rank_res) < 1) { if (empty($prefs['TC'.$AbsRank])) { continue; } $query='insert into style_prefs values (null, "'.$BrewerNo.'", "'.$Rank.'", "'.$prefs['TYPE_SEQ'.$AbsRank].'", "'.$prefs['CAT'.$AbsRank].'", "'.$prefs['SUB'.$AbsRank].'", now())'; mysqli_query($db, $query); $query='insert into changelog values(null, null, "'.$Key.'", "style_prefs", "A", "", "'.$BrewerNo.':'.$Rank.'", "", "")'; mysqli_query($db, $query); } else { $rank_row=mysqli_fetch_assoc($rank_res); if (empty($prefs['TC'.$AbsRank])) { $query='delete from style_prefs where brewer="'.$BrewerNo.'" and rank="'.$Rank.'"'; mysqli_query($db, $query); $query='insert into changelog values (null, null, "'.$Key.'", "style_prefs", "C", "type_seq", "'.$BrewerNo.':'.$Rank.'", "'.$prefs['TYPE_SEQ'.$AbsRank].'", "")'; mysqli_query($db, $query); $query='insert into changelog values (null, null, "'.$Key.'", "style_prefs", "C", "cat", "'.$BrewerNo.':'.$Rank.'", "'.$prefs['CAT'.$AbsRank].'", "")'; mysqli_query($db, $query); if (!empty($prefs['SUB'.$AbsRank])) { $query='insert into changelog values (null, null, "'.$Key.'", "style_prefs", "C", "sub_cat", "'.$BrewerNo.':'.$Rank.'", "'.$prefs['SUB'.$AbsRank].'", "")'; mysqli_query($db, $query); } $query='insert into changelog values(null, null, "'.$Key.'", "style_prefs", "D", "", "'.$BrewerNo.':'.$Rank.'", "", "")'; mysqli_query($db, $query); } else { if ($prefs['TYPE_SEQ'.$AbsRank] != $rank_row['type_seq']) { $query='update style_prefs set type_seq="'.$prefs['TYPE_SEQ'.$AbsRank].'" where brewer="'.$BrewerNo.'" and rank="'.$Rank.'"'; mysqli_query($db, $query); $query='insert into changelog values (null, null, "'.$Key.'", "style_prefs", "C", "type_seq", "'.$BrewerNo.':'.$Rank.'", "'.$rank_row['type_seq'].'", "'.$prefs['TYPE_SEQ'.$AbsRank].'")'; mysqli_query($db, $query); } if ($prefs['CAT'.$AbsRank] != $rank_row['cat']) { $query='update style_prefs set cat="'.$prefs['CAT'.$AbsRank].'" where brewer="'.$BrewerNo.'" and rank="'.$Rank.'"'; mysqli_query($db, $query); $query='insert into changelog values (null, null, "'.$Key.'", "style_prefs", "C", "cat", "'.$BrewerNo.':'.$Rank.'", "'.$rank_row['cat'].'", "'.$prefs['CAT'.$AbsRank].'")'; mysqli_query($db, $query); } if ($prefs['SUB'.$AbsRank] != $rank_row['sub_cat']) { $query='update style_prefs set sub_cat="'.$prefs['SUB'.$AbsRank].'" where brewer="'.$BrewerNo.'" and rank="'.$Rank.'"'; mysqli_query($db, $query); $query='insert into changelog values (null, null, "'.$Key.'", "style_prefs", "C", "sub_cat", "'.$BrewerNo.':'.$Rank.'", "'.$rank_row['sub_cat'].'", "'.$prefs['SUB'.$AbsRank].'")'; mysqli_query($db, $query); } } } } } } ?>
0 ? 'E' : ''), $Key, $BrewerNo); } else { links_bar('BM'.(cntEntry($BrewerNo)>0 ? 'EP' : ''), $Key); } ?>

'."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo '
'."\n"; echo '
'."\n"; echo ''."\n"; echo '
'."\n"; echo '
'."\n"; echo '
'."\n"; $query='select count(*) from style_prefs where brewer="'.$BrewerNo.'" and rank'.($IsLikes ? '<' : '>').'0'; $cnt_res=mysqli_query($db, $query); $cnt_row=mysqli_fetch_row($cnt_res); echo ''."\n"; echo '
'."\n"; echo '
'."\n"; } ?>
'."\n"; if (!$Reload) { BuildHidden($prefs, TRUE); BuildHidden($e_prefs); BuildHidden($o_prefs, TRUE, '_ORIG'); if ($Edit) { echo ''."\n"; } } echo ''."\n"; echo ''."\n"; echo ''."\n"; } ?>