Is FACT taking data?
Who is on shift?
(from FACT shift plan
and FACT logbook)
8)
$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"));
}
function send_email($date, $msg_part)
{
//echo "WARNING: no shift crew found -> need to send email.
\n";
$to = "fact-online@lists.phys.ethz.ch";
//$to = "dorner@astro.uni-wuerzburg.de";
$subject = $date.": shifter-info missing";
$msg = "WARNING: No shifter-info available for ".$date."\n\n";
$msg .= $msg_part;
if (!mail($to, $subject, $msg, 'From:observations@fact-project.org'))
echo "Sending warning email failed.
\n\n";
}
echo "
Night: ".$today." (date of sunset)
";
$query="SELECT u FROM calendar.Data WHERE CONCAT(y, LPAD(m+1, 2, 0), LPAD(d,2,0))='".$today."'";
//excluding experts and institutes (apart from 'moon')
$query.=" AND NOT x=1 AND u NOT in('ISDC','ETHZ','TUDO','UNIWUE')";
include ("db.php");
$db_id = mysql_connect($host, $user, $pw);
$result = mysql_query($query);
$numrows=mysql_num_rows($result);
if ($numrows==0)
send_email($today, "Whoever is on shift, please insert your name to the shift calendar!\n");
else
echo " Contact Info Shiftcrew:
\n ";
echo "\n";
while ($row = mysql_fetch_row($result))
{
$query2="SELECT usertitle, fid8 FROM logbook.userfields LEFT JOIN logbook.users ON (uid=ufid) WHERE username='".$row[0]."'";
$result2 = mysql_query($query2);
while ($row2 = mysql_fetch_row($result2))
{
echo "- ".$row2[0].": ".$row2[1]."
\n";
if (!$row2[1])
send_email($today, "Dear ".$row2[0].", please insert your 'Contact Info' in your logbook user-profile!");
}
mysql_free_result($result2);
}
echo "
\n
\n
\n ";
mysql_free_result($result);
echo "Expert-On-Call Contact Info:
\n \n";
$query3="SELECT usertitle, fid8 FROM logbook.userfields LEFT JOIN logbook.users ON (uid=ufid) LEFT JOIN memberlist.experts ON (ufid=userid) WHERE now() < stop and now() > start";
$result3 = mysql_query($query3);
while ($row3 = mysql_fetch_row($result3))
{
echo "- ".$row3[0].": ".$row3[1]."
\n";
}
mysql_free_result($result3);
echo "
\n";
/*
echo "General Contact Info:
\n \n";
$query4="SELECT usertitle, fid8 FROM logbook.userfields LEFT JOIN logbook.users ON (uid=ufid) WHERE username='dorner'";
$result4 = mysql_query($query4);
while ($row4 = mysql_fetch_row($result4))
{
echo "- ".$row4[0].": ".$row4[1]."
\n";
}
mysql_free_result($result4);
echo "
\n";
*/
?>