Source code of file seti.php
from the PHP SETI@home web monitor.

<?php
// PHP SETI@home Web Monitor (phpsetimon).
// Copyright 2003, 2004 by Mario A. Valdez-Ramirez
// http://www.mariovaldez.net/

// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.

// You can contact Mario A. Valdez-Ramirez by email
// at mario@mariovaldez.org or paper mail at
// Olmos 809, San Nicolas, NL. 66495, Mexico.

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

require_once ("seticlients.inc.php");
require_once (
"config.inc.php");

$ps_charset "iso-8859-1";
if (
$ps_cfg_language <> "")
  
$ps_htmllang "<meta http-equiv='Content-Type' content='text/html; charset=$ps_charset'>\n";
$ps_languages = array ("es" => 1"en" => 1);
if (
array_key_exists (strtolower ($ps_cfg_language), $ps_languages)) {
  
$ps_cfg_language strtolower ($ps_cfg_language);
  require_once (
$ps_cfg_langfiles $ps_cfg_language".inc.php");
}
else { 
$ps_cfg_language "en"; include($ps_cfg_langfiles "en.inc.php"); }

require_once (
"seti_lib.inc.php");
require_once (
"seti_data.inc.php");
require_once (
"seti_graphs.inc.php");




echo 
"<HTML>\n<HEAD>\n<TITLE>$ps_title $ps_servername</TITLE>\n
<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"seti.css\">\n
$ps_htmllang
</HEAD>\n"
;
echo 
"<BODY BGCOLOR=\"#000000\" TEXT=\"#FFFFFF\" link=\"#99CCFF\" alink=\"#FF3333\" vlink=\"#CC99FF\" leftmargin=\"10\" topmargin=\"10\" rightmargin=\"10\" bottommargin=\"10\">\n";
// Display page header and title...
echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\"><tr><td>\n";
echo 
"<img src=\"" $ps_cfg_imagesdir "phpsetimon_banner_small.png\" widht=\"300\" height=\"60\" border=\"0\" alt=\"$ps_title\">\n";
echo 
"</td><td align=\"right\">\n";
echo 
"<h1>$ps_servername</h1>\n";
echo 
"</td></tr></table>\n";
// Display navigation...
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\"><tr>\n";
for (
$ps_igc 1$ps_igc <= $ps_seti_instances$ps_igc++) {
  if (
$ps_igc == $instance) { $ps_curnavstyle "navsel"; } else { $ps_curnavstyle "nav"; }
  if (
$ps_seti_instances 1) {
    if (
$ps_homename[$ps_igc]) {
      echo 
"<td class=\"$ps_curnavstyle\" align=\"center\">\n";
      echo 
"<a href=\"" $HTTP_SERVER_VARS["PHP_SELF"] . "?instance=$ps_igc&bigmap=$ps_cfg_showbigmap\">" $ps_homename[$ps_igc] . "</a>\n";
      echo 
"<br>" fnps_showislocal ($ps_homeislocal[$ps_igc]);
      echo 
"</td>\n";
    }
    else {
      echo 
"<td class=\"$ps_curnavstyle\" align=\"center\">\n";
      echo 
"<a href=\"" $HTTP_SERVER_VARS["PHP_SELF"] . "?instance=$ps_igc&bigmap=$ps_cfg_showbigmap\">{$ps_text["client"]}$ps_igc</a>\n";
      echo 
"<br>" fnps_showislocal ($ps_homeislocal[$ps_igc]);
      echo 
"</td>\n";
    }
  }
  else {
    echo 
"<td class=\"$ps_curnavstyle\" align=\"center\">\n";
    echo 
"<a href=\"" $HTTP_SERVER_VARS["PHP_SELF"] . "?instance=1&bigmap=$ps_cfg_showbigmap\">{$ps_text["refresh"]}</a>\n";
    echo 
"<br>" fnps_showislocal ($ps_homeislocal[1]);
    echo 
"</td>\n";
  }
}
echo 
"</tr></table>\n";



