\n"; echo "

Flare Alerts

\n"; echo "
\n"; echo "

Acknowledge Alerts

\n"; if (!empty($_GET["date"])) { $today=$_GET["date"]; } else { if (date("H")>18) $today=date("Ymd", mktime(0,0,0,date("m"), date("d"), date("Y"))); else $today=date("Ymd",strtotime(date("Y-m-d", mktime(0,0,0,date("m"), date("d"), date("Y")))." -1 day")); } if (!empty($_GET["date2"])) { $today2=$_GET["date2"]; } else { $today2=date("Ymd", mktime(0,0,0,date("m"), date("d"), date("Y"))); } if (!empty($_GET["trigger"])) $trigger=$_GET["trigger"]; else $trigger="New"; if (!empty($_GET["type"])) $type=$_GET["type"]; else $type=0; $year=substr($today,0,4); $month=substr($today,4,2); $day=substr($today,6,2); echo "
\n"; //echo "\n"; echo "

\n"; echo "User Name:
\n"; echo "Password:
\n"; echo "

\n"; //echo "\n"; echo "\n"; echo "\n"; //echo "---".$_SERVER[REQUEST_URI]."---"; echo "
\n"; echo "
\n"; echo "

Display Alerts

\n"; echo "
\n"; echo "

\n"; echo "Date/Start: \n"; echo "Stop:
\n"; echo "Trigger:\n"; if ($trigger=="All") { echo " \n"; echo " \n"; } else { echo " \n"; echo " \n"; } echo "           Type:
\n"; echo "

\n"; echo "\n"; echo ""; echo "
\n"; echo "
\n"; echo "

".$trigger." alert(s) from ".$today." to ".$today2.":

"; if($_SERVER["HTTPS"] != "on") { header("Location: https://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]); exit(); } include('/home/fact/php_credentials/factweb.php'); $db = new PDO( 'mysql:host='.$host.';dbname=FlareAlerts;charset=utf8mb4', $user, $pass); // table with alert from table FlareAlerts.FlareTriggers echo "\n"; $first_row = 0; $colnames = ""; $query="SELECT CONCAT(fTriggerKey, '[', fTriggerType, ']') AS 'Trigger[Type]', if (isnull(fName), fSourceName, fName) AS 'Source', "; $query.="fPacketTypeKey AS 'Packet', CONCAT(Round(fRa,1), '/', Round(fDec,1), '/', Round(fErr,1)) AS 'Ra/Dec/Err', "; $query.="CONCAT(fNight, '_', fRunID) AS 'Run', "; $query.="if (fBinning=-1, 'nightly', CONCAT(fBinning, ' min')) AS 'Binning', "; $query.="fTriggerInserted AS 'Inserted', fTriggerAcknowledged AS 'Acknowledged', "; //$query.="CONCAT('20Min ', "; //$query.="'Nightly') as 'QLA', "; $query.="CONCAT('RunInfo') as 'RunInfo', "; $query.="CONCAT('Summary') AS 'Summary', "; $query.="CONCAT('\n
\n " ."more details\n') AS 'QLA 20min', "; $query.="CONCAT('\n
\n " ."more details\n') AS 'QLA 1night', "; $query.="CONCAT('\n
\n " ."more details\n') AS 'QLA nightly last week' "; $query.="FROM FlareTriggers LEFT JOIN factdata.Source USING (fSourceKey) WHERE fNight BETWEEN ".$today." AND ".$today2; if ($trigger=="New") $query.=" AND ISNULL(fTriggerAcknowledged) "; if ($type) $query.=" AND fTriggerType=".$type; //echo $query; $result = $db->query($query)->fetchAll(PDO::FETCH_ASSOC); foreach($result as $row) { if ($first_row == 0) { $first_row = 1; echo "\n"; $colnames = array_keys($row); foreach($colnames as $colname){ echo "\n"; } echo "\n"; } echo "\n"; foreach ($colnames as $key) { echo "\n"; } echo "\n"; } echo "
".$colname."
".$row[$key]."
\n"; echo "
\n"; echo "

Additional Information

\n"; //obs_summary.php echo "

From Observation-Summary:

