function check_session($session_id) { if ($session_id < 0) { if (!($session_code = session_code())) { die('No session code'); } $query = 'SELECT session_id FROM session WHERE session_code="' . $session_code . '"'; $result = mysql_query($query); if (!$result) { $message = 'Invalid query: ' . mysql_error() . "\n"; $message .= 'Whole query: ' . $query; die($message); } if ($row = mysql_fetch_assoc($result)) { $session_id = $row['session_id']; } else { die('Invalid session code'); } } return $session_id; }
<h2 class="sqa">GBPS data entry [ <a href="muga_study.php?session_code=<?php echo session_code(); ?> ">Part 1</a> | <span class="sqasel">Part 2</span> | <A href="../checked_in.php?session_code=<?php echo session_code(); ?> ">Exit</a> ]</h2> <SPAN class="sqa">Enter data and click save below.</span> <form action="muga_data.php?session_code=<?php echo session_code(); ?> " method="POST"> <FIELDSET class="sqaf"> <LEGEND class="sqaf">Computer System and Software</LEGEND> <DIV class="sqaf"> <SPAN class="sqaf">Manufacturer: </SPAN> <?php $row = update_field('muga_session', 'manufacturer', '/^.*$/', true, 'session_id', $session_id, $row); ?> <INPUT name="manufacturer" size="24" type="text" value="<?php echo htmlspecialchars($row['manufacturer']); ?> " tabindex="" />
<div class="results"> <h3 class="results">Was background subtraction used?</h3> <?php $values = array('0' => 'no', '1' => 'yes'); $stats = collection_stats('muga_session', 'background_subtraction_used', $values, false, $collection_id); $session_stats = session_stats('muga_session', 'background_subtraction_used', $values, false, $session_id); tabulate_stats($values, $stats, $session_stats); ?> </div> <div class="results"> <h3 class="results">What type of smoothing was used (if any)?</h3> <?php $values = array('0' => 'No smoothing', '1' => 'Temporal', '2' => 'Spatial', '3' => 'Spatial and Temporal'); $stats = collection_stats('muga_session', 'smoothing_type', $values, false, $collection_id); $session_stats = session_stats('muga_session', 'smoothing_type', $values, false, $session_id); tabulate_stats($values, $stats, $session_stats); ?> </div> --> <?php echo '<h2 class="sqa">[ <A href="../checked_in.php?session_code=' . session_code() . '">Exit</a> ]</h2>'; ?> </body> </html>