'!B!M!C!'); foreach ($type as $tag => $tag_val) { if (!empty($tag_val) && array_key_exists($tag, $SelFields) && (strpos($SelFields[$tag], '!'.$tag_val.'!') === FALSE)) { $e_type[$tag.'_1']=TRUE; } if (in_array($tag, $NotEmpty) && empty($tag_val)) { $e_type[$tag.'_R']=TRUE; } } if (!$Edit || (!array_key_exists('TYPE_SEQ_R', $e_type) && $type['TYPE_SEQ'] != $o_type['TYPE_SEQ'])) { $query='select count(*) from style_type where sg="'.$Comp_SG.'" and type_seq="'.$type['TYPE_SEQ'].'"'; $cnt_res=mysqli_query($db, $query); $cnt_row=mysqli_fetch_row($cnt_res); if ($cnt_row[0] > 0) { $e_type['TYPE_SEQ_1']=TRUE; } } if (!empty($type['TYPE_SEQ']) && (!is_numeric($type['TYPE_SEQ']) || $type['TYPE_SEQ'] < 0 || $type['TYPE_SEQ'] > 255)) { $e_type['TYPE_SEQ_2']=TRUE; } $query='select * from style_type where sg="'.$Comp_SG.'" and type_prefix="'.$type['TYPE_PREFIX'].'" and type_seq!="'.$type['TYPE_SEQ'].'" order by type_seq'; $chk_res=mysqli_query($db, $query); if (mysqli_num_rows($chk_res) > 0) { $chk_row=mysqli_fetch_assoc($chk_res); $e_type['DUP_PREFIX']=$chk_row['type_seq']; } if (!empty($type['TYPE_OFFSET']) || $type['TYPE_OFFSET'] === '0') { if (!is_numeric($type['TYPE_OFFSET'])) { $e_type['TYPE_OFFSET_1']=TRUE; } elseif ($type['TYPE_OFFSET'] < 0 || $type['TYPE_OFFSET'] > 255) { $e_type['TYPE_OFFSET_2']=TRUE; } else { $query='select * from style_type where sg="'.$Comp_SG.'" and type_seq!="'.$type['TYPE_SEQ'].'" and type_offset<="'.$type['TYPE_OFFSET'].'" order by type_offset desc, type_seq'; $chk_res=mysqli_query($db, $query); if (mysqli_num_rows($chk_res) > 0) { $chk_row=mysqli_fetch_assoc($chk_res); $query='select max(cat) from style where sg="'.$Comp_SG.'" and type_seq="'.$chk_row['type_seq'].'"'; $cnt_res=mysqli_query($db, $query); $cnt_row=mysqli_fetch_row($cnt_res); if ($cnt_row[0] + $chk_row['type_offset'] > $type['TYPE_OFFSET']) { $e_type['OFFSET1']=$chk_row['type_seq']; } } $query='select * from style_type where sg="'.$Comp_SG.'" and type_seq!="'.$type['TYPE_SEQ'].'" and type_offset>="'.$type['TYPE_OFFSET'].'" order by type_offset, type_seq'; $chk_res=mysqli_query($db, $query); if (mysqli_num_rows($chk_res) > 0) { $chk_row=mysqli_fetch_assoc($chk_res); $query='select max(cat) from style where sg="'.$Comp_SG.'" and type_seq="'.$type['TYPE_SEQ'].'"'; $cnt_res=mysqli_query($db, $query); $cnt_row=mysqli_fetch_row($cnt_res); if ($cnt_row[0] + $type['TYPE_OFFSET'] > $chk_row['type_offset']) { $e_type['OFFSET2']=$chk_row['type_seq']; } } } } if (count($e_type) == 0) { if (!$Edit) { $query='insert into style_type values(null, "'.$Comp_SG.'", "'.$type['TYPE'].'", "'.$type['TYPE_PREFIX'].'", '; $query.='"'.$type['TYPE_SEQ'].'", "'.$type['TYPE_DESC'].'", "'.$type['TYPE_OFFSET'].'", now())'; if (!mysqli_query($db, $query)) { $e_type['INSERT']=TRUE; } else { $query='insert into changelog values(null, null, "'.$Key.'", "style_type", "A", "", "'.$Comp_SG.':'.$type['TYPE_SEQ'].'", "", "")'; mysqli_query($db, $query); } } else { $query='select * from style_type where sg="'.$Comp_SG.'" and type_seq="'.$TypeSeq.'"'; $type_res=mysqli_query($db, $query); $type_row=mysqli_fetch_assoc($type_res); foreach ($Map as $tag => $row) { if ($type[$tag] != $o_type[$tag]) { if ($o_type[$tag] != $type_row[$row]) { $e_type[$tag.'_C']=TRUE; } } } if (count($e_type) == 0) { foreach ($Map as $tag => $row) { if ($type[$tag] != $o_type[$tag]) { $query='update style_type set '.$row.'="'.$type[$tag].'" where sg="'.$Comp_SG.'" and type_seq="'.$TypeSeq.'"'; if (!mysqli_query($db, $query)) { $e_type['UPDATE']=TRUE; } else { $query='insert into changelog values(null, null, "'.$Key.'", "style_type", "C", "'.$row.'", "'.$Comp_SG.':'.$TypeSeq.'", "'.$o_type[$tag].'", "'.$type[$tag].'")'; mysqli_query($db, $query); } } } } } } if (count($e_type) != 0) { $Page='type.php?k='.$Key.($Edit ? '&t='.$TypeSeq : '').'&s=1&a='.$Action; } else { $Page='type_list.php?k='.$Key; } ?>

Validating Category Type Information

'."\n"; echo 'Category Type '.$type['TYPE_SEQ'].' '.($Edit ? 'Updated' : 'Created')."\n"; echo ''."\n"; echo ''."\n"; } ?>
'."\n"; echo '