Index: trunk/www/dch/download.php
===================================================================
--- trunk/www/dch/download.php	(revision 19060)
+++ trunk/www/dch/download.php	(revision 19097)
@@ -35,7 +35,7 @@
 
 $times=array(
-      "timestamp"   => "timestamp",
-      "unix"   => "unixtime",
-      "mjd"   => "MJD",
+      "timestamp"   => "timestamp [YYYY-MM-DD HH:MM:SS]",
+      "unix"   => "unix-timestamp [seconds]",
+      "mjd"   => "modified julian date [days]",
       );
 
@@ -103,56 +103,65 @@
 // get/define initial values
 
-if (!empty($_GET["dch"]))
-    $dch=$_GET["dch"];
+if (!empty($_POST["start"]))
+    $start=$_POST["start"];
+
+if (!empty($_POST["stop"]))
+    $stop=$_POST["stop"];
+
+if (!empty($_POST["dch"]))
+    $dch=$_POST["dch"];
 else
     $dch="novalue";
 
-if (!empty($_GET["dust"]))
-    $dust=$_GET["dust"];
+if (!empty($_POST["dust"]))
+    $dust=$_POST["dust"];
 else
     $dust="novalue";
 
 if (!empty($_GET["expert"]))
-    $expert=$_GET["expert"];
+    $_POST["expert"]=$_GET["expert"];
+
+if (!empty($_POST["expert"]))
+    $expert=$_POST["expert"];
 else
     $expert="no";
 
-if (!empty($_GET["email"]))
-    $email=$_GET["email"];
+if (!empty($_POST["email"]))
+    $email=$_POST["email"];
 else
     $email="";
 
-if (!empty($_GET["light"]))
-    $light=$_GET["light"];
+if (!empty($_POST["light"]))
+    $light=$_POST["light"];
 else
     $light="novalue";
 
-if (!empty($_GET["source"]))
-    $source=$_GET["source"];
+if (!empty($_POST["source"]))
+    $source=$_POST["source"];
 else
     $source=-1;
 
-if (!empty($_GET["timebin"]))
-    $timebin=$_GET["timebin"];
+if (!empty($_POST["timebin"]))
+    $timebin=$_POST["timebin"];
 else
     $timebin="novalue";
 
-if (!empty($_GET["time"]))
-    $time=$_GET["time"];
+if (!empty($_POST["time"]))
+    $time=$_POST["time"];
 else
     $time="novalue";
 
-if (!empty($_GET["table"]))
-    $table=$_GET["table"];
+if (!empty($_POST["table"]))
+    $table=$_POST["table"];
 else
     $table="AnalysisResultsRunLP";
 
-if (!empty($_GET["th"]))
-    $th=$_GET["th"];
+if (!empty($_POST["th"]))
+    $th=$_POST["th"];
 else
     $th="novalue";
 
-if (!empty($_GET["zd"]))
-    $zd=$_GET["zd"];
+if (!empty($_POST["zd"]))
+    $zd=$_POST["zd"];
 else
     $zd="novalue";
@@ -180,7 +189,7 @@
 else
 {
-    echo "<b>Using data from the FACT Quick Look Analysis, you agree to cite the ";
-    echo "<a target='_blank' href='http://iopscience.iop.org/1748-0221/8/06/P06008'>FACT design paper</a>\n ";
-    echo "and the <a target='_blank' href='https://fact-project.org/monitoring'>quick look analysis</a>.</b>\n";
+    echo "<b>Using data from the FACT Quick Look Analysis, you agree to cite the FACT design paper (H. Anderhub et al. JINST 8 P6008) ";
+//    echo "<a target='_blank' href='http://iopscience.iop.org/1748-0221/8/06/P06008'>FACT design paper</a>\n ";
+    echo "and the quick look analysis (https://fact-project.org/monitoring).</b>\n";
     echo "<br><br>\n \n ";
     echo "<u>References:</u>\n";
@@ -201,7 +210,7 @@
 
 //echo "<hr>\n";
-echo "<form name='formular' action='download.php' METHOD='GET'>\n";
-
-//$query="SELECT fSourceKey, fSourceName, (SELECT COUNT(*) FROM ".$_GET["table"]." LEFT JOIN RunInfo USING(fNight, fRunID) WHERE fRunTypeKey=1 AND RunInfo.fSourceKey=Source.fSourceKey) AS num FROM Source WHERE fSourceTypeKey=1";
+echo "<form name='formular' action='download.php' METHOD='POST'>\n";
+
+//$query="SELECT fSourceKey, fSourceName, (SELECT COUNT(*) FROM ".$_POST["table"]." LEFT JOIN RunInfo USING(fNight, fRunID) WHERE fRunTypeKey=1 AND RunInfo.fSourceKey=Source.fSourceKey) AS num FROM Source WHERE fSourceTypeKey=1";
 $query="SELECT fSourceKey, fSourceName, COUNT(*) AS num FROM RunInfo LEFT JOIN Source USING(fSourceKey) WHERE fSourceTypeKey=1 AND fRunTypeKey=1 GROUP BY fSourceKey ORDER BY num DESC";
 //echo $query."<br>";
@@ -213,5 +222,5 @@
 mysql_free_result($result);
 
-//$query="SELECT Min(fNight), Max(fNight) FROM ".$_GET["table"];
+//$query="SELECT Min(fNight), Max(fNight) FROM ".$_POST["table"];
 $query="SELECT Min(fNight), Max(fNight) FROM RunInfo";
 //echo $query."<br>";
@@ -239,6 +248,9 @@
     print_popup("Please provide an email address.");
 
-
-if (strpos($email, "@")!= false && $source>0)
+if (empty($_POST["emailcopy"]))
+    print_popup("Please agree that a copy of the email is stored.");
+
+
+if (strpos($email, "@")!= false && $source>0 && !empty($_POST["emailcopy"]))
 {
     //echo "<h2>Sending data...</h2>\n";
@@ -249,7 +261,28 @@
     $sent=shell_exec("/users/fact/SW.automatic.processing/DataCheck/Tools/get_data.sh ".$start." ".$stop." ".$source." ".$timebin." ".$email." ".$table." ".$time." ".$expert." ".$dch." ".$zd." ".$th." ".$light." ".$dust);
     echo $sent;
-    // use other return information
-}
-
+    if (!empty($_POST["newsletter"]))
+    {
+        $query_interested="SELECT * FROM memberlist.interested WHERE email='".$email."'";
+        $result_interested=mysql_query($query_interested);
+        //echo "num rows: ".mysql_num_rows($result_interested)."<br>\n";
+        //while ($row = mysql_fetch_row($result_interested))
+        //    echo $row[0]." ".$row[1]." ".$row[2]." ".$row[3]."<br>\n";
+        if (mysql_num_rows($result_interested)>0)
+            $query_interested="UPDATE ";
+        else
+            $query_interested="INSERT ";
+        $query_interested.=" memberlist.interested SET date=NOW(), email='".$email."'";
+        if (mysql_num_rows($result_interested)>0)
+            $query_interested.=" WHERE email='".$email."'";
+        //echo $query_interested;
+        mysql_free_result($result_interested);
+        $result_interested=mysql_query($query_interested);
+        if ($maintenance)
+            echo "num affected rows: ".mysql_affected_rows()."<br>\n";
+    }
+}
+
+//#DFE6FA #CDD7F4
+echo "<br>\n<div style='background-color: #DFE6FA; padding-left: 20px; padding-right: 20px; padding-top: 1px; padding-bottom: 10px; border: 3px solid #394979; border-radius: 20px'>\n";
 echo "<h2>Select here the settings for your data sample:</h2>\n";
 
