<?php
// ephem_astronomy.php
// Supervising great pyephem module in python3.3
// RJM Programming
// October, 2018

date_default_timezone_set('UTC');

$bodies=["Sun","Mercury","Venus","Earth","Mars","Jupiter","Saturn","Uranus","Neptune","Pluto","Moon",
 "Phobos",
 "Deimos",
 "Io",
 "Europa",
 "Ganymede",
 "Callisto",
 "Mimas",
 "Enceladus",
 "Tethys",
 "Dione",
 "Rhea",
 "Titan",
 "Hyperion",
 "Iapetus",
 "Ariel",
 "Umbriel",
 "Titania",
 "Oberon",
 "Miranda"];
 
$vstar="";
$starbit="";
$afteri="</iframe>";

$more="";
$gmore="";

$bodyopts="";
for ($i=0; $i<sizeof($bodies); $i++) {
  $bodyopts.="<option value=" . $bodies[$i] . ">" . $bodies[$i] . "</option>";
}

$xss="";
//$ss="//www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?title=Earth%20Places%20Under%20Celestial%20Places&aregexographicals=y&aregeographicals=HTTP.Home%2Chttp.Sun%2Chttp.Moon&peninfo=75.57|-92.28|128301.127968_Home,64.04|-18.15|9728.65039_Sun,-16.30|151.44|127765_Moon&width=417&height=260&country=Places&popularity=&data=%20[75.57|-92.28|~Home~,2]%20,%20[64.04|-18.15|~Sun~,2]%20,%20[-16.30|151.44|~Moon~,2]";
$ss="//www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?title=Earth%20Places%20Under%20Celestial%20Places&aregexographicals=y&aregeographicals=HTTP.Home%2Chttp.Observer%2Chttp.Sun%2Chttp.Moon&peninfo=75.57|-92.28|127968_Home%20Observer,75.57|-92.28|128301_Observer%20Home,64.04|-18.15|9728.65039_Sun,-16.30|151.44|127765_Moon&width=417&height=260&country=Places&popularity=&data=%20[75.57|-92.28|~Home%20Observer~,2]%20,%20[75.57|-92.28|~Observer%20Home~,2]%20,%20[64.04|-18.15|~Sun~,2]%20,%20[-16.30|151.44|~Moon~,2]";
if (isset($_GET['ss'])) {
    if (urldecode($_GET['ss']) != "") {
      $ss=str_replace("+"," ",urldecode($_GET['ss']));
      $xss="&ss=" . urlencode($ss);
    }
}
$cbemoji="127760";
$datasuffix="%20,%20[-16.30|151.44|~Moon~,2]";
$prewidthsuffix=",-16.30|151.44|127765_Moon";
$prepeninfosuffix="%2Chttp.Moon";
$homelat="75.57";
$homelong="-92.28";
$sunlat="64.04";
$sunlong="-18.15";
$moonlat="-16.30";
$moonlong="151.44";

