Jump to content

recovered proto-backup PHP files, can't figure them out


da5nd

Recommended Posts

  Thanks in advance for any help anyone can render.

  I'm helping a friend out with recovering his website from a catastrophic hack. He had no backup, his ISP had no backup, and he ditched his web designer eons ago.

  Fortunately, there seemed to be proto-backup files included in directories labeled "templates." I'm fairly comfortable with HTML coding, though horribly limited with PHP, and was able to get most of his website limping along with the files included therein.

  What I'm having issues with is a page on the site that is supposed to have a gallery with a scrolling slideshow.

 

  Here's the source for that page:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <title><? echo $title; ?></title>

  <link rel="stylesheet" href="<? echo $url; ?>cmhip.css" type="text/css" />

  <?

  if($section && $photo && ($slideshow == 1))

  {

    $seci=$section;

    $nextphoto=$photo+1;

    if(!is_file($photos.$seci."/".$nextphoto.".jpg"))

    {

    do

    {

      $seci++;

      $nextphoto=1;

    } while (($seci<=$maxsections)&&(!is_file($photos.$seci."/".$nextphoto.".jpg")));

    }

    if(is_file($photos.$seci."/".$nextphoto.".jpg"))

    {

    echo "<meta http-equiv=\"refresh\" content=\"15;url=".$relurl."index.php?section=".$seci."&photo=".$nextphoto."&slideshow=".$slideshow."#top\" />";

    }

    else

    {

    echo "<meta http-equiv=\"refresh\" content=\"15;url=$relurl\" />";

    }

  }

  ?>

</head>

 

<body>

  <div id="header">

  <img class="catright" alt="Museum Mascot" src="<? echo $url; ?>images/Hallie.jpg" />

  <a href="<? echo $url; ?>index.php"><img alt="CMHIP Museum Logo" src="<? echo $url; ?>images/CMHIPMLogo.jpg" /></a>

  </div>

  <div id="navmenu">

    <ul>

    <li><a href="index.php">Home</a></li>

<li><a href="history.php">History</a></li>

<li><a href="tourindex.php">History Photos</a></li>

<li><a href="spanish.php">En Español</a></li>

    </ul>

  </div>

  <div id="content">

    <div id="brace">

    <?php

  include("tour.php");

    ?>

</div>

<div class="clear"></div>

  </div>

  <div id="footer">

  <div id="footermenu">

    <ul>

    <li><a href="index.php">Home</a> | </li>

<li><a href="history.php">History</a> | </li>

<li><a href="tourindex.php">History Photos</a></li>

    </ul>

  </div>

    <p>

      ©<? if(date("Y")==2005) { echo date("Y"); } else { echo "2005-".date("Y"); } ?> Colorado Mental Health Institute at Pueblo Museum<br />

    </p><br />

<p>

  A very special thanks to <a href="mailto:[email protected]">Emilio Baldioli</a> for the wonderful job he did on the Spanish translation.

</p><br />

    <p id="validation">

  <a href="http://validator.w3.org/check?uri=referer">

  <img src="/images/vxhtml11.gif"

      alt="Valid XHTML 1.1!" height="15" width="80" /></a>

  <a href="http://jigsaw.w3.org/css-validator/check/referer">

      <img height="15" width="80" src="/images/vcss.gif"

      alt="Valid CSS!" /></a>

    </p>

    <p>

  This website is hosted and maintained by

  <a target="new" href="http://www.aculink.net">acuLink, inc. Internet Services</a><br /><br />

  Please send any questions or comments to: <a href="mailto:[email protected]">[email protected]</a>

    </p>

  </div>

</body>

</html>

 

  There seems to be code here for a slideshow gallery in the header, which I don't understand. The rest of the code in the "include("tour.php");" is here:

 

<h2>Virtual Museum Tour</h2>

<?

function sectionname($id,$pho)

{

  switch($id)

  {

  case 1:

    $name="CMHI at Pueblo Museum History Tour";

  break;

  default:

    $name="Incorrect Section ID, please report to Webmaster";

  break;

  }

 

  return $name;

}

function phototitle($id,$pho)

{

  /*switch($id)

  {

  case 1:

    switch($pho)

{

case 1:

  $name="First Colorado Insane Asylum - 1879";

break;

case 2:

  $name="The Male Center - 1883";

break;

case 3:

  $name="Old Administration Building";

break;

case 4:

  $name="The Female Center - 1888";

break;

case 5:

  $name="Dairy Farm - 1939";

break;

case 6:

  $name="Main Hospital Gate - 1939";

break;

case 7:

  $name="64-Year-Old Buggy Rolls Again - 1943";

break;

case 8:

  $name="South Grounds - 1940";

break;

case 9:

  $name="Noah Holt, Hospital Pharmacist - 1940";

break;

default:

  $name="Incorrect Photo ID, please report to Webmaster";

break;

}

  break;

  default:

    $name="Incorrect Section ID, please report to Webmaster";

  break;

  }

 

  return $name;*/

}

function photocaption($id,$pho)

