while (!checkdate($mo_from, $d_from, $y_from) and $d_from > 0) { $d_from--; } if (!checkdate($mo_from, $d_from, $y_from)) { sec_error('Start time is invalid, please verify'); exit; } while (!checkdate($mo_to, $d_to, $y_to) and $d_to > 0) { $d_to--; } if (!checkdate($mo_to, $d_to, $y_to)) { sec_error('End time is invalid, please verify'); exit; } if (mktime($h_from, $mi_from, $s_from, $mo_from, $d_from, $y_from) > mktime($h_to, $mi_to, $s_to, $mo_to, $d_to, $y_to)) { sec_error('End date is greater than start date, please verify'); exit; } $from = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $y_from, $mo_from, $d_from, $h_from, $mi_from, $s_from); $to = sprintf("%04d-%02d-%02d %02d:%02d:%02d", $y_to, $mo_to, $d_to, $h_to, $mi_to, $s_to); $query_time = "time_start>='{$from}' AND time_start<='{$to}'"; if ($nar != "") { $query_nar = " OR nar={$nar}"; } $w = $query_time . $query_nar; $s1 = "SELECT * FROM {$cat1} WHERE {$w} ORDER BY time_start;"; $s2 = "SELECT * FROM {$cat2} WHERE {$w} ORDER BY time_start;"; } $error = 0; echo "The VOTable (XML) result file is <a href=\"xml/{$xml1}\"><B>hec1_{$xmldate}.xml</B></a>"; echo "<br>The TXT result file is <a href=\"xml/{$txt1}\"><B>hec1_{$xmldate}.txt</B></a><p>";
<?php # ============================================= # EGSO 2003,2004 - by Max Jurcev # INAF - Trieste Astronomical Observatory # --------------------------------------------- require "sec_global.php"; echo sec_header("EGSO SEC test"); # ============================================= # connect db and perform the query # ============================================= $dbconn = pg_connect("dbname=hec"); if (!$dbconn) { sec_error('Unable to connect to the database'); exit; } $result = pg_exec($dbconn, "SELECT * FROM sgas_event ORDER BY time_start"); if (!$result) { sec_error('Error while reading the database'); exit; } sec_showresult($result); pg_close($dbconn); echo sec_footer();