incoming array ";
//var_dump($incoming);
// ******** begin database manipulation ********
if (!isset($report_date) || $report_date=="automatic") $report_date=$today;
if (!isset($report_time) || $report_time=="automatic") $report_time=$now;
if (isset($create)) {
// add the entry if create is pressed
if ($discrepancy_text!=NULL && $reported_by!=NULL && $device!=NULL && $subsystem!=NULL && $discovered!=NULL) {
// sanitize and fix blank date and time
$report_date=mysqli_real_escape_string($drs_db,$report_date);
$report_time=mysqli_real_escape_string($drs_db,$report_time);
if (!isset($report_date)) $report_date=$today;
if (!isset($report_time)) $report_time=$now;
// remove html tags from discrepancy text and sanitize
$discrepancy_text=strip_tags($discrepancy_text);
$clean_discrepancy_text=mysqli_real_escape_string($drs_db,$discrepancy_text);
$clean_reported_by=mysqli_real_escape_string($drs_db,$reported_by);
// add the record to writeups
mysqli_query($drs_db,"insert into writeups(device,discovered,functional,reported_by,report_date,report_time,subsystem,discrepancy_text,status)
values (\"$device\",\"$discovered\",\"$functional\",\"$clean_reported_by\",\"$report_date\",\"$report_time\",\"$subsystem\",\"$clean_discrepancy_text\",\"$status\")");
}
}
// ******** end database manipulation ********
pagetable("begin");
if (!$print) {
pageblock("left","begin");
sidemenu();
pageblock("left","end");
}
pageblock("right","begin");
banner($print);
echo " ";
// display the form
if (isset($create)) {
if ($discrepancy_text!=NULL && $reported_by!=NULL) {
format_message(0,"Writeup created. You may create another writeup or return to View Writeups page.");
$preserve=false;
}
if ($device==NULL) {
format_message(1,"You didn't select a $device_term. Please try again.");
$preserve=true;
}
if ($subsystem==NULL) {
format_message(1,"You didn't select a subsystem. Please try again.");
$preserve=true;
}
if ($discovered==NULL) {
format_message(1,"You didn't select a $discovered_term. Please try again.");
$preserve=true;
}
if ($discrepancy_text==NULL) {
format_message(1,"You didn't enter any discrepancy text. Please try again.");
$preserve=true;
}
if ($reported_by==NULL) {
format_message(1,"You didn't enter your name in the Reported by: block. Please try again.");
$preserve=true;
}
} else {
$preserve=false;
}
echo "
";
banner($print);
pageblock("right","end");
pagetable("end");
framework("end","","",$print);
?>