if ((
$ps_cfg_createbigmap || $ps_cfg_createhistory) && $ps_cfg_showbigmap) {
  
// Display big skymap and history...
  
echo "<hr><p><a href=\"" $HTTP_SERVER_VARS["PHP_SELF"] . "?instance=$instance\">{$ps_text["ret2stats"]}</a>.</p>\n";
  if (
$ps_imagemap_exists) {
    echo 
"<p><a href=\"$ps_imagemap_filename\">{$ps_text["openbigmap"]}</a>.</p>\n";
    echo 
"<p align=\"center\"><iframe src=\"$ps_imagemap_filename\" width=\"$ps_cfg_mapframeX\" height=\"$ps_cfg_mapframeY\" MARGINWIDTH=\"0\" MARGINHEIGHT=\"0\"></iframe></p>\n";
  }
  if (
$ps_history_listfull && $ps_cfg_createhistory) {
    echo 
"<table border=\"1\" align=\"center\" cellspacing=\"0\" cellpadding=\"2\">\n";
    echo 
"<tr><td class=\"head\" align=\"center\">{$ps_text["ra"]}</td>\n";
    echo 
"<td class=\"head\" align=\"center\">{$ps_text["dec"]}</td>\n";
    echo 
"<td class=\"head\" align=\"center\">{$ps_text["angle"]}</td>\n";
    echo 
"<td class=\"head\" align=\"center\">{$ps_text["datadate"]}</td>\n";
    echo 
"<td class=\"head\" align=\"center\">{$ps_text["dataid"]}</td>\n";
    echo 
"<td class=\"head\" align=\"center\">{$ps_text["simulatedmap"]}</td>\n";
    echo 
"<td class=\"head\" align=\"center\">{$ps_text["skyviewmap"]}</td></tr>\n";
    
$ps_maxh_items count ($ps_history_listfull);
    for (
$ps_hc 0$ps_hc $ps_maxh_items; ($ps_hc += 5)) {
      echo 
"<tr>\n";
      echo 
"<td class=\"history\" align=\"right\">" fnps_secstotime2 ($ps_history_listfull[$ps_hc] * 3600$ps_text["hours"]) . "</td>\n";
      echo 
"<td class=\"history\" align=\"right\">" fnps_secstotime2 ($ps_history_listfull[$ps_hc+1] * 3600$ps_text["degrees"]) . "</td>\n";
      echo 
"<td class=\"history\" align=\"right\">" $ps_history_listfull[$ps_hc+2] . "</td>\n";
      echo 
"<td class=\"history\">" $ps_history_listfull[$ps_hc+3] . "</td>\n";
      echo 
"<td class=\"history\">" $ps_history_listfull[$ps_hc+4] . "</td>\n";
      
$ps_tmp_hlink $ps_cfg_zoomdir $ps_filename_separator $ps_filename_prefix $ps_filename_separator $ps_curclientname $ps_filename_separator $ps_history_listfull[$ps_hc+4] . $ps_filename_separator "zoom.png";
      if (
is_readable ($ps_tmp_hlink)) {
        echo 
"<td class=\"history\" align=\"center\"><a href=\"$ps_tmp_hlink\">{$ps_text["showmap"]}</a></td>\n";
      }
      else {
        echo 
"<td class=\"history\" align=\"center\">-</td>\n";
      }
      
$ps_tmp_hlink $ps_cfg_skyviewdir $ps_filename_separator $ps_filename_prefix $ps_filename_separator $ps_curclientname $ps_filename_separator $ps_history_listfull[$ps_hc+4] . $ps_filename_separator "skyview.gif";
      if (
is_readable ($ps_tmp_hlink)) {
        echo 
"<td class=\"history\" align=\"center\"><a href=\"$ps_tmp_hlink\">{$ps_text["showmap"]}</a></td>\n";
      }
      else {
        echo 
"<td class=\"history\" align=\"center\">-</td>\n";
      }
      echo 
"</tr>\n";
    }
    echo 
"</table>\n";
  }
}
else {
  
// Display user, work unit and process summary...
  
echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\">\n";
  echo 
"<tr><td valign=\"top\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"3\">\n";
  echo 
"<tr><td class=\"separator\"></td></tr>\n";
  echo 
"<tr><td class=\"head\">{$ps_text["usertitle"]}</td></tr>\n";
  if (
$ps_setiuser_rawdata) {
    echo 
"<tr><td class=\"data\">{$ps_text["username"]}: " $ps_username "</td></tr>\n";
    echo 
"<tr><td class=\"data\">{$ps_text["userid"]}: " $ps_userid "</td></tr>\n";
    echo 
"<tr><td class=\"data\">{$ps_text["totalresults"]}: " $ps_totalresults {$ps_text["workunits"]}</td></tr>\n";
    echo 
"<tr><td class=\"data\">{$ps_text["totalcputime"]}: " fnps_secstotime2 ($ps_totalcpu$ps_text["hours"]) . "</td></tr>\n";
    echo 
"<tr><td class=\"data\">{$ps_text["cpuperunit"]}: " fnps_secstotime2 ($ps_cpuperunit$ps_text["hours"]) . "</td></tr>\n";
    echo 
"<tr><td class=\"data\">{$ps_text["setiuserfor"]}: " round ($ps_usertime) . {$ps_text["days"]}</td></tr>\n";
    echo 
"<tr><td class=\"data\">{$ps_text["resultsperday"]}: " round ($ps_unitsperday2) . "</td></tr>\n";
  }
    else {
      echo 
"<tr><td class=\"notice\">{$ps_text["nouserdata"]}</td></tr>\n";
    }
  if (!
$ps_results_waiting) {
    echo 
"<tr><td class=\"separator\"></td></tr>\n";
    echo 
"<tr><td class=\"head\">{$ps_text["workunittitle"]}</td></tr>\n";
    if (
$ps_setiwu_rawdata) {
      echo 
"<tr><td class=\"data\">{$ps_text["recordingdata"]}: " $ps_wutimerec "</td></tr>\n";
      echo 
"<tr><td class=\"data\">{$ps_text["workunitid"]}: " $ps_wuname "</td></tr>\n";
      echo 
"<tr><td class=\"data\">{$ps_text["coordstart"]}: " fnps_secstotime2 ($ps_wurastart 3600$ps_text["hours"]) . {$ps_text["ra"]} " fnps_secstotime2 ($ps_wudecstart 3600$ps_text["degrees"]) . {$ps_text["dec"]}</td></tr>\n";
      echo 
"<tr><td class=\"data\">{$ps_text["coordend"]}: " fnps_secstotime2 ($ps_wuraend 3600$ps_text["hours"]) . {$ps_text["ra"]} " fnps_secstotime2 ($ps_wudecend 3600$ps_text["degrees"]) . {$ps_text["dec"]}</td></tr>\n";
      echo 
"<tr><td class=\"data\">{$ps_text["wuangle"]}: " $ps_wuangle " deg</td></tr>\n";
    }
    else {
      echo 
"<tr><td class=\"notice\">{$ps_text["noworkunit"]}</td></tr>\n";
    }
    echo 
"<tr><td class=\"separator\"></td></tr>\n";
    echo 
"<tr><td class=\"head\">{$ps_text["preocessingtitle"]}</td></tr>\n";
    if (
$ps_setistatus_rawdata) {
      echo 
"<tr><td class=\"data\">{$ps_text["cputime"]}: " fnps_secstotime2 ($ps_cputime$ps_text["hours"]) . "</td></tr>\n";
      echo 
"<tr><td class=\"data\">{$ps_text["cpueta"]}: " fnps_secstotime2 ($ps_eta$ps_text["hours"]) . "</td></tr>\n";
      echo 
"<tr><td class=\"data\">{$ps_text["progress"]}: " round ($ps_progress1) . "%" "</td></tr>\n";
      echo 
"<tr><td class=\"data\">" fnps_drawbar ($ps_progress$ps_cfg_procbarX) . "</td></tr>\n";

      echo 
"<tr><td class=\"data\">{$ps_text["bestgaussian"]} [{$ps_text["gaussianfit"]}: " $ps_gaussian_fit {$ps_text["gaussianpower"]}: " $ps_gaussian_power "]</td></tr>\n";
      echo 
"<tr><td class=\"data\">{$ps_text["bestpulse"]} [{$ps_text["pulsescore"]}: " round ($ps_pulse_score2) . {$ps_text["pulsepower"]}: " round ($ps_pulse_power2) . {$ps_text["pulseperiod"]}: " $ps_pulse_period "]</td></tr>\n";
      
// Display gaussian graph...
      
if (($ps_cfg_creategauss) && ($ps_gaussgraph_exists)) {
        echo 
"<tr><td class=\"data\"><img src=\"$ps_gaussgraph_filename\" width=\"$ps_gaussgraph_Xsize\" height=\"$ps_gaussgraph_Ysize\"></td></tr>\n";
      }
    }
    else {
      echo 
"<tr><td class=\"notice\">{$ps_text["nostatus"]}</td></tr>\n";
    }
  }
  else {
    echo 
"<tr><td class=\"notice\">{$ps_text["results2send"]}</td></tr>\n";
  }
  echo 
