Privacy and Security Notice

SANE Run Database

=$Run AND run_number<=$Run_E"; //$sql = "$sql AND datediff(start_time,'$dateB 00:00:00')>=0 AND datediff(start_time,'$dateE 23:59:59')<=0"; if(strncmp($Replay,"Select",6)!=0) $sql = "$sql AND replay=".substr($Replay,0,1); if(strncmp($HMS_Q,"Select",6)!=0) $sql = "$sql AND quality LIKE '%HMS=".$HMS_Q."%'"; if(strncmp($BETA_Q,"Select",6)) $sql = "$sql AND quality LIKE '%BETA=".$BETA_Q."%'"; if(strncmp($HMS_COL,"Select",6)!=0) $sql = "$sql AND HMS_collimator LIKE '%".strtolower($HMS_COL)."%'"; if(strncmp($Fieldo,"Select",6)!=0) $sql = "$sql AND orientation LIKE '%".$Fieldo."%'"; if(strncmp($Target,"Select",6)!=0) $sql = "$sql AND target LIKE '%".substr($Target,0,6)."%'"; print $sql; $result = mysql_query($sql,$con); echo $result; //table label print "\n"; print "\n"; while ($field = mysql_fetch_field($result)){ print " \n"; } print "\n\n"; if(isset($_POST["Search"])){ //Contents with automatic logbook reading while ($row = mysql_fetch_assoc($result)){ $ii=1; foreach ($row as $col=>$val){ $data[$ii] = $val; $ii=$ii+1; } $r_year=substr($data[2],2,2); $r_month=substr($data[2],5,2); $r_day=substr($data[2],8,2); $re_year=substr($data[3],2,2); $re_month=substr($data[3],5,2); $re_day=substr($data[3],8,2); $r_index="Run $data[1]".":"; $re_index="End of Run $data[1]".":"; $r_archive="$logweb/$r_year$r_month"."_archive"; $re_archive="$logweb/$re_year$re_month"."_archive"; //Run_start $contents=file_get_contents("$r_archive/logdir_auto.html"); if($contents!==false){ $logpos=strpos($contents,$r_index); if($logpos!==false){ $loghtml=substr($contents,$logpos-57,12); $ym="$r_year"."$r_month"; } } if($logpos==false || $contents==false){ $r_year_al=$r_year; $r_month_al=sprintf("%02d",$r_month-1); if($r_month_al=="00") { $r_month_al="12"; $r_year_al=sprintf("%02d",$r_year-1); } // echo "alternative:", $data[1],$r_year_al,$r_month_al; $r_archive_al="$logweb/$r_year_al$r_month_al"."_archive"; $contents=file_get_contents("$r_archive_al/logdir_auto.html"); if($contents!==false){ $logpos=strpos($contents,$r_index); if($logpos!==false){ $loghtml=substr($contents,$logpos-57,12); $r_archive=$r_archive_al; $ym="$r_year_al"."$r_month_al"; } } } if($logpos==false || $contents==false){ $r_year_al=$r_year; $r_month_al=sprintf("%02d",$r_month+1); if($r_month_al=="13") { $r_month_al="01"; $r_year_al=sprintf("%02d",$r_year+1); } // echo "alternative:", $data[1],$r_year_al,$r_month_al; $r_archive_al="$logweb/$r_year_al$r_month_al"."_archive"; $contents=file_get_contents("$r_archive_al/logdir_auto.html"); if($contents!==false){ $logpos=strpos($contents,$r_index); if($logpos!==false){ $loghtml=substr($contents,$logpos-57,12); $r_archive=$r_archive_al; $ym="$r_year_al"."$r_month_al"; } } } if($logpos==false || $contents==false){ $loghtml="logdir"; $ym="$r_year"."r_month"; } //Run_end $contents=file_get_contents("$re_archive/logdir_runend.html"); if($contents!==false){ $logepos=strpos($contents,$re_index); if($logepos!==false) $logehtml=substr($contents,$logepos-57,12); } if($logepos==false || $contents==false){ $re_year_al=$re_year; $re_month_al=sprintf("%02d",$re_month-1); if($re_month_al=="00") { $re_month_al="12"; $re_year_al=sprintf("%02d",$re_year-1); } $re_archive_al="$logweb/$re_year_al$re_month_al"."_archive"; $contents=file_get_contents("$re_archive_al/logdir_runend.html"); if($contents!==false){ $logepos=strpos($contents,$re_index); if($logepos!==false){ $logehtml=substr($contents,$logepos-57,12); $re_archive=$re_archive_al; } } } if($logepos==false || $contents==false){ $re_year_al=$re_year; $re_month_al=sprintf("%02d",$re_month+1); if($re_month_al=="13") { $re_month_al="01"; $re_year_al=sprintf("%02d",$re_year+1); } $re_archive_al="$logweb/$re_year_al$re_month_al"."_archive"; $contents=file_get_contents("$re_archive_al/logdir_runend.html"); if($contents!==false){ $logepos=strpos($contents,$re_index); if($logepos!==false){ $logehtml=substr($contents,$logepos-57,12); $re_archive=$re_archive_al; } } } if($logepos==false || $contents==false) $logehtml="logdir"; //72849 end of run is in March. It causes some problems. print "\n"; print "\n"; for($i=2;$i<=25;$i++) print "\n"; print "\n\n"; } print "
$field->name
"; print "$data[1]
"; print "[Start]"; print "[End]
$data[$i]
\n"; } elseif(isset($_POST["SimpleSearch"])){ //Contents without automatic logbook reading (simple form) while ($row = mysql_fetch_assoc($result)){ print "\n"; foreach ($row as $col=>$val){ print "$val\n"; } print "\n\n"; } print "\n"; } ?>