\n"; echo "\n"; /* $query="SELECT fSourceKey AS 'Source', fStart AS 'Start of Observation', fData AS 'Settings' FROM factdata.Schedule WHERE "; $query.="fSTART BETWEEN DATE_ADD(DATE_FORMAT(".$today.", '%Y-%m-%d'), INTERVAL +18 HOUR) "; $query.="AND DATE_ADD(DATE_FORMAT(".$today2.", '%Y-%m-%d'), INTERVAL +35 HOUR) "; //$query.="AND fData='nodrs:true,grb:true'"; $query.="AND NOT ISNULL(fData)"; echo "

ToO observations in schedule from ".$today." to ".$today2.":

"; echo "\n"; $first_row = 0; $colnames = ""; $result = $db->query($query)->fetchAll(PDO::FETCH_ASSOC); foreach($result as $row) { if ($first_row == 0) { $first_row = 1; echo "\n"; $colnames = array_keys($row); foreach($colnames as $colname){ echo "\n"; } echo "\n"; } echo "\n"; foreach ($colnames as $key) { echo "\n"; } echo "\n"; } echo "
".$colname."
".$row[$key]."
\n"; */ $query="SELECT fSourceName AS 'Source', fStart AS 'Start of Observation', fData AS 'Settings', fUser AS 'User' "; $query.="FROM factdata.Schedule LEFT JOIN factdata.Source USING (fSourceKey) WHERE "; $query.="fSTART BETWEEN DATE_ADD(DATE_FORMAT(".$today.", '%Y-%m-%d'), INTERVAL +18 HOUR) "; $query.="AND DATE_ADD(DATE_FORMAT(".$today2.", '%Y-%m-%d'), INTERVAL +35 HOUR) "; //$query.="AND fData='nodrs:true,grb:true'"; $query.="AND fMeasurementTypeKey=4"; echo "

Physics observations in schedule from ".$today." to ".$today2.":

"; echo "\n"; $first_row = 0; $colnames = ""; $result = $db->query($query)->fetchAll(PDO::FETCH_ASSOC); foreach($result as $row) { if ($first_row == 0) { $first_row = 1; echo "\n"; $colnames = array_keys($row); foreach($colnames as $colname){ echo "\n"; } echo "\n"; } echo "\n"; foreach ($colnames as $key) { echo "\n"; } echo "\n"; } echo "
".$colname."
".$row[$key]."
\n"; // table with ToOs $query="SELECT fSourceName AS 'Source', CONCAT(ToOs.fRightAscension, '/', Source.fRightAscension) AS 'RA (Satellite/FACT)', "; $query.="CONCAT(ToOs.fDeclination, '/', Source.fDeclination) AS 'Dec (Satellite/FACT)', "; $query.="fLastUpdate AS 'ToO time', fTypeID AS 'PaketType' FROM factdata.ToOs LEFT JOIN factdata.Source USING (fSourceKey) "; $query.="WHERE fLastUpdate BETWEEN DATE_ADD(DATE_FORMAT(".$today.", '%Y-%m-%d'), INTERVAL +18 HOUR) "; $query.="AND DATE_ADD(DATE_FORMAT(".$today2.", '%Y-%m-%d'), INTERVAL +35 HOUR) "; echo "

ToO observations in ToO-table from ".$today." to ".$today2.":

"; echo "\n"; $first_row = 0; $colnames = ""; $result = $db->query($query)->fetchAll(PDO::FETCH_ASSOC); foreach($result as $row) { if ($first_row == 0) { $first_row = 1; echo "\n"; $colnames = array_keys($row); foreach($colnames as $colname){ echo "\n"; } echo "\n"; } echo "\n"; foreach ($colnames as $key) { echo "\n"; } echo "\n"; } echo "
".$colname."
".$row[$key]."
\n\n"; //weather: echo "

Weather Info:

\n"; echo "\n"; //visibility echo "

Visibility:

\n"; echo "\n"; echo "
\n"; echo "

Important Links for Flare Experts

"; echo "
  • All information on flare alerts in FACT
  • \n"; echo "\n"; // to be added // email template // flare summary (copy flare-alert files to gate) // internal qla links: 10 min, 5 min, significance (20 min, nightly) // make links dependent on flare type and if sourcekey is available // link to visibility plot (+ create them) // future dreams // interface to send email directly to both too-lists echo "
    \n"; ?>