$sb="";
      if (isset($_GET['body'])) {
        if (urldecode($_GET['body']) != "") {
          if (strpos(urldecode($_GET['body']), "(") !== false) {
            $starbit="()";
            $vstar=" value='" . explode('"', explode('"', str_replace("star(","",str_replace(")","",str_replace("+"," ",str_replace('%22','"',urldecode($_GET['body']))))))[1])[0] . "'";
          }
if (isset($_GET['observer'])) {
    if (urldecode($_GET['observer']) != "") {
      $sb="\n #epoch { display: none; } \n";
      if (urldecode($_GET['body']) != "Moon" && urldecode($_GET['body']) != "Sun" && urldecode($_GET['body']) != "Earth") {
         exec("cat .." . '/' . "Python" . '/' . "sublunar.py | sed '" . '/' . "Moon" . '/' . "s" . '/' . "" . '/' . "" . urldecode($_GET['body']) . "" . '/' . "g' >>  .." . '/' . "Python" . '/' . "thisone.py");
         if (file_exists('/usr/bin/python')) {
         exec("" . '/' . "usr" . '/' . "bin" . '/' . "python .." . '/' . "Python" . '/' . "thisone.py > py_ephem.xxx");
         } else if (file_exists('/usr/bin/python3')) {
         exec("" . '/' . "usr" . '/' . "bin" . '/' . "python3 .." . '/' . "Python" . '/' . "thisone.py > py_ephem.xxx");
         } else {
         exec("" . '/' . "usr" . '/' . "local" . '/' . "bin" . '/' . "python3.3 .." . '/' . "Python" . '/' . "thisone.py > py_ephem.xxx");
         }
         if (strpos(explode(" ", file_get_contents("py_ephem.xxx"))[0], ":") !== false) {
         $vsotherlong="" . explode(":",(explode(" ", file_get_contents("py_ephem.xxx"))[0] . ":00:00"))[0] . str_replace("0.",".",("" . (explode(":",(explode(" ", file_get_contents("py_ephem.xxx"))[0] . ":00:00"))[1] / 60.0 +  explode(":",(explode(" ", file_get_contents("py_ephem.xxx"))[0] . ":00:00"))[2] / 3600.0)));
         $vsotherlat="" . explode(":",(explode(" ", file_get_contents("py_ephem.xxx"))[1] . ":00:00"))[0] . str_replace("0.",".",("" . (explode(":",(explode(" ", file_get_contents("py_ephem.xxx"))[1] . ":00:00"))[1] / 60.0 +  explode(":",(explode(" ", file_get_contents("py_ephem.xxx"))[1] . ":00:00"))[2] / 3600.0)));
         } else {
         $vsotherlong=explode(" ", file_get_contents("py_ephem.xxx"))[0];
         $vsotherlat=explode(" ", file_get_contents("py_ephem.xxx"))[1];
         }
         if ($vstar != "") {
         $ss.="%20,%20[" . $vsotherlat . "|" . $vsotherlong . "|~" . str_replace(" ","%20",explode('"', explode('"', str_replace("star(","",str_replace(")","",str_replace("+"," ",str_replace('%22','"',urldecode($_GET['body']))))))[1])[0]) . $fm_nm . "~,2]";
         $sss=explode("&width=", $ss);
         $ss=$sss[0] . "," . $vsotherlat . "|" . $vsotherlong . "|" . $cbemoji . "_" . str_replace(" ","%20",explode('"', explode('"', str_replace("star(","",str_replace(")","",str_replace("+"," ",str_replace('%22','"',urldecode($_GET['body']))))))[1])[0]) . "&width=" . $sss[1];
         $ss=str_replace("&peninfo=", "%2Chttp." . str_replace(" ","%20",explode('"', explode('"', str_replace("star(","",str_replace(")","",str_replace("+"," ",str_replace('%22','"',urldecode($_GET['body']))))))[1])[0]) . "&peninfo=", $ss);
         } else {
         $ss.="%20,%20[" . $vsotherlat . "|" . $vsotherlong . "|~" . str_replace(" ","%20",str_replace("+","%20",urldecode($_GET['body']))) . $fm_nm . "~,2]";
         $sss=explode("&width=", $ss);
         $ss=$sss[0] . "," . $vsotherlat . "|" . $vsotherlong . "|" . $cbemoji . "_" . str_replace(" ","%20",str_replace("+","%20",urldecode($_GET['body']))) . "&width=" . $sss[1];
         $ss=str_replace("&peninfo=", "%2Chttp." . str_replace(" ","%20",str_replace("+","%20",urldecode($_GET['body']))) . "&peninfo=", $ss);
         }
      }
      if (!isset($_GET['ss'])) {
      $vshomelat="" . explode("%3A", explode("%27", explode("iam.lat%20%3D%20%27", $_SERVER['QUERY_STRING'])[1])[0])[0] . str_replace("0.",".",("" . (explode("%3A", explode("%27", explode("iam.lon%20%3D%20%27", $_SERVER['QUERY_STRING'])[1])[0])[1] / 60.0)));
      $vshomelong="" . explode("%3A", explode("%27", explode("iam.lon%20%3D%20%27", $_SERVER['QUERY_STRING'])[1])[0])[0] . str_replace("0.",".",("" . (explode("%3A", explode("%27", explode("iam.lon%20%3D%20%27", $_SERVER['QUERY_STRING'])[1])[0])[1] / 60.0)));
      if (file_exists('/usr/bin/python')) {
      exec("" . '/' . "usr" . '/' . "bin" . '/' . "python .." . '/' . "Python" . '/' . "subsolar.py > py_ephem.xxx");
      } else if (file_exists('/usr/bin/python3')) {
      exec("" . '/' . "usr" . '/' . "bin" . '/' . "python3 .." . '/' . "Python" . '/' . "subsolar.py > py_ephem.xxx");
      } else {
      exec("" . '/' . "usr" . '/' . "local" . '/' . "bin" . '/' . "python3.3 .." . '/' . "Python" . '/' . "subsolar.py > py_ephem.xxx");
      }
      $vssunlong=explode(" ", file_get_contents("py_ephem.xxx"))[0];
      $vssunlat=explode(" ", file_get_contents("py_ephem.xxx"))[1];
      if (file_exists('/usr/bin/python')) {
      exec("" . '/' . "usr" . '/' . "bin" . '/' . "python .." . '/' . "Python" . '/' . "sublunar.py > py_ephem.xxx");
      } else if (file_exists('/usr/bin/python3')) {
      exec("" . '/' . "usr" . '/' . "bin" . '/' . "python3 .." . '/' . "Python" . '/' . "sublunar.py > py_ephem.xxx");
      } else {
      exec("" . '/' . "usr" . '/' . "local" . '/' . "bin" . '/' . "python3.3 .." . '/' . "Python" . '/' . "sublunar.py > py_ephem.xxx");
      }
      $vsmoonlong=explode(" ", file_get_contents("py_ephem.xxx"))[0];
      $vsmoonlat=explode(" ", file_get_contents("py_ephem.xxx"))[1];
      if (sizeof(explode(" ", file_get_contents("py_ephem.xxx"))) >= 6) {
        $afteri="</iframe><br><p>Next Full , New Moon (GMT) " . explode(" ", file_get_contents("py_ephem.xxx"))[2] . " " . explode(" ", file_get_contents("py_ephem.xxx"))[3] . " , " . explode(" ", file_get_contents("py_ephem.xxx"))[4] . " " . explode(" ", file_get_contents("py_ephem.xxx"))[5] . "</p>";
        //$ss=str_replace("~Moon~", "~Moon" . str_replace("+","%20",urlencode(" ... Next Full , New Moon (GMT) " . explode(" ", file_get_contents("py_ephem.xxx"))[2] . " " . explode(" ", file_get_contents("py_ephem.xxx"))[3] . " , " . explode(" ", file_get_contents("py_ephem.xxx"))[4] . " " . explode(" ", file_get_contents("py_ephem.xxx"))[5])) . "~", $ss);
      }
      $ss=str_replace($homelat, $vshomelat, str_replace($homelong, $vshomelong, $ss));
      $ss=str_replace($sunlat, $vssunlat, str_replace($sunlong, $vssunlong, $ss));
      $ss=str_replace($moonlat, $vsmoonlat, str_replace($moonlong, $vsmoonlong, $ss));
      }
      $xss="&ss=" . urlencode($ss);
      $gmore=str_replace("</iframe>",$afteri,"<br><iframe src='" . $ss . "' title='Places on Earth Celestials are above' style='width:420px;height:334px;'></iframe>");

    } else {
      $ss="";
    }
} else {
    $ss="";
}
      }
    }
  