@@ -267,5 +300,5 @@
         printf("<option value='%s'>%s</option>\n", $key, $sourcename);
 }
-echo "</select>\n";
+echo "</select><sup>*</sup>\n";
 
 // Time Format
@@ -282,5 +315,5 @@
         printf("<option value='%s'>%s</option>\n", $key, $name);
 }
-echo "</select>\n ";
+echo "</select><sup>*</sup>\n ";
 
 // Binning
@@ -299,5 +332,5 @@
         printf("<option value='%s'>%s</option>\n", $key, $name);
 }
-echo "</select>\n";
+echo "</select><sup>*</sup>\n";
 echo "<br>\n";
 
@@ -404,12 +437,25 @@
 
 echo "Provide your email address to receive the data: \n";
-printf("<input name='email' type='text' size='20' maxlength='50' value='%s'>\n<br>\n", $email);
-
-echo "Clicking on the button, you agree to the data usage policy: \n";
-echo "<input class='Width' type='button' value='Send data by Email' onClick='submit()'><br>\n";
-
+printf("<input name='email' type='text' size='20' maxlength='50' value='%s'><sup>*</sup>\n<br>\n", $email);
+
+if (empty($_POST["emailcopy"]))
+    echo "<input type='checkbox' name='emailcopy'><sup>*</sup> I agree that a copy of the email is stored for the statistical evaluation of data requests.<br>\n";
+else
+    echo "<input type='checkbox' name='emailcopy' checked><sup>*</sup> I agree that a copy of the email is stored for the statistical evaluation of data requests.<br>\n";
+if (empty($_POST["newsletter"]))
+    echo "<input type='checkbox' name='newsletter'> I would like to receive updates on the data and agree that my email address is stored for this purpose.<br><br>\n";
+else
+    echo "<input type='checkbox' name='newsletter' checked> I would like to receive updates on the data and agree that my email address is stored for this purpose.<br><br>\n";
+
+echo "Clicking on the button, you agree to the data usage policy: <br><br>\n";
+//echo "Clicking on the button, you agree to the data usage policy and that a copy of my email is stored: <br><br>\n";
+echo "<input type='button' style='width: 250px; height: 40px; font-size: 22px; ' value='Send data by Email' onClick='submit()'><br>\n";
+//border: 3px solid #394979; border-radius: 10px
+echo "<sup>*</sup> required<br>\n";
 
 
 echo "</form>\n";
+echo "</div>\n";
+//echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* required<br>\n";
 
 echo "<h2>Remarks:</h2> ";
@@ -419,5 +465,5 @@
 {
     echo "<ul>\n";
-    echo "<li>The correction formula to correct the excess rate for the effects of zd and threshold are not yet final.</li>\n";
+    echo "<li>The correction formula to correct the excess rate for the effects of zd and threshold is not yet final.</li>\n";
     echo "<li>The CU conversion is currently only valid for QLA and until summer 2016.</li>\n";
     echo "<li>The data quality selection based on the artificial trigger rate R750 might not work for all data (effect of lidar).</li>\n";
@@ -450,5 +496,5 @@
 
 echo "<h2>Contact</h2>";
-echo "Daniela Dorner <i>dorner&lt;at&gt;astro.uni-wuerzburg.de</i><br>";
+echo "<i>qla&lt;at&gt;fact-project.org</i><br>";
 //echo "You acknowledge these regulations by clicking on the 'Show' button.</b></big> <br><br><br>";
 