{

  /*switch($id)

  {

  case 1:

    switch($pho)

{

case 1:

  $name="One-story frame house built for the few female patients admitted on opening day, October 23, 1879.";

break;

case 2:

  $name="First building built in 1883 for Colorado's mentally ill.  Used primarily for male patients.  It was demolished in 1968; cornerstone is at the Museum.";

break;

case 3:

  $name="Closer view of Male Center, also used as the first administration building.  Early asylum buildings resembled cathedrals, which many believed had a calming affect on the insane.";

break;

case 4:

  $name="This larger Female Center was later built in 1888 which housed 185 women patients.  Another wing was added in 1904 for 100 more women.";

break;

case 5:

  $name="CSH Dairy Farm, located two miles west of the main hospital grounds, operated from 1923 to 1964 with a dairy herd of 700 Holstein cows.  It was discontinued when patients were brought back to the main grounds for treatment and then discharged.";

break;

case 6:

  $name="Shorty Hawkins manned the main hospital gate shown here in 1939.  The inside pillars still stand today.";

break;

case 7:

  $name="This buggy was used by first superintendent, DR. P. R. Thombs from 1879 to 1899.  Photograph was taken in 1943 but the buggy original had a leather top.  It does not exist today.";

break;

case 8:

  $name="Colorado State Hospital's South Campus shown in 1940.  Most of these buildings have since been demolished.";

break;

case 9:

  $name="Hospital Pharmacist Noah Holt mixes medications for patients in this 1940 photograph.";

break;

default:

  $name="Incorrect Photo ID, please report to Webmaster";

break;

}

  break;

  default:

    $name="Incorrect Section ID, please report to Webmaster";

  break;

  }

 

  return $name;*/

}

 

function nextphoto($dir,$sec,$pho,$max,$slide)

{

  $nextphoto=$pho+1;

  if(!is_file($dir.$sec."/".$nextphoto.".jpg"))

  {

  do

  {

    $sec++;

    $nextphoto=1;

  } while (($sec<=$max)&&(!is_file($dir.$sec."/".$nextphoto.".jpg")));

  }

  if(is_file($dir.$sec."/".$nextphoto.".jpg"))

  {

  $tag="<a id=\"next\" href=\"".$url."index.php?section=".$sec."&photo=".$nextphoto."&slideshow=".$slide."#top\">Next ></a>";

  }

  else

  {

  $tag="<span id=\"next\">Next ></span>";

  }

 

  return $tag;

}

 

function backphoto($dir,$sec,$pho)

{

  $backphoto=$pho-1;

  if(!is_file($dir.$sec."/".$backphoto.".jpg"))

  {

  do

  {

    $sec--;

    if(is_dir($dir.$sec))

    {

    $count=0;

    $secdir=opendir($dir.$sec);

    while($files=readdir($secdir))

{   

        if (($files[0]!=".")&&($files[0]!=".."))

  {

          $count++;

        }

    }

    closedir($secdir);

    $backphoto=$count;

    }

  } while (($sec>=1)&&(!is_file($dir.$sec."/".$backphoto.".jpg")));

  }

  if(is_file($dir.$sec."/".$backphoto.".jpg"))

  {

  $tag="<a id=\"back\" href=\"".$url."index.php?section=".$sec."&photo=".$backphoto."#top\">< Back</a>";

  }

  else

  {

  $tag="<span id=\"back\">< Back</span>";

  }

 

  return $tag;

}

 

if($section && $photo)

{

  if(is_file($photos.$section."/".$photo.".jpg"))

  {

  echo "<dl id=\"vtphoto\">

  <dt><a name=\"top\"></a>".phototitle($section,$photo)."</dt>

  <dd id=\"vtpic\"><img alt=\"".phototitle($section,$photo)." - Photo No. ".$photo."\" src=\"".$relurl."photos/".$section."/".$photo.".jpg\" /></dd>

  <dd id=\"vtcaption\">".photocaption($section,$photo)."</dd>

  </dl>";

  }

  else

  {

  echo "<h3 class=\"center\">There are no photos in this section yet.  Please check back soon.</h3>";

  }

  echo "<div id=\"nextback\">";

  echo nextphoto($photos,$section,$photo,$maxsections,$slideshow);

  echo backphoto($photos,$section,$photo);

  if($slideshow == 1)

  {

  $toggle=0;

  $toggletext="Off";

  }

  else

  {

  $toggle=1;

  $toggletext="On";

  }

  echo "<a href=\"".$relurl."index.php?section=$section&photo=$photo&slideshow=$toggle#top\">Slideshow $toggletext</a></div>";

}

else

{

  echo "<p>Welcome to the virtual tour of the Colorado Mental Health Institute at Pueblo Museum.  This is a guided tour, slides will advance automatically every 15 seconds by default from the first photo in the first section you select and will continue until the last photo of the last section or until you choose to either return to this index or navigate to another portion of the site.<br /><br />Please choose a section below to begin the tour.</p>";

  echo "<ul id=\"vt\">";

  for($i=1;$i<=$maxsections;$i++)

  {

  echo "<li><a href=\"".$relurl."index.php?section=".$i."&photo=1&slideshow=1#top\">".sectionname($i,0)."</a></li>";

  }

  echo "</ul>";

}

?>

 

  The images are located in "/photos/1/*.jpg", and there are around 100 images in that directory. There are no other directories in "/photos/" other than "/1/". I also noticed that a decent chunk of the code is commented out, but I've tried uncommenting it and it still doesn't work.

  I'd like think I'm just missing something small, or there's an easy bit of modifying to make this code work. Please let me know if this is the case. If not, I'll ditch the code and start from scratch.

 

  Thanks,

  ~da5nd

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.