$htmlis="<!doctype html>
<html>
<head>
<title>Astronomy Helper via Python PyEphem Module</title>
<meta name='viewport' content='width=device-width, initial-scale=1, minimum-scale=0.1, maximum-scale=8, user-scalable=yes' />
<style>
  td { vertical-align: top; } " . $sb . "
</style>
<script type='text/javascript'>
 var firstgo=true;
 var startPos=null;
 function ul(instar) {
   var outstar=instar;
   if (instar != '' && (instar == instar.toLowerCase() || instar == instar.toUpperCase())) {
    outstar=outstar.toLowerCase();
    var ins=outstar.split(' ');
    if (ins[0].substring(0,1).toLowerCase() == ins[0].substring(0,1)) {
      outstar=outstar.replace(ins[0].substring(0,1), ins[0].substring(0,1).toUpperCase());
    }
    for (var ii=1; ii<ins.length; ii++) {
    if (ins[ii].substring(0,1).toLowerCase() == ins[ii].substring(0,1)) {
      outstar=outstar.replace(' ' + ins[ii].substring(0,1), ' ' + ins[ii].substring(0,1).toUpperCase());
    }
    }
   }
   return outstar;
 }
 function observerask() {
  if (firstgo) {
  if (document.URL.toLowerCase().indexOf('https:') == -1) {
    location.href='https:' + document.URL.substring(document.URL.indexOf('/')).split('#')[0].split('?')[0] + '?cobs=y';
  }
  try {
  navigator.geolocation.getCurrentPosition(function(position) {
    if (firstgo) {
      startPos = position;
   document.getElementById('taobserver').value=\"iam = ephem.Observer()\" + String.fromCharCode(10) + \"iam.lon = '\" + ('' + startPos.coords.longitude + '.').split('.')[0] + \":\" + eval(eval('0.' + eval(('' + startPos.coords.longitude + '.0').split('.')[1])) * 60.0) + \"' # [LongitudeDegrees]:[DecimalMinutes]\" + String.fromCharCode(10) + \"iam.lat = '\" + ('' + startPos.coords.latitude + '.').split('.')[0] + \":\" + eval(eval('0.' + eval(('' + startPos.coords.latitude + '.0').split('.')[1])) * 60.0) + \"' # [LatitudeDegrees]:[DecimalMinutes]\" + String.fromCharCode(10) + \"iam.elevation = 0.0   # Metres\" + String.fromCharCode(10) + \"iam.date = '" . date('Y/m/d H:i', time()) . "'  # Y/m/d H:i (GMT)\" + String.fromCharCode(10) + \"iam.temp = 25.0  # Celsius degrees\" + String.fromCharCode(10) + \"iam.epoch = '2000'  # Nearest 50 year epoch under date\" + String.fromCharCode(10) + \"iam.pressure = 1010  # Millibars\";
      firstgo=false;
    } else if (startPos == null) {
   document.getElementById('taobserver').value=\"iam = ephem.Observer()\" + String.fromCharCode(10) + \"iam.lon = '-111:32.1'\" + String.fromCharCode(10) + \"iam.lat = '35:05.8'\" + String.fromCharCode(10) + \"iam.elevation = 0.0\" + String.fromCharCode(10) + \"iam.date = '" . date('Y/m/d H:i', time()) . "'\" + String.fromCharCode(10) + \"iam.temp = 25.0\" + String.fromCharCode(10) + \"iam.epoch = '2000'\" + String.fromCharCode(10) + \"iam.pressure = 1010\";
    } else {
   document.getElementById('taobserver').value=\"iam = ephem.Observer()\" + String.fromCharCode(10) + \"iam.lon = '-111:32.1'\" + String.fromCharCode(10) + \"iam.lat = '35:05.8'\" + String.fromCharCode(10) + \"iam.elevation = 0.0\" + String.fromCharCode(10) + \"iam.date = '" . date('Y/m/d H:i', time()) . "'\" + String.fromCharCode(10) + \"iam.temp = 25.0\" + String.fromCharCode(10) + \"iam.epoch = '2000'\" + String.fromCharCode(10) + \"iam.pressure = 1010\";
    }
  });
  } catch(ee) {
   document.getElementById('taobserver').value=\"iam = ephem.Observer()\" + String.fromCharCode(10) + \"iam.lon = '-111:32.1'\" + String.fromCharCode(10) + \"iam.lat = '35:05.8'\" + String.fromCharCode(10) + \"iam.elevation = 0.0\" + String.fromCharCode(10) + \"iam.date = '" . date('Y/m/d H:i', time()) . "'\" + String.fromCharCode(10) + \"iam.temp = 25.0\" + String.fromCharCode(10) + \"iam.epoch = '2000'\" + String.fromCharCode(10) + \"iam.pressure = 1010\";
  }
  } else if (startPos == null) {
   document.getElementById('taobserver').value=\"iam = ephem.Observer()\" + String.fromCharCode(10) + \"iam.lon = '-111:32.1'\" + String.fromCharCode(10) + \"iam.lat = '35:05.8'\" + String.fromCharCode(10) + \"iam.elevation = 0.0\" + String.fromCharCode(10) + \"iam.date = '" . date('Y/m/d H:i', time()) . "'\" + String.fromCharCode(10) + \"iam.temp = 25.0\" + String.fromCharCode(10) + \"iam.epoch = '2000'\" + String.fromCharCode(10) + \"iam.pressure = 1010\";
    } else {
   document.getElementById('taobserver').value=\"iam = ephem.Observer()\" + String.fromCharCode(10) + \"iam.lon = '-111:32.1'\" + String.fromCharCode(10) + \"iam.lat = '35:05.8'\" + String.fromCharCode(10) + \"iam.elevation = 0.0\" + String.fromCharCode(10) + \"iam.date = '" . date('Y/m/d H:i', time()) . "'\" + String.fromCharCode(10) + \"iam.temp = 25.0\" + String.fromCharCode(10) + \"iam.epoch = '2000'\" + String.fromCharCode(10) + \"iam.pressure = 1010\";
    } 
   document.getElementById('ra').innerHTML='Altitude';
   document.getElementById('dec').innerHTML='Azimuth';
   document.getElementById('ag').innerHTML='Horizontal coordinate system';
   document.getElementById('divobserver').style.display='block';
 }
 
 function testdo() {
      if(window.DeviceOrientationEvent) {
        window.addEventListener('deviceorientation', function(event) {
              if (document.getElementById('dodiv').innerHTML == '') {
                var alpha = event.alpha;
                var beta = event.beta;
                var gamma = event.gamma;
               
                if (alpha!=null || beta!=null || gamma!=null) {
                  document.getElementById('dodiv').innerHTML = 'alpha: ' + alpha + '<br/>beta: ' + beta + '<br />gamma: ' + gamma;
                  document.getElementById('docompass').style.display='block';
                }
              }
              }, false);
      }
 }
