<?php

   
GLOBAL $HeaderLine3;

   
$cYear date('Y');

   
$PHPListText Get_PHP_List();

// Define program header text.
   
$HeaderLine1 'Rising, Transit and Setting Times';
   
$HeaderLine2 'Computations via The NASA/JPL Horizons API';

// ---------------------------
// Generate client web page to
// display the files listing.

   
print <<< _HTML

<!DOCTYPE HTML>

<HTML lang='en'>

<head>
<title>Rising, Transit and Setting Times</title>
<meta name='viewport'           content='width=device-width, initial-scale=1'>
<meta http-equiv='content-type' content='text/html; charset=UTF-8'>
<meta name='description'        content='Horizons API, Rising, Transit and Setting Times'>
<meta name='keywords'           content='Horizons API, rise, set, transit'>
<meta name='author'             content='Jay Tanner - https://www.NeoProgrammics.com'>
<meta http-equiv='pragma'       content='no-cache'>
<meta http-equiv='expires'      content='-1'>
<meta name='robots'             content='index,follow'>
<meta name='googlebot'          content='index,follow'>

<style>
 BODY {font-family:Verdana; font-size:12pt; line-height:125%;}

 TABLE
{font-size:13pt; border: 1px solid black;}

 TD
{
 color:black; background-color:white; font-family:Verdana; font-size:12pt;
 line-height:150%; padding:6px; text-align:center;
}

 UL
{font-family:Verdana; font-size:12pt; line-height:150%; text-align:justify;}

 PRE
{
 background:white; color:black; font-family:monospace; font-size:13pt;
 font-weight:bold; line-height:125%; padding:6px;
 border:2px solid black; border-radius:8px;
}

 DIV
{
 background:white; color:black; font-family:Verdana; font-size:11pt;
 font-weight:normal; line-height:125%; padding:6px;
}


 TEXTAREA
{
 background:white; color:black; font-family:monospace; font-size:13pt;
 font-weight:bold; padding:4pt; white-space:pre; border-radius:8px;
 line-height:125%;
}


 INPUT[type='text']::-ms-clear {width:0; height:0;}

 INPUT[type='text']
{
 font-family:monospace; color:black; background:white; font-size:16pt;
 font-weight:bold; text-align:center; box-shadow:2px 2px 3px #666666;
 border:2px solid black; border-radius:4px;
}
 INPUT[type='text']:focus
{
 font-family:monospace; background:white; box-shadow:2px 2px 3px #666666;
 font-size:16pt; border:2px solid blue; text-align:center; font-weight:bold;
 border-radius:4px;
}



 INPUT[type='submit']
{
 background:#DDDDDD; color:black; font-family:Verdana; font-size:11pt;
 font-weight:normal; border-radius:4px; border:2px solid black;
 padding:4px;
}
 INPUT[type='submit']:hover
{
 background:cyan; font-size:11pt; font-family:Verdana;
 font-weight:normal; border-radius:4px; border:2px solid black;
 padding:4px; box-shadow:2px 2px 3px #666666;
}



 A:link
{
 font-size:9pt; background:transparent; color:blue; border-radius:4px;
 font-family:Verdana; font-weight:bold; text-decoration:none;
 line-height:175%; padding:3px; border:1px solid transparent;
}

 A:visited
{
 font-size:9pt; background:transparent; color:blue; border-radius:4px;
}
 A:hover
{
 font-size:9pt; background:yellow; color:black; border:1px solid black;
 box-shadow:1px 1px 3px #222222; border-radius:4px;
}
 A:active
{
 font-size:9pt; background:yellow; color:black; border-radius:4px;
}

 HR {background:red; height:4px; border:0px;}

::selection{background-color:yellow !important; color:black !important;}
::-moz-selection{background-color:yellow !important; color:black !important;}
</style>

</head>

<body style='color:white; background:black;'>

<table width='600' align='center'>

<tr><td style='color:white; background:#000066; border:2px solid white;
               border-radius:8px 8px 0px 0px;'>
<span style='font-size:18pt;'>
$HeaderLine1</span><br>
<span style='font-size:12pt;'>
$HeaderLine2</span><br>
<span style='font-size:10pt;'>by Jay Tanner - 
$cYear<br>All of these programs come with complete public domain PHP source code.</span><br>
</td></tr>

<tr><td style='font-size:10pt; text-align:left; border-radius:0px 0px 8px 8px;'>
$PHPListText
<br>
</td></tr>

</table>

<br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br>

</body>

</HTML>

_HTML;




// ***************************************************************************
// ***************************************************************************
// Get listing of all PHP files within the
// home folder of this program script with
// the exceptions in the exclusions list.

   
function Get_PHP_List()
{
   
$ListCount 0;
   
$PHPFilesList '';

// ------------------------------------------------
// Construct a filtered listing of all general HTML
// files contained within the home folder of this
// program.

   
ForEach (glob("*.php") as $FileName)
  {
// Ignore and exclude any HTML files indicated
// by the rules in this exclusion rules list.
   
if (
       
StrToLower($FileName) <> 'index.php'
       
and substr($FileName,0,1) <> '_'
      
)
  {
   
$FileSizeBytes Number_Format(FileSize($FileName), 0).' bytes<hr style="background:black; height:1px;">';
   
$xFileName Str_Replace('.php'''$FileName);

   
$PHPFilesList .=
   
"<li style='font-size:10pt;'><a href='$FileName' target='_blank' style='font-size:10pt;'>$xFileName</a><br>
   <span style='font-size:10.5pt; font-weight:normal;'>
$FileSizeBytes</span>
   </li>\n"
;

   
$ListCount++;
  }

  } 
// End of  ForEach (...)

// -----------------------------------------------------------------------
// Construct status message if no HTML files matching the rules are found.

   
if (trim($PHPFilesList) == '')
      {
$PHPFilesList '';} // "<li style='font-size:12pt;'>No PHP program scripts found in this folder.</li>\n";}

// -------------------------------------------------
// Done.  Return constructed list or status message.

   
$xMssg =
"
<br><span style='font-size:11pt;'>
Programs indexed #7 and #8 perform computations for multiple bodies and could take several seconds to finish and may seem to be non-responsive.&nbsp; Please be patient while the programs execute.
</span>
"
;

   
$IsAre = ($ListCount == 1)? 'is':'are';
   
$s     = ($ListCount == 1)? '':'s';
   
$w =
"
 <div align='center'><span style='color:black; font-size:12pt;'><i>Currently, there 
$IsAre $ListCount program$s in the directory.</i><br>$xMssg</span><br>
 </div>


<ol>
$PHPFilesList</ol>";

   return 
Str_Replace('0 PHP','no PHP'$w);
}





?>