0) { foreach ($checkgroup as $key => $element) if ($element==-1) $query0 .= $key . " as '" . $alias[$key] . "' " . ", "; //-------------------------------------------------- $query0 .= "SUM(fRunTime)/3600 as '" . $alias["SUM(fRunTime)/3600"] . "', "; //-------------------------------------------------- $query0 .= " SUM(fNumEvents) as '" . $alias["SUM(fNumEvents)"] . "', "; $query0 .= " Min(fZenithDistanceMin) as '" . $alias["Min(fZenithDistanceMin)"] . "', "; $query0 .= " Max(fZenithDistanceMax) as '" . $alias["Max(fZenithDistanceMax)"] . "', "; $query0 .= " COUNT(*) as '# Sequ' "; } else { if ($statusgroups>0) { foreach ($checkstatusgroup as $key => $element) if ($element==-1) $query0 .= " (if(IsNull(" . $key . "), if(isnull(fStartTime), 'not done', if(isnull(fFailedTime),if(isnull(" . $needs[$key] . "),'not done',if(date_sub(Now(),interval 12 hour) < fStartTime,'running','crashed')),if(isnull(" . $needs[$key] . "),'not done','failed'))) ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', "; // $query0 .= " (if(IsNull(" . $key . "), 'not done' ,if(" . $key . "='1970-01-01 00:00:00','dont do','done'))) as '" . $alias[$key] . "', "; $query0 .= " COUNT(*) as '# Sequ'"; } else { $query0 .= " " . $fromtable . ".fSequenceFirst as '" . $alias["fSequenceFirst"] . "' "; if (!empty($_GET["fLinks"])) { $query0 .= ", CONCAT('r' "; // $query0 .= " as " . $alias["fSequenceFirst"]; $query0 .= ", ' cl'"; $query0 .= ", ' c'"; $query0 .= ", ' sl'"; $query0 .= ", ' s'"; $query0 .= ", ' ', 'f ' "; $query0 .= ", ' i') "; $query0 .= " as 'Links'"; } foreach ($_GET as $key => $element) if ($_GET[$key]=="On") if ($key!="fLinks" && $key!="fOff" && $key!="fOnlyOff") if (empty($checkwhere[$key]) || $checkwhere[$key]==0) $query0 .= ", " . $key . " as '" . $alias[$key] . "' "; } } $query0 .= " FROM " . $fromtable; $query0 .= " LEFT JOIN SequenceProcessStatus ON Sequences.fSequenceFirst=SequenceProcessStatus.fSequenceFirst "; $query0 .= " LEFT JOIN Calibration ON Sequences.fSequenceFirst=Calibration.fSequenceFirst "; $query0 .= " LEFT JOIN Star ON Sequences.fSequenceFirst=Star.fSequenceFirst "; foreach ($_GET as $key => $element) if (($_GET[$key]=="On" || $groups>0))// && !empty(GetJoin($fromtable,$key))) $query0 .= GetJoin($fromtable,$key); if ($_GET["fTest"]!="On") { if ($_GET["fSourceName"]!="On") $query0 .= " LEFT JOIN Source ON Sequences.fSourceKEY=Source.fSourceKEY "; $query0 .= " WHERE fTest='no'"; } if ($_GET["fOff"]=="Off") { if (strpos($query0, " WHERE ")==FALSE) $query0 .= " WHERE "; else $query0 .= " AND "; $query0 .= " NOT (fSourceName like '%Off%')"; } if ($_GET["fOnlyOff"]=="On") { if (strpos($query0, " WHERE ")==FALSE) $query0 .= " WHERE "; else $query0 .= " AND "; $query0 .= " fSourceName like '%Off%'"; } foreach ($checkwhere as $key => $element) { if (empty($element) || $element<=0) continue; if (strpos($query0, " WHERE ")==FALSE) $query0 .= " WHERE "; else if ($element!=-1) if (strrpos($query0, " AND ")!=strlen($query0)-5) $query0 .= " AND "; if ($element!=-1) $query0 .= GetCheck($fromtable, $key) . "=" . $element; } if (strpos($query0, " WHERE ")==FALSE) $query0 .= " WHERE "; else $query0 .= " AND "; $query0 .= StatusQuery("fSequenceFileWritten", $needs); $query0 .= StatusQuery("fAllFilesAvail", $needs); $query0 .= StatusQuery("fCallisto", $needs); $query0 .= StatusQuery("fFillCallisto", $needs); $query0 .= StatusQuery("fStar", $needs); $query0 .= StatusQuery("fFillStar", $needs); if (!empty($_GET["fRunMin"]) && !empty($_GET["fRunMax"])) $query0 .= "Sequences.fSequenceFirst BETWEEN " . $_GET["fRunMin"] . " AND " . $_GET["fRunMax"] . " "; else $query0 = substr($query0, 0, -4); if (!empty($_GET["fZDMin"]) && !empty($_GET["fZDMax"])) $query0 .= "AND (fZenithDistanceMin > " . $_GET["fZDMin"] . " AND fZenithDistanceMax < " . $_GET["fZDMax"] . ") "; if (!empty($_GET["fSourceN"])) $query0 .= " AND fSourceName REGEXP \"^" . $_GET["fSourceN"] . "\" "; if (!empty($_GET["fStartDate"])) { if (strpos(strrev($query0), " DNA ")!=0 || !strpos(strrev($query0), " DNA ")) $query0 .= " AND "; $startdate=substr($_GET["fStartDate"], 0, 10); if ($startdate=="0000-00-00") $query0 .=" fRunStart >= '" . $startdate . " 00:00:00' "; else $query0 .= " fRunStart >= ADDDATE('" . $startdate . " 13:00:00', INTERVAL -1 DAY) "; } if (!empty($_GET["fStopDate"])) { if (strpos(strrev($query0), " DNA ")!=0 || !strpos(strrev($query0), " DNA ")) $query0 .= " AND "; $stopdate=substr($_GET["fStopDate"], 0, 10); $query0 .= " fRunStart < '" . $stopdate . " 13:00:00' "; } if (!empty($_GET["fStarStart"])) { if (strpos(strrev($query0), " DNA ")!=0 || !strpos(strrev($query0), " DNA ")) $query0 .= " AND "; $starstart=substr($_GET["fStarStart"], 0, 10); $query0 .=" fStar >= '" . $starstart . " 00:00:00' "; } if (!empty($_GET["fStarStop"])) { if (strpos(strrev($query0), " DNA ")!=0 || !strpos(strrev($query0), " DNA ")) $query0 .= " AND "; $starstop=substr($_GET["fStarStop"], 0, 10); $query0 .= " fStar < '" . $starstop . " 23:59:59' "; } if ($groups>0) { $query0 .= " GROUP BY "; $num = $groups; foreach ($checkgroup as $key => $element) if ($element==-1) { $query0 .= GetCheck($fromtable,$key); if ($num-->1) $query0 .= ", "; } } if ($statusgroups>0) { $query0 .= " GROUP BY "; $num = $statusgroups; foreach ($checkstatusgroup as $key => $element) if ($element==-1) { $query0 .= $alias[$key]; if ($num-->1) $query0 .= ", "; } } if (!empty($_GET["fSortBy"])) { $val=substr($_GET["fSortBy"], 0, -1); $query0 .= " ORDER BY " . GetTable($fromtable,$val) . " "; if (substr($_GET["fSortBy"], -1)=="-") $query0 .= "DESC"; } if (empty($_GET["fSortBy"]) && $groups==0 && $statusgroups==0) $query0 .= "ORDER BY Sequences.fSequenceFirst DESC "; if (empty($_GET["fNumStart"])) $_GET["fNumStart"]=0; if (empty($_GET["fSendTxt"])) $query0 .= " LIMIT " . $_GET["fNumStart"] . ", " . $_GET["fNumResults"]; return $query0; } function InitGet($_GET) { // Find out whether it is the first call to the php script $first = empty($_GET["fRunMin"]) && empty($_GET["fRunMax"]); if (empty($_GET["fNumResults"])) $_GET["fNumResults"]="100"; if (empty($_GET["fRunStart"])) $_GET["fRunStart"]=$first?"On":""; if (empty($_GET["fRunTime/60"])) $_GET["fRunTime/60"]=$first?"On":""; if (empty($_GET["fZenithDistanceMin"])) $_GET["fZenithDistanceMin"]=$first?"On":""; if (empty($_GET["fZenithDistanceMax"])) $_GET["fZenithDistanceMax"]=$first?"On":""; if (empty($_GET["fSourceName"])) $_GET["fSourceName"]=$first?"On":""; if (empty($_GET["fObservationModeName"])) $_GET["fObservationModeName"]=$first?"On":""; if (empty($_GET["fUnsuitableInner"])) $_GET["fUnsuitableInner"]=$first?"On":""; if (empty($_GET["fUnsInLimit1"])) $_GET["fUnsInLimit1"]=$first?"12":""; if (empty($_GET["fUnsInLimit2"])) $_GET["fUnsInLimit2"]=$first?"20":""; // if (empty($_GET["fRunTimeLimit1"])) // $_GET["fRunTimeLimit1"]=$first?"5":""; // if (empty($_GET["fRunTimeLimit2"])) // $_GET["fRunTimeLimit2"]=$first?"2":""; if (empty($_GET["fPSFLimitRms"])) $_GET["fPSFLimitRms"]=$first?"1.0":""; if (empty($_GET["fPedRmsInLimitRms"])) $_GET["fPedRmsInLimitRms"]=$first?"0.08":""; if (empty($_GET["fNumIslLimitMean"])) $_GET["fNumIslLimitMean"]=$first?"1.230":""; if (empty($_GET["fNumIslLimitRms"])) $_GET["fNumIslLimitRms"]=$first?"0.013":""; if (empty($_GET["fMuonCalLimitMean"])) $_GET["fMuonCalLimitMean"]=$first?"100.0":""; if (empty($_GET["fMuonCalLimitRms"])) $_GET["fMuonCalLimitRms"]=$first?"1.6":""; if (empty($_GET["fRelTimeMaxLimit1"])) $_GET["fRelTimeMaxLimit1"]=$first?"1.0":""; if (empty($_GET["fRelTimeMaxLimit2"])) $_GET["fRelTimeMaxLimit2"]=$first?"1.02":""; if (empty($_GET["fRelTimeMinLimit1"])) $_GET["fRelTimeMinLimit1"]=$first?"0.97":""; if (empty($_GET["fRelTimeMinLimit2"])) $_GET["fRelTimeMinLimit2"]=$first?"0.93":""; if (empty($_GET["fIMCLimit1"])) $_GET["fIMCLimit1"]=$first?"00":""; if (empty($_GET["fIsoInLimit1"])) $_GET["fIsoInLimit1"]=$first?"00":""; if (empty($_GET["fInhomLimitMean"])) $_GET["fInhomLimitMean"]=$first?"10":""; if (empty($_GET["fInhomLimitRms"])) $_GET["fInhomLimitRms"]=$first?"3":""; if (empty($_GET["fImgRateLimitMean"])) $_GET["fImgRateLimitMean"]=$first?"180":""; if (empty($_GET["fImgRateLimitRms"])) $_GET["fImgRateLimitRms"]=$first?"30":""; if (empty($_GET["fMuonRateLimitMean"])) $_GET["fMuonRateLimitMean"]=$first?"1":""; if (empty($_GET["fMuonRateLimitRms"])) $_GET["fMuonRateLimitRms"]=$first?"0.1":""; if (empty($_GET["fMuonNumLimit1"])) $_GET["fMuonNumLimit1"]=$first?"180":""; if (empty($_GET["fMuonNumLimit2"])) $_GET["fMuonNumLimit2"]=$first?"120":""; if (empty($_GET["fPulsePosLimit1"])) $_GET["fPulsePosLimit1"]=$first?"3.5":""; if (empty($_GET["fPulsePosLimit2"])) $_GET["fPulsePosLimit2"]=$first?"2.5":""; if (empty($_GET["fNumStarsLimit1"])) $_GET["fNumStarsLimit1"]=$first?"30":""; if (empty($_GET["fNumStarsLimit2"])) $_GET["fNumStarsLimit2"]=$first?"20":""; if (empty($_GET["fNumStarsCorLimit1"])) $_GET["fNumStarsCorLimit1"]=$first?"10":""; if (empty($_GET["fNumStarsCorLimit2"])) $_GET["fNumStarsCorLimit2"]=$first?"5":""; if (empty($_GET["fUnreliableInner"])) $_GET["fUnreliableInner"]=$first?"On":""; if (empty($_GET["fIsolatedInner"])) $_GET["fIsolatedInner"]=$first?"On":""; if (empty($_GET["fIsolatedMaxCluster"])) $_GET["fIsolatedMaxCluster"]=$first?"On":""; // if (empty($_GET["fArrTimeMeanInner"])) // $_GET["fArrTimeMeanInner"]=$first?"On":""; if (empty($_GET["fArrTimeRmsInner"])) $_GET["fArrTimeRmsInner"]=$first?"On":""; if (empty($_GET["fMeanPedRmsInner"])) $_GET["fMeanPedRmsInner"]=$first?"On":""; if (empty($_GET["fPulsePosMean"])) $_GET["fPulsePosMean"]=$first?"On":""; if (empty($_GET["fConvFactorInner"])) $_GET["fConvFactorInner"]=$first?"On":""; if (empty($_GET["fInhomogeneity"])) $_GET["fInhomogeneity"]=$first?"On":""; if (empty($_GET["fPSF"])) $_GET["fPSF"]=$first?"On":""; if (empty($_GET["fMuonNumber"])) $_GET["fMuonNumber"]=$first?"On":""; if (empty($_GET["fEffOnTime/fRunTime"])) $_GET["fEffOnTime/fRunTime"]=$first?"On":""; if (empty($_GET["fMuonRate"])) $_GET["fMuonRate"]=$first?"On":""; if (empty($_GET["fDataRate"])) $_GET["fDataRate"]=$first?"On":""; // if (empty($_GET["fMaxHumidity"])) // $_GET["fMaxHumidity"]=$first?"On":""; if (empty($_GET["fBrightnessMed"])) $_GET["fBrightnessMed"]=$first?"On":""; if (empty($_GET["fNumStarsMed"])) $_GET["fNumStarsMed"]=$first?"On":""; if (empty($_GET["fNumStarsCorMed"])) $_GET["fNumStarsCorMed"]=$first?"On":""; if (empty($_GET["fOff"])) $_GET["fOff"]=$first?"On":""; if (empty($_GET["fLinks"])) $_GET["fLinks"]=$first?"On":""; if (empty($_GET["fOnlyOff"])) $_GET["fOnlyOff"]=$first?"Off":""; InitSequInfo($_GET); } function PrintForm($_GET, $host, $user, $pw, $db, $limitsmean, $limitsmin, $limitsmax, $alias) { printf("
\n"); printf("
\n"); printf("\n"); printf("- Menu\n"); printf("  + SequInfo \n"); printf("  + StatusInfo \n"); printf("  + CalInfo \n"); printf("  + StarInfo \n"); printf("  + Ranges \n"); printf("  + Limits \n"); printf("
"); PrintSequInfo2Menu($host,$user,$pw,$db); PrintSequInfoMenu(); PrintSequStatMenu(); PrintFailMenu(); PrintCalMenu(); PrintStarMenu(); PrintLimitsMenu($limitsmean, $limitsmin, $limitsmax, $alias, ""); printf(" "); printf("
"); printf("

\n"); PrintNumResPullDown(); ini_set("mysql.trace_mode", "Off"); ini_set("display_errors", "Off"); PrintButtons("builddatasets.php"); $sequon=" "; $sequoff=" "; foreach($_POST as $key => $val) if ($val=="On") { if (ereg("ON$", $key)) $sequon.=str_replace("ON", " ", $key); if (ereg("Off$", $key)) $sequoff.=str_replace("Off", " ", $key); } printf("\n", $sequon); printf("\n", $sequoff); printf("\n", $_POST["name"]); printf("\n", $_POST["comment"]); printf("\n", $_POST["fObservationModeKEY"]); printf("

\n"); printf("
\n"); printf("\n"); printf("\n"); printf("\n"); printf("\n"); } function PrintPage($html, $host, $user, $pw, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limitsmean, $limitsmin, $limitsmax, $needs) { $db_id = mysql_pconnect($host, $user, $pw); if ($db_id==FALSE) { printf("mysql_connect returned the following error: %s\n", mysql_error()); die(""); } mysql_select_db($db); $query0 = CreateQuery($_GET, $alias, $checkwhere, $checkgroup, $checkstatusgroup, $needs); $result0 = mysql_query($query0, $db_id); if ($result0) { if ($html=="1" || $html=="2") { PrintMagicTable($result0, $alias, $rightalign, $limitsmean, $limitsmin, $limitsmax, "yes", $_GET); foreach($_POST as $key => $val) if ($val=="On") { if (ereg("ON$", $key)) $sequon.=str_replace("ON", " ", $key); if (ereg("Off$", $key)) $sequoff.=str_replace("Off", " ", $key); } printf("

\n"); printf("\n"); $on=str_replace(" ", ",", trim($sequon)); $off=str_replace(" ", ",", trim($sequoff)); $values=array("Sum(fRunTime)/60" => $runtime, "Min(fRunTime)/60" => $runtimemin, "Max(fUnsuitableInner)" => $unsuitablemax, "Max(fUnreliableInner)" => $unreliablemax, "Max(fIsolatedInner)" => $isolatedmax, "Max(fIsolatedMaxCluster)" => $imcmax, "Max(fArrTimeMeanInner)" => $arrtimemax, "Min(fArrTimeMeanInner)" => $arrtimemin, "Max(fArrTimeRmsInner)" => $arrtimermsmax, "Avg(fMeanPedRmsInner)" => $pedrmsmean, "Std(fMeanPedRmsInner)" => $pedrmsrms, "Min(fMeanPedRmsInner)" => $pedrmsmin, "Max(fMeanPedRmsInner)" => $pedrmsmax, "Min(fPulsePosMean)" => $pulseposmin, "Max(fPulsePosMean)" => $pulseposmax, "Max(fPulsePosRms)" => $pulseposrmsmax, "Max(fMaxHumidity)" => $hummax, "Max(fInhomogeneity)" => $inhommax, "Avg(fInhomogeneity)" => $inhommean, "Std(fInhomogeneity)" => $inhomrms, "Min(fMeanNumberIslands)" => $numislmin, "Max(fMeanNumberIslands)" => $numislmax, "Min(fDataRate)" => $clratemin, "Max(fDataRate)" => $clratemax, "Min(fMuonRate)" => $muonratemin, "Max(fMuonRate)" => $muonratemax, "Min(fMuonNumber)" => $muonnumbermin, "Avg(fPSF)" => $psfmean, "Std(fPSF)" => $psfrms, "Min(fPSF)" => $psfmin, "Max(fPSF)" => $psfmax, "Min(fEffOnTime/fRunTime)" => $relontimemin, "Max(fEffOnTime/fRunTime)" => $relontimemax, "Min(fBrightnessMed)" => $brightmin, "Max(fBrightnessMed)" => $brightmax, "Min(fNumStarsMed)" => $idstarsmin, "Max(fNumStarsMed)" => $idstarsmax, "Min(fNumStarsCorMed)" => $corstarsmin, "Max(fNumStarsCorMed)" => $corstarsmax, "Min(fZenithDistanceMin)" => $zdmin, "Max(fZenithDistanceMax)" => $zdmax, "Min(fRunStart)" => $starttime, "Max(fRunStop)" => $stoptime, ); //get runtimes of dataset function GetSequenceValues($db_id, $sequences, $txt,&$values) { $query="SELECT COUNT(*) "; foreach($values as $name => $varname) $query.=", " . $name; $query.=" FROM Sequences "; $query.=" LEFT JOIN Calibration ON Calibration.fSequenceFirst=Sequences.fSequenceFirst "; $query.=" LEFT JOIN Star ON Star.fSequenceFirst=Sequences.fSequenceFirst "; $query.=" WHERE Sequences.fSequenceFirst IN (" . $sequences . ")"; $result = mysql_query($query, $db_id); $row = mysql_fetch_assoc($result); foreach($values as $name => $varname) $values[$name][$txt]=$row[$name]; mysql_free_result($result); } //get next dataset# $query="SELECT fDataSetNumber+1 FROM DataSets ORDER BY fDataSetNumber DESC LIMIT 0,1"; $result = mysql_query($query, $db_id); $row = mysql_fetch_assoc($result); $dataset=$row["fDataSetNumber+1"]; if (empty($dataset)) $dataset=1; mysql_free_result($result); //get sourcenames function GetSources($db_id, $sequences) { $query="SELECT fSourceName FROM Source LEFT JOIN Sequences ON Sequences.fSourceKEY=Source.fSourceKEY "; $query.="WHERE fSequenceFirst IN (" . $sequences . ") GROUP BY fSourceName"; $result = mysql_query($query, $db_id); while ($row = mysql_fetch_assoc($result)) $sources.=" " . $row["fSourceName"]; mysql_free_result($result); return $sources; } $sourceson=GetSources($db_id, $on); $sourcesoff=GetSources($db_id, $off); //get sourcename for dataset $son=str_replace(" ", "','", trim($sourceson)); $query="SELECT fRealSourceKEY, Count(*) FROM Source where fSourcename IN ('" . $son . "') GROUP BY fRealSourceKEY"; // printf("q: %s
", $query); $result = mysql_query($query, $db_id); $row = mysql_fetch_assoc($result); $numsources=$row["Count(*)"]; $numrealkeys=mysql_num_rows($result); $realsourcekey=$row["fRealSourceKEY"]; mysql_free_result($result); // printf("found %s sources with real sourcekey %s", $numsources, $realsourcekey); // printf("found %s keys", $numrealkeys); $runtimelimit=5; $unsuitablemaxlimit=15; $isolatedlimit=0; $imclimit=0; $pedrmsrms=0.09; $scalelimit=1.3; $inhomlimit=13; $numstarslimit=20; $numstarscorlimit=10; $numerr=0; if (!empty($on)) { $color=array("INFO" => "#000000", "WARN" => "#FF9900", "ERROR" => "#FF0000"); printf("
    \n"); $vals=array("on", "off"); foreach($vals as $num => $val) { if (empty(${$val})) continue; GetSequenceValues($db_id, ${$val}, $val, $values); if ($values["Min(fNumStarsCorMed)"][$val]<$numstarscorlimit) printf("
  • %s: one of your %s-sequences has less than %s identified stars (%s)
  • ", $color["WARN"], "WARN", $val, $numstarscorlimit, $values["Min(fNumStarsCorMed)"][$val]); if ($values["Min(fNumStarsMed)"][$val]<$numstarslimit) printf("
  • %s: one of your %s-sequences has less than %s identified stars (%s)
  • ", $color["WARN"], "WARN", $val, $numstarslimit, $values["Min(fNumStarsMed)"][$val]); if ($values["Min(fRunTime)/60"][$val]<$runtimelimit) printf("
  • %s: one of your %s-sequences is shorter than %s min (%s min)
  • ", $color["INFO"], "INFO", $val, $runtimelimit, $values["Min(fRunTime)/60"][$val]); if ($values["Max(fInhomogeneity)"][$val]>$inhomlimit) printf("
  • %s: one of your %s-sequences has an inhomogeneity larger than %s (%s)
  • ", $color["WARN"], "WARN", $val, $inhomlimit, $values["Max(fInhomogeneity)"][$val]); if ($values["Max(fUnsuitableInner)"][$val]>$unsuitablemaxlimit) printf("
  • %s: one of your %s-sequences has more than %s unsuitable inner pixel (%s)
  • ", $color["WARN"], "WARN", $val, $unsuitablemaxlimit, $values["Max(fUnsuitableInner)"][$val]); if ($values["Max(fIsolatedInner)"][$val]>$isolatedlimit) printf("
  • %s: one of your %s-sequences has more than %s isolated inner pixel (%s)
  • ", $color["WARN"], "WARN", $val, $isolatedlimit, $values["Max(fIsolatedInner)"][$val]); if ($values["Max(fIsolatedMaxCluster)"][$val]>$imclimit) printf("
  • %s: one of your %s-sequences has more than %s isolated max cluster (%s)
  • ", $color["WARN"], "WARN", $val, $imclimit, $values["Max(fIsolatedMaxCluster)"][$val]); } if (!empty($on) && $values["Max(fMeanPedRmsInner)"]["on"]>$values["Avg(fMeanPedRmsInner)"]["on"]+$pedrmsrms) printf("
  • %s: one of your on-sequences has a PedRms larger than %s (%s)
  • ", $color["WARN"], "WARN", $values["Avg(fMeanPedRmsInner)"]["on"]+$pedrmsrms, $values["Max(fMeanPedRmsInner)"]["on"]); if (!empty($off) && $values["Max(fMeanPedRmsInner)"]["off"]>$values["Avg(fMeanPedRmsInner)"]["on"]+$pedrmsrms) printf("
  • %s: one of your off-sequences has a PedRms larger than %s (%s)
  • ", $color["WARN"], "WARN", $values["Avg(fMeanPedRmsInner)"]["on"]+$pedrmsrms, $values["Max(fMeanPedRmsInner)"]["off"]); if (!empty($off) && $values["Min(fMeanPedRmsInner)"]["off"]<$values["Avg(fMeanPedRmsInner)"]["on"]-$pedrmsrms) printf("
  • %s: one of your off-sequences has a PedRms smaller than %s (%s)
  • ", $color["WARN"], "WARN", $values["Avg(fMeanPedRmsInner)"]["on"]-$pedrmsrms, $values["Min(fMeanPedRmsInner)"]["off"]); $scale=$values["Sum(fRunTime)/60"]["on"]/$values["Sum(fRunTime)/60"]["off"]; if ($scale > $scalelimit) printf("
  • %s: Your scale factor is larger than %s (%0.2f). Try to find more offdata!", $color["WARN"], "WARN", $scalelimit, $scale); /* if (str_word_count($sourceson) > 1) printf("
  • %s: You have selected more than one (%s) on source", $color["WARN"], "WARN", str_word_count($sourceson)); */ if ($numrealkeys>1) { printf("
  • %s: You have selected more than one (%s) on source", $color["ERROR"], "ERROR", $numrealkeays); $numerr=$numerr+1; } if (empty($realsourcekey)) { printf("
  • %s: The source you selected doesn't have a real sourcekey yet. Please insert fRealSourceKEY in the DB for %s", $color["ERROR"], "ERROR", $sourceson); $numerr=$numerr+1; } if (empty($_POST["fObservationModeKEY"])) { printf("
  • %s: You have to choose an observation mode.", $color["ERROR"], "ERROR"); $numerr=$numerr+1; } if (empty($_POST["name"])) { printf("
  • %s: You have to choose a name.", $color["ERROR"], "ERROR"); $numerr=$numerr+1; } if (empty($_POST["comment"])) { printf("
  • %s: You have to comment your dataset.", $color["ERROR"], "ERROR"); $numerr=$numerr+1; } // printf("
  • "); printf("
\n"); printf("
"); printf("SequencesOn: %s
", $sequon); printf("SequencesOff: %s
", $sequoff); $insquery[0]="INSERT DataSets SET fDataSetNumber=" . $dataset; $insquery[0].=", fComment='" . $_POST["comment"] . "', fObservationModeKEY=" . $_POST["fObservationModeKEY"]; $insquery[0].=", fDataSetName='" . $_POST["name"] . "', fSourceKEY= " . $realsourcekey; $insquery[0].=", fRunStart='" . $values["Min(fRunStart)"]["on"]; $insquery[0].="', fRunStop='" . $values["Max(fRunStop)"]["on"]; $insquery[0].="', fZenithDistanceMin=" . $values["Min(fZenithDistanceMin)"]["on"]; $insquery[0].=", fZenithDistanceMax=" . $values["Max(fZenithDistanceMax)"]["on"]; $insquery[0].=", fRunTime=" . $values["Sum(fRunTime)/60"]["on"]; $insquery[1]="INSERT DataSetProcessStatus SET fDataSetNumber=" . $dataset . ", fDataSetInserted=Now()"; $i=2; foreach(explode(" ", trim($sequon)) as $key => $sequ) { $insquery[$i]="INSERT DataSetSequenceMapping SET fDataSetNumber=" . $dataset; $insquery[$i].=", fSequenceFirst=" . $sequ . ", fOnOff=1"; $i=$i+1; } if (!empty($off)) { foreach(explode(" ", trim($sequoff)) as $key => $sequ) { $insquery[$i]="INSERT DataSetSequenceMapping SET fDataSetNumber=" . $dataset; $insquery[$i].=", fSequenceFirst=" . $sequ . ", fOnOff=2"; $i=$i+1; } } foreach($insquery as $num => $q) { if (!empty($_POST["insert"]) && $numerr==0) { printf("Inserted Query #%s: %s
", $num, $q); $insresult=mysql_query($q); if (mysql_errno()>0) printf("  Errorno: %s
", mysql_errno()); if (mysql_error()!="") printf("  Errormsg: %s
", mysql_error()); if (mysql_info()!="") printf("  Info: %s
", mysql_info()); printf("  Affected Rows: %s
", mysql_affected_rows()); mysql_free_result($insresult); if (mysql_errno()>0) { printf("ERROR => stop inserting"); break; } } } printf("
"); if (empty($_POST["name"]) && !empty($_GET["name"])) $_POST["name"]=$_GET["name"]; if (empty($_POST["comment"]) && !empty($_GET["comment"])) $_POST["comment"]=$_GET["comment"]; if (empty($_POST["fObservationModeKEY"]) && !empty($_GET["obsmode"])) $_POST["fObservationModeKEY"]=$_GET["obsmode"]; printf("Name:  
\n", $_POST["name"]); printf("Comment:  
\n", $_POST["comment"]); $query = "SELECT fObservationModeKEY, fObservationModeName FROM ObservationMode ORDER BY fObservationModeName"; $result = mysql_query($query); if (!$result) printf("-N/A-"); $numrows = mysql_num_rows($result); printf("ObservationMode 
\n"); mysql_free_result($result); printf("Remark: only datasets without errors can be inserted.
"); if ($numerr!=0) printf("Your dataset has %s error(s).
", $numerr); printf("insert\n"); printf(""); printf("", $dataset); printf("", $sequon); if (!empty($sequoff)) printf("", $sequoff); printf("", $scale); printf("", str_word_count($sourceson), $sourceson); printf("", str_word_count($sourcesoff), $sourcesoff); printf("
Dataset
proposed DataSet#: %s
SequencesOn: %s
SequencesOff: %s
Scale: %0.2f
SourcenamesOn[%s]: %s
SourcenamesOff[%s]: %s
\n"); printf("\n"); printf(""); if (!empty($off)) printf("\n"); foreach($values as $name => $varname) { printf("\n", $name); foreach($vals as $num => $val) if (!empty(${$val})) printf("\n", $varname[$val]); printf("\n"); } printf("
ValueOnOff
%s%s
\n"); } printf("
\n"); /* printf("\n"); printf("\n"); foreach($values as $name => $varname) printf("\n", $name); $vals=array("on", "off"); foreach($vals as $num => $val) { GetSequenceValues($db_id, ${$val}, $val, $values); printf("\n"); printf("\n"); foreach($values as $name => $varname) printf("\n", $varname[$val]); } printf("
--%s
On%s
\n"); */ printf("\n"); printf("\n"); printf("\n"); printf("\n"); } else PrintText($result0); mysql_free_result($result0); } mysql_close($db_id); PrintSubmittedQuery($query0, $html, $db, ""); } include ("include.php"); include ("menu.php"); include ("db.php"); include ("magicdefs.php"); ini_set("display_errors", "On"); ini_set("mysql.trace_mode", "On"); $sitepw="\$1\$ml/Gld67\$zOvhC4vFrLCkbAzQs2swo1"; $siteuser="dcdb"; if (!isset($_SERVER['PHP_AUTH_USER']) || $_SERVER['PHP_AUTH_USER']!=$siteuser) { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); echo 'Text to send if user hits Cancel button'; return; } else { // echo "

Hello {$_SERVER['PHP_AUTH_USER']}.

"; // echo "

You entered {$_SERVER['PHP_AUTH_PW']} as your password.

"; // printf("pw: %s", crypt($_SERVER['PHP_AUTH_PW'])); if (crypt($_SERVER['PHP_AUTH_PW'], $sitepw)!=$sitepw || $_SERVER['PHP_AUTH_USER']!=$siteuser) { printf("
pw or user incorrect
"); return; } } if (!empty($_GET["fSendTxt"])) { header("Content-type: application/octet"); header("Content-Disposition: attachment; filename=query-result.txt"); PrintPage("0", $host, $user, $pw, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limitsmean, $limitsmin, $limitsmax, $needs); } else { echo (file_get_contents("index-header.html")); $environment = sizeof($_GET); InitGet($_GET); if (empty($_GET["fPrintTable"])) PrintForm($_GET, $host, $user, $pw, $db, $limitsmean, $limitsmin, $limitsmax, $alias); if ($environment==0) printf("No query submitted yet.
"); else { if (empty($_GET["fPrintTable"])) PrintPage("1", $host, $user, $pw, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limitsmean, $limitsmin, $limitsmax, $needs); else PrintPage("2", $host, $user, $pw, $db, $alias, $rightalign, $checkwhere, $checkgroup, $checkstatusgroup, $limitsmean, $limitsmin, $limitsmax, $needs); } echo (file_get_contents("index-footer.html")); } ini_set("display_errors", "Off"); ini_set("mysql.trace_mode", "Off"); } ?>