</script>
</head>
<body style='background-color:pink;' onload=\" if (document.URL.indexOf('?cobs=') != -1) { document.getElementById('bobs').click();  } if (window.DeviceOrientationEvent) { if (1 == 1) { testdo(); } else { document.getElementById('docompass').style.display='block'; }  } \">
<h1 id=myh1>Astronomy Helper via Python <a target=_blank title='PyEphem ... thanks' href='//rhodesmill.org/pyephem/'>PyEphem</a> module</h1>
<h3>RJM Programming <a onclick=\"location.href=document.URL.split('#')[0].split('?')[0];\" title=\"Rerun\">-</a> October, 2018</h3>
<table style='background-color:yellow;' border=50>
<tr><th>Celestial Body <a onclick=\"document.getElementById('docontext').style.display='block'; location.href='#docontext';\" style='text-decoration:underline;cursor:pointer;' target=idocontext href='//www.rjmprogramming.com.au/HTMLCSS/solar_system.html' title='Other Information'>...</a> <a target=_blank title='Star List, thanks' href='//github.com/brandon-rhodes/pyephem/blob/master/ephem/stars.py'>or</a> ...<br><input id=istar onblur=\"if (this.value != '') { this.title='star(' + String.fromCharCode(34) + ul(this.value) + String.fromCharCode(34) + ')';  location.href=document.URL.split('#')[0].split('?')[0] + '?body=' + encodeURIComponent(this.title) + '&epoch=' + encodeURIComponent(document.getElementById('epoch').value) + '&observer=' + encodeURIComponent(document.getElementById('taobserver').value) + '" . $xss . "'; }\" type=text placeholder=\"Star &#11088;\" title=Star" . $vstar . "></input></th><th><span id=ag>Astrometric geocentric</span> <br><span id=ra>Right Ascension</span> ... for now or ...<br><input style='width:300px;' id=epoch title=\"Optional date definition such as '1986/2/9', epoch='1950'\" placeholder=\"Optional date definition such as '1986/2/9', epoch='1950'\" value=''></input></th><th><span id=dec>Declination</span> ... for now or ...<br><input id=bobs type=button onclick=observerask(); value=\"Observer &#128301;\"></input><div style=display:none; id=divobserver><br><textarea id=taobserver cols=80 rows=8 value=></textarea></div></th></tr>
<tr><td><select size=" . (1 + sizeof($bodies)) . " onchange=\"if (this.value == '') { document.getElementById('epoch').value=(' ').trim(); } else { document.getElementById('istar').value=(' ').trim(); location.href=document.URL.split('#')[0].split('?')[0] + '?body=' + encodeURIComponent(this.value) + '&epoch=' + encodeURIComponent(document.getElementById('epoch').value) + '&observer=' + encodeURIComponent(document.getElementById('taobserver').value) + '" . $xss . "'; }\"><option id=myopt value=>Please select a Celestial Body below ... &#127756;</option>" . $bodyopts . "</select></td><td id=ra></td><td id=dec></td></tr>
</table>
<div id='dodiv' style='display: none;'></div>
<div id='docontext' style='display:none;width:100%;height:830px;'><a href='#myh1' title=Top>Back to top ...</a><br><iframe style='width:100%;height:800px;' id=idocontext name=idocontext src='//www.rjmprogramming.com.au/HTMLCSS/solar_system.html' title=More></iframe></div>
</body>
</html>";