"<tr><td class=\"separator\"></td></tr>\n";
  echo 
"<tr><td class=\"head\">{$ps_text["clienttitle"]}</td></tr>\n";
  if (
$ps_client_is_running == 1) {
    echo 
"<tr><td class=\"data\">{$ps_text["clientpid"]}: " $ps_client_pid "</td></tr>\n";
    if (
$ps_client_cpu) {
      echo 
"<tr><td class=\"data\">{$ps_text["clientcpu"]}: " $ps_client_cpu " %</td></tr>\n";
      echo 
"<tr><td class=\"data\">" fnps_drawbar ($ps_client_cpu$ps_cfg_procbarX"red""green") . "</td></tr>\n";
    }
    if (
$ps_client_mem) {
      echo 
"<tr><td class=\"data\">{$ps_text["clientmemory"]}: " $ps_client_mem " %</td></tr>\n";
      echo 
"<tr><td class=\"data\">" fnps_drawbar ($ps_client_mem$ps_cfg_procbarX"red""green") . "</td></tr>\n";
    }
    if (
$ps_client_nice)
      echo 
"<tr><td class=\"data\">{$ps_text["clientpriority"]}: " $ps_client_nice "</td></tr>\n";
  }
  elseif (
$ps_client_is_running == 0) {
    echo 
"<tr><td class=\"notice\">{$ps_text["noclient"]}</td></tr>\n";
  }
  else {
    echo 
"<tr><td class=\"notice\">{$ps_text["cannotchkclient"]}</td></tr>\n";
  }

  if (
$ps_cfg_createbigmap || $ps_cfg_createhistory) {
    echo 
"<tr><td class=\"separator\"></td></tr>\n";
    echo 
"<tr><td class=\"head\">{$ps_text["historytitle"]}</td></tr>\n";
    echo 
"<tr><td class=\"data\">\n";
    echo 
"<a href=\"" $HTTP_SERVER_VARS["PHP_SELF"] . "?instance=$instance&bigmap=1\">{$ps_text["showhistory"]}</a>.";
    echo 
"</td></tr>\n";
  }

  echo 
