$tag_val) { if (!empty($tag_val) && array_key_exists($tag, $SelFields) && (strpos($SelFields[$tag], '!'.$tag_val.'!') === FALSE)) { $e_sess[$tag.'_1']=TRUE; } if (in_array($tag, $NotEmpty) && empty($tag_val)) { $e_sess[$tag.'_R']=TRUE; } } $query='select count(*) from sessions where ses_title="'.$sess['TITLE'].'"'.($Edit ? ' and ses_seq!="'.$Session.'"' : ''); $cnt_res=mysqli_query($db, $query); $cnt_row=mysqli_fetch_row($cnt_res); if ($cnt_row[0] > 0) { $e_sess['TITLE_1']=TRUE; } list($dt,$dt_res)=chk_date($sess['DATE']); if ($dt_res != 0) { $e_sess['DATE_'.$dt_res]=TRUE; } if (!empty($sess['TIME'])) { list($tm_res, $tm)=chk_time($sess['TIME']); if ($tm_res != 0) { $e_sess['TIME_'.$tm_res]=TRUE; } else { $sess['TIME']=$tm; } } if (count($e_sess) == 0) { if (!$Edit) { $query='select max(ses_seq) from sessions'; $max_res=mysqli_query($db, $query); $max_row=mysqli_fetch_row($max_res); $Seq=is_null($max_row[0]) ? 0 : $max_row[0]; while ($Seq >= $Session) { $query='update sessions set ses_seq="'.($Seq + 1).'" where ses_seq="'.$Seq.'"'; if (!mysqli_query($db, $query)) { $e_sess['INSERT']=TRUE; } else { $query='insert into changelog values(null, null, "'.$Key.'", "sessions", "C", "ses_seq", "'.$Seq.'", "'.$Seq.'", "'.($Seq + 1).'")'; mysqli_query($db, $query); $Brewers=array(); $query='select brewer from session_prefs where ses_seq="'.$Seq.'" order by brewer'; $sess_res=mysqli_query($db, $query); while ($sess_row = mysqli_fetch_row($sess_res)) { $Brewers[]=$sess_row[0]; } foreach ($Brewers as $brewer) { $query='update session_prefs set ses_seq="'.($Seq + 1).'" where brewer="'.$brewer.'" and ses_seq="'.$Seq.'"'; mysqli_query($db, $query); $query='insert into changelog values(null, null, "'.$Key.'", "session_prefs", "C", "ses_seq", "'.$brewer.':'.$Seq.'", "'.$Seq.'", "'.($Seq + 1).'")'; mysqli_query($db, $query); } } --$Seq; } if (count($e_sess) == 0) { $query='insert into sessions values(null, "'.$Session.'", "'.$sess['TITLE'].'", "'.$sess['DESC'].'", "'.$sess['LOC'].'", '; $query.='"'.format_date_to_mysql($sess['DATE']).'", "'.$sess['TIME'].'", now())'; if (!mysqli_query($db, $query)) { $e_sess['INSERT']=TRUE; } else { $query='insert into changelog values(null, null, "'.$Key.'", "sessions", "A", "", "'.$Session.'", "", "")'; mysqli_query($db, $query); } } } else { $query='select * from sessions where ses_seq="'.$Session.'"'; $sess_res=mysqli_query($db, $query); $sess_row=mysqli_fetch_assoc($sess_res); foreach ($Map as $tag => $row) { if ($sess[$tag] != $o_sess[$tag]) { $test_val=($tag == 'DATE' ? format_date_from_mysql($sess_row['ses_date']) : $sess_row[$row]); if ($o_sess[$tag] != $test_val) { $e_sess[$tag.'_C']=TRUE; } } } if (count($e_sess) == 0) { foreach ($Map as $tag => $row) { if ($sess[$tag] != $o_sess[$tag]) { $query='update sessions set '.$row.'="'.($tag == 'DATE' ? format_date_to_mysql($sess['DATE']) : $sess[$tag]).'" where ses_seq="'.$Session.'"'; if (!mysqli_query($db, $query)) { $e_sess['UPDATE']=TRUE; } else { $query='insert into changelog values(null, null, "'.$Key.'", "sessions", "C", "'.$row.'", "'.$Session.'", "'.$o_sess[$tag].'", "'.$sess[$tag].'")'; mysqli_query($db, $query); } } } } } } if (count($e_sess) != 0) { $Page='session.php?k='.$Key.'&q='.$Session.'&s=1&a='.$Action; } else { $Page='session_list.php?k='.$Key; } ?>

Validating Session Information

'."\n"; echo '