if (isset($_GET['body'])) {
  if (urldecode($_GET['body']) != "") {
      if (file_exists('py_ephem.xxx')) {
        unlink('py_ephem.xxx');
      }
      if (file_exists('../Python/thisone.py')) {
        unlink('../Python/thisone.py');
      }
      if (isset($_GET['epoch']) || isset($_GET['observer'])) {
       if (urldecode($_GET['observer']) != "") {
         $more="<br><iframe id=docompass style='width:100%;height:500px;display:none;' src='//www.rjmprogramming.com.au/HTMLCSS/yaw_etc.html' title='Yaw etcetera'></iframe>";
         file_put_contents("../Python/thisone.py", "import ephem\n" . urldecode($_GET['observer']) . "\n");
         $htmlis=str_replace("</textarea>", urldecode($_GET['observer']) . "</textarea>", $htmlis);
         exec("cat .." . '/' . "Python" . '/' . "Jupiter.py | grep -v '==' | grep -v 'import ephem' | sed '" . '/' . ".dec" . '/' . "s" . '/' . "" . '/' . ".az" . '/' . "g' | sed '" . '/' . ".ra" . '/' . "s" . '/' . "" . '/' . ".alt" . '/' . "g'  | sed '" . '/' . "Jupiter" . $starbit . '/' . "s" . '/' . "" . '/' . "" . urldecode($_GET['body']) . "" . '/' . "g' | sed \"" . '/' . "compute()" . '/' . "s" . '/' . "" . '/' . "compute(iam)" . '/' . "g\" | tr '!' '/' >>  .." . '/' . "Python" . '/' . "thisone.py");
         $htmlis=str_replace(">Right Ascension<", ">Altitude<", $htmlis);
         $htmlis=str_replace(">Declination<", ">Azimuth<", $htmlis);
         $htmlis=str_replace(">Astrometric geocentric<", ">Horizontal coordinate system<", $htmlis);
         $htmlis=str_replace(":none;", ":block;", $htmlis);
         $htmlis=str_replace("Please select a Celestial Body below ...", "Celestial Bodies ...", $htmlis);
       } else if (urldecode($_GET['epoch']) != "") {
         exec("cat .." . '/' . "Python" . '/' . "Jupiter.py | sed '" . '/' . "Jupiter" . $starbit . '/' . "s" . '/' . "" . '/' . "" . urldecode($_GET['body']) . "" . '/' . "g' | sed \"" . '/' . "compute()" . '/' . "s" . '/' . "" . '/' . "compute(" . str_replace('/','!',urldecode($_GET['epoch'])) . ")" . '/' . "g\" | tr '!' '/' >>  .." . '/' . "Python" . '/' . "thisone.py");
         $htmlis=str_replace(" value=''", " value=\"" . urldecode($_GET['epoch']) . "\"", $htmlis);
       } else {
        exec("cat .." . '/' . "Python" . '/' . "Jupiter.py | sed '" . '/' . "Jupiter" . $starbit . '/' . "s" . '/' . "" . '/' . "" . urldecode($_GET['body']) . "" . '/' . "g' >>  .." . '/' . "Python" . '/' . "thisone.py");
       }
      } else {
       exec("cat .." . '/' . "Python" . '/' . "Jupiter.py | sed '" . '/' . "Jupiter" . $starbit . '/' . "s" . '/' . "" . '/' . "" . urldecode($_GET['body']) . "" . '/' . "g' >>  .." . '/' . "Python" . '/' . "thisone.py");
      }
      if (file_exists('/usr/bin/python')) {
      exec("" . '/' . "usr" . '/' . "bin" . '/' . "python .." . '/' . "Python" . '/' . "thisone.py > py_ephem.xxx");
      } else if (file_exists('/usr/bin/python3')) {
      exec("" . '/' . "usr" . '/' . "bin" . '/' . "python3 .." . '/' . "Python" . '/' . "thisone.py > py_ephem.xxx");
      } else {
      exec("" . '/' . "usr" . '/' . "local" . '/' . "bin" . '/' . "python3.3 .." . '/' . "Python" . '/' . "thisone.py > py_ephem.xxx");
      }
      $ar_dec="";
      if (file_exists('py_ephem.xxx')) {
        $ar_dec=file_get_contents('py_ephem.xxx');
        unlink('py_ephem.xxx');
        $htmlis=str_replace(">" . urldecode($_GET['body']) . "<", " selected>" . urldecode($_GET['body']) . "<", $htmlis);
        $htmlis=str_replace("<td id=ra></td>", "<td id=ra><span style='background-color:#f0e0d0;border:1px solid olive;'>&nbsp;&nbsp;&nbsp;" . explode(" ",$ar_dec)[0] . "&nbsp;&nbsp;&nbsp;</span>" . $gmore . "</td>", $htmlis);
        $htmlis=str_replace("<td id=dec></td>", "<td id=dec><span style='background-color:#f0e0d0;border:1px solid olive;'>&nbsp;&nbsp;&nbsp;" . explode(" ",$ar_dec)[1] . "&nbsp;&nbsp;&nbsp;</span>" . $more . "</td>", $htmlis);
      }
  }
}

echo $htmlis;
?>