"</table></td>\n";


  
// Display zoomed and SkyView skymaps...
  
echo "<td valign=\"top\">\n";
  echo 
"<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\"><tr>\n";
  if ((
$ps_cfg_createzoom) && ($ps_zoommap_exists)) {
    echo 
"<td class=\"data\" align=\"center\" valign=\"top\">\n";
    echo 
"{$ps_text["generatedwith"]} <a href=\"http://starchart.sourceforge.net/\">{$ps_text["starchart"]}</a><br>\n";

    echo 
"<img src=\"$ps_zoommap_filename\" width=\"$ps_zoommap_Xsize\" height=\"$ps_zoommap_Ysize\" border=\"0\">\n";
    echo 
"</td>\n";
  }
  if (!
$ps_cfg_horlayout) echo "</tr><tr>\n";
  if ((
$ps_cfg_getskyview) && ($ps_skyview_exists)) {
    echo 
"<td class=\"data\" align=\"center\" valign=\"top\">\n";
    echo 
"<br>{$ps_text["thismapfrom"]} <a href=\"$ps_skyview_mainurl\">{$ps_text["nasasvvt"]}</a><br>\n";
    echo 
"({$ps_text["thisdatafrom"]} <a href=\"http://archive.stsci.edu/dss/\">{$ps_text["dssurvey"]}</a>):<br>\n";
    echo 
"<img src=\"$ps_skyview_filename\" width=\"$ps_skyview_Xsize\" height=\"$ps_skyview_Ysize\" border=\"0\"><br>\n";
    echo 
"{$ps_text["thismapcopyright"]} STScI,ROE,AAO,UK-PPARC,CalTech,NGS.</a>\n";
    echo 
"</td>\n";
  }
  elseif ((!
$ps_results_waiting) && ($ps_setiwu_rawdata)) {
    echo 
"<td class=\"data\" valign=\"top\" align=\"center\">\n";
    if (
$ps_cfg_linkskyview) {
      echo 
"<br><a target=\"_blank\" href=\"" fnps_linkskyview ($ps_skyview_Xsize$ps_skyview_Ysize$ps_wurastart$ps_wudecstart$ps_skyview_Yrange$ps_cfg_skyview_grid$ps_cfg_skyview_log$ps_cfg_skyview_color) . "\">\n";
      echo 
"{$ps_text["visitnasasvvt"]}</a>.<br>\n";
    }
    if (
$ps_cfg_getskyview) {
      echo 
"<br><a href=\"" $HTTP_SERVER_VARS["PHP_SELF"] . "?instance=$instance&skyview=1\">{$ps_text["downloadmap"]}</a> ({$ps_text["willtaketime"]}).";
    }
    echo 
"</td>\n";
  }
  echo 
"</tr></table>\n";
  echo 
"</td>\n";
  echo 
"</tr>\n";
  echo 
"</table>\n";
}



if (
$regenerate) {
  echo 
"<p>{$ps_text["imagesregenerated"]}</p>\n";
}


// Display footer...
echo "<p align=\"right\">{$ps_text["thispageby"]} <a href=\"$ps_pssite\">$ps_name $ps_version</a>\n";
echo 
"</BODY></HTML>\n";



?>
 
 
NA fum/lmd: 2004.09.16
Copyright ©1994-2017 by Mario A. Valdez-Ramírez.
no siga este enlace / do not follow this link