Ignore:
Timestamp:
07/30/18 19:58:21 (6 years ago)
Author:
Daniela Dorner
Message:
changed from GET to POST and added storing of email-adress
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/dch/download.php

    r19060 r19097  
    3535
    3636$times=array(
    37       "timestamp"   => "timestamp",
    38       "unix"   => "unixtime",
    39       "mjd"   => "MJD",
     37      "timestamp"   => "timestamp [YYYY-MM-DD HH:MM:SS]",
     38      "unix"   => "unix-timestamp [seconds]",
     39      "mjd"   => "modified julian date [days]",
    4040      );
    4141
     
    103103// get/define initial values
    104104
    105 if (!empty($_GET["dch"]))
    106     $dch=$_GET["dch"];
     105if (!empty($_POST["start"]))
     106    $start=$_POST["start"];
     107
     108if (!empty($_POST["stop"]))
     109    $stop=$_POST["stop"];
     110
     111if (!empty($_POST["dch"]))
     112    $dch=$_POST["dch"];
    107113else
    108114    $dch="novalue";
    109115
    110 if (!empty($_GET["dust"]))
    111     $dust=$_GET["dust"];
     116if (!empty($_POST["dust"]))
     117    $dust=$_POST["dust"];
    112118else
    113119    $dust="novalue";
    114120
    115121if (!empty($_GET["expert"]))
    116     $expert=$_GET["expert"];
     122    $_POST["expert"]=$_GET["expert"];
     123
     124if (!empty($_POST["expert"]))
     125    $expert=$_POST["expert"];
    117126else
    118127    $expert="no";
    119128
    120 if (!empty($_GET["email"]))
    121     $email=$_GET["email"];
     129if (!empty($_POST["email"]))
     130    $email=$_POST["email"];
    122131else
    123132    $email="";
    124133
    125 if (!empty($_GET["light"]))
    126     $light=$_GET["light"];
     134if (!empty($_POST["light"]))
     135    $light=$_POST["light"];
    127136else
    128137    $light="novalue";
    129138
    130 if (!empty($_GET["source"]))
    131     $source=$_GET["source"];
     139if (!empty($_POST["source"]))
     140    $source=$_POST["source"];
    132141else
    133142    $source=-1;
    134143
    135 if (!empty($_GET["timebin"]))
    136     $timebin=$_GET["timebin"];
     144if (!empty($_POST["timebin"]))
     145    $timebin=$_POST["timebin"];
    137146else
    138147    $timebin="novalue";
    139148
    140 if (!empty($_GET["time"]))
    141     $time=$_GET["time"];
     149if (!empty($_POST["time"]))
     150    $time=$_POST["time"];
    142151else
    143152    $time="novalue";
    144153
    145 if (!empty($_GET["table"]))
    146     $table=$_GET["table"];
     154if (!empty($_POST["table"]))
     155    $table=$_POST["table"];
    147156else
    148157    $table="AnalysisResultsRunLP";
    149158
    150 if (!empty($_GET["th"]))
    151     $th=$_GET["th"];
     159if (!empty($_POST["th"]))
     160    $th=$_POST["th"];
    152161else
    153162    $th="novalue";
    154163
    155 if (!empty($_GET["zd"]))
    156     $zd=$_GET["zd"];
     164if (!empty($_POST["zd"]))
     165    $zd=$_POST["zd"];
    157166else
    158167    $zd="novalue";
     
    180189else
    181190{
    182     echo "<b>Using data from the FACT Quick Look Analysis, you agree to cite the ";
    183     echo "<a target='_blank' href='http://iopscience.iop.org/1748-0221/8/06/P06008'>FACT design paper</a>\n ";
    184     echo "and the <a target='_blank' href='https://fact-project.org/monitoring'>quick look analysis</a>.</b>\n";
     191    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) ";
     192//    echo "<a target='_blank' href='http://iopscience.iop.org/1748-0221/8/06/P06008'>FACT design paper</a>\n ";
     193    echo "and the quick look analysis (https://fact-project.org/monitoring).</b>\n";
    185194    echo "<br><br>\n \n ";
    186195    echo "<u>References:</u>\n";
     
    201210
    202211//echo "<hr>\n";
    203 echo "<form name='formular' action='download.php' METHOD='GET'>\n";
    204 
    205 //$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";
     212echo "<form name='formular' action='download.php' METHOD='POST'>\n";
     213
     214//$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";
    206215$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";
    207216//echo $query."<br>";
     
    213222mysql_free_result($result);
    214223
    215 //$query="SELECT Min(fNight), Max(fNight) FROM ".$_GET["table"];
     224//$query="SELECT Min(fNight), Max(fNight) FROM ".$_POST["table"];
    216225$query="SELECT Min(fNight), Max(fNight) FROM RunInfo";
    217226//echo $query."<br>";
     
    239248    print_popup("Please provide an email address.");
    240249
    241 
    242 if (strpos($email, "@")!= false && $source>0)
     250if (empty($_POST["emailcopy"]))
     251    print_popup("Please agree that a copy of the email is stored.");
     252
     253
     254if (strpos($email, "@")!= false && $source>0 && !empty($_POST["emailcopy"]))
    243255{
    244256    //echo "<h2>Sending data...</h2>\n";
     
    249261    $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);
    250262    echo $sent;
    251     // use other return information
    252 }
    253 
     263    if (!empty($_POST["newsletter"]))
     264    {
     265        $query_interested="SELECT * FROM memberlist.interested WHERE email='".$email."'";
     266        $result_interested=mysql_query($query_interested);
     267        //echo "num rows: ".mysql_num_rows($result_interested)."<br>\n";
     268        //while ($row = mysql_fetch_row($result_interested))
     269        //    echo $row[0]." ".$row[1]." ".$row[2]." ".$row[3]."<br>\n";
     270        if (mysql_num_rows($result_interested)>0)
     271            $query_interested="UPDATE ";
     272        else
     273            $query_interested="INSERT ";
     274        $query_interested.=" memberlist.interested SET date=NOW(), email='".$email."'";
     275        if (mysql_num_rows($result_interested)>0)
     276            $query_interested.=" WHERE email='".$email."'";
     277        //echo $query_interested;
     278        mysql_free_result($result_interested);
     279        $result_interested=mysql_query($query_interested);
     280        if ($maintenance)
     281            echo "num affected rows: ".mysql_affected_rows()."<br>\n";
     282    }
     283}
     284
     285//#DFE6FA #CDD7F4
     286echo "<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";
    254287echo "<h2>Select here the settings for your data sample:</h2>\n";
    255288
     
    267300        printf("<option value='%s'>%s</option>\n", $key, $sourcename);
    268301}
    269 echo "</select>\n";
     302echo "</select><sup>*</sup>\n";
    270303
    271304// Time Format
     
    282315        printf("<option value='%s'>%s</option>\n", $key, $name);
    283316}
    284 echo "</select>\n ";
     317echo "</select><sup>*</sup>\n ";
    285318
    286319// Binning
     
    299332        printf("<option value='%s'>%s</option>\n", $key, $name);
    300333}
    301 echo "</select>\n";
     334echo "</select><sup>*</sup>\n";
    302335echo "<br>\n";
    303336
     
    404437
    405438echo "Provide your email address to receive the data: \n";
    406 printf("<input name='email' type='text' size='20' maxlength='50' value='%s'>\n<br>\n", $email);
    407 
    408 echo "Clicking on the button, you agree to the data usage policy: \n";
    409 echo "<input class='Width' type='button' value='Send data by Email' onClick='submit()'><br>\n";
    410 
     439printf("<input name='email' type='text' size='20' maxlength='50' value='%s'><sup>*</sup>\n<br>\n", $email);
     440
     441if (empty($_POST["emailcopy"]))
     442    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";
     443else
     444    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";
     445if (empty($_POST["newsletter"]))
     446    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";
     447else
     448    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";
     449
     450echo "Clicking on the button, you agree to the data usage policy: <br><br>\n";
     451//echo "Clicking on the button, you agree to the data usage policy and that a copy of my email is stored: <br><br>\n";
     452echo "<input type='button' style='width: 250px; height: 40px; font-size: 22px; ' value='Send data by Email' onClick='submit()'><br>\n";
     453//border: 3px solid #394979; border-radius: 10px
     454echo "<sup>*</sup> required<br>\n";
    411455
    412456
    413457echo "</form>\n";
     458echo "</div>\n";
     459//echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* required<br>\n";
    414460
    415461echo "<h2>Remarks:</h2> ";
     
    419465{
    420466    echo "<ul>\n";
    421     echo "<li>The correction formula to correct the excess rate for the effects of zd and threshold are not yet final.</li>\n";
     467    echo "<li>The correction formula to correct the excess rate for the effects of zd and threshold is not yet final.</li>\n";
    422468    echo "<li>The CU conversion is currently only valid for QLA and until summer 2016.</li>\n";
    423469    echo "<li>The data quality selection based on the artificial trigger rate R750 might not work for all data (effect of lidar).</li>\n";
     
    450496
    451497echo "<h2>Contact</h2>";
    452 echo "Daniela Dorner <i>dorner&lt;at&gt;astro.uni-wuerzburg.de</i><br>";
     498echo "<i>qla&lt;at&gt;fact-project.org</i><br>";
    453499//echo "You acknowledge these regulations by clicking on the 'Show' button.</b></big> <br><br><br>";
    454500
Note: See TracChangeset for help on using the changeset viewer.