On Sat, 2011-01-15 at 13:21 -0600, Michael Sullivan wrote:
> On Sat, 2011-01-15 at 12:31 -0500, Mark Shields wrote:
> > On Fri, Jan 14, 2011 at 10:53 PM, Michael Sullivan
> > <msulli1...@gmail.com> wrote:
> >         On Fri, 2011-01-14 at 22:37 -0500, Mark Shields wrote:
> >         <trimmed>
> >         >
> >         >
> >         >
> >         >
> >         > It's no problem.  Gmail realized you had already sent the
> >         same message
> >         > and collapsed the whole reply as "quoted text" :)
> >         >
> >         >
> >         > Try running this:
> >         >
> >         >
> >         > #  echo "phpinfo();" | xargs php -r
> >         >
> >         >
> >         > What does it output?  anything?
> >         
> >         
> >         It outputs a lot of stuff.  More than my gnome-terminal buffer
> >         could
> >         display (as in I issue a reset before I issue the command you
> >         sent and I
> >         can't see the command when I scroll all the way up.)  Anything
> >         in
> >         particular I should be looking for?  Anything I should grep
> >         for?
> >         
> >         
> >         
> > 
> > I just wanted to see if php-cli works.  And it does.
> > 
> > 
> > I would recommend re-emerging php at this point, then run etc-update
> > or dispatch-conf.
> > 
> 
> I did all three and restarted apache and went to the page.  Still only
> see code...

I've done some further research/testing and discovered that it's only my 
picture page that's not executing:

>From http://carter.espersunited.com/~michael/test.php:

Warning: Unknown: failed to open stream: Permission denied in Unknown on
line 0

Fatal error: Unknown: Failed opening required
'/home/michael/public_html/test.php' 
(include_path='.:/usr/share/php5:/usr/share/php') in Unknown on line 0

PHP executed.   It returned errors, but it executed, now from one
directory down:

>From http://carter.espersunited.com/~michael/camera/index.php:

\n"; print " \n"; print " \n"; print " \n"; print "\n"; print "\n";
print "\n"; print "
\n"; print "\n"; print " \n"; print " \n"; print " \n"; print "
\n"; print "
$title
\n"; print "
\n"; print "
\n
\n"; print "
\n"; $dirname = "."; $dh = opendir($dirname); print "
\n"; while ( gettype($file = readdir($dh)) != boolean) { if
(is_dir("$dirname/$file") && strlen($file) == 6) { #We are in a
directory $strMonth = substr($file, 0, 2); $strDay = substr($file, 2,
2); $strYear = substr($file, 4, 2); $file = $strYear.$strMonth.$strDay;
$dirarray[] = $file; } } closedir($dh); $value = $_POST['Set']; if (!
isset($value)) $value="current"; rsort($dirarray, SORT_STRING); if
($value == "Current") $value = "current"; if ($value == "current")
include("current.php"); if ($value=="All") { foreach ($dirarray as
$file) { $strMonth = substr($file, 2, 2); $strDay = substr($file, 4, 2);
$strYear = substr($file, 0, 2); $file = $strMonth.$strDay.$strYear;
makeTable($dirname, $file); } } if ($value !="current" && $value !=
"All") makeTable($dirname, $value); showList(); print "
\n"; print " \n"; print "\n"; function makeTable($dirname, $file)
{ global $text; global $bgcolor; #The name of this directory is in
mmddyy format. We need to spit it into its individual parts and print it
(mm/dd/yy) $strMonth = substr($file, 0, 2); $strDay = substr($file, 2,
2); $strYear = substr($file, 4); print "\n"; print " \n"; print " \n";
print "\n"; print "
\n"; print "
Added $strMonth"."/".$strDay."/".$strYear."
\n"; print "
\n"; $subdirname = $file; $eh = opendir($subdirname); #We need to make a
table for the thumbnails to appear in... print " \n"; print "\n"; $count
= 1; while (gettype($subfile = readdir($eh)) != boolean) { $ext =
substr($subfile, strlen($subfile) - 3, 3); $ext = strtolower($ext); if
(!is_dir("$dirname/$subdirname/$subfile") && $ext == "jpg") { print
"\n"; $count++; if ($count > 5) { print "\n"; print "\n"; $count =
1; } } } print " "; print "
\n"; print "
\n"; } function makeList($file) { print " $file\n"; } function
showList() { global $dirarray; global $dirname; print "\n"; print " \n";
print "\n"; } ?>
\n"; //print "$subfile
\n"; $subfilename = htmlspecialchars($subfile, ENT_QUOTES); $filename =
$dirname."/".$subdirname."/mini/mini-".$subfilename; print "\n"; print
"\"$subfile\"\n"; print "\n"; print "

It occurs to me that I might have an error in the script itself.  I have
posted the entire script here:

michael@carter ~/public_html/camera $ cat index.php 
<?
$title = "My Pictures"; 
$bgcolor = "#339966";   
$text = "#FFFF00";      

print "<html>\n";
print "   <head>\n";
print "      <title>$title</title>\n";
print "   </head>\n";
print "\n";
print "<body background='../images/pawborder.gif' bgcolor='$bgcolor'
text='$text'>\n";
print "\n";
print "<center>\n";
print "<table cellspacing='0' cellpadding='0' bgcolor='$bgcolor'>\n";
print "   <tr>\n";
print "      <td align='center'>\n";
print "         <h1>$title</h1>\n";
print "      </td>\n";
print "   </tr>\n";
print "</table>\n";
print "<br>\n<br>\n";
print "</center>\n";


$dirname = ".";
$dh = opendir($dirname);
print "<center>\n";
while ( gettype($file = readdir($dh)) != boolean)
{
   if (is_dir("$dirname/$file") && strlen($file) == 6)
   {  #We are in a directory
      $strMonth = substr($file, 0, 2);
      $strDay = substr($file, 2, 2);
      $strYear = substr($file, 4, 2);
      $file = $strYear.$strMonth.$strDay;

      $dirarray[] = $file;
   }
}
closedir($dh);

$value = $_POST['Set'];
if (!isset($value)) $value="current";
rsort($dirarray, SORT_STRING);
if ($value == "Current") $value = "current";
if ($value == "current") include("current.php");

if ($value=="All")
{
   foreach ($dirarray as $file)
   {
      $strMonth = substr($file, 2, 2);
      $strDay = substr($file, 4, 2);
      $strYear = substr($file, 0, 2);
      $file = $strMonth.$strDay.$strYear;
   
      makeTable($dirname, $file);
   }
}
if ($value !="current" && $value != "All")  makeTable($dirname, $value);

showList();
print "      </center>\n";
print "   </body>\n";
print "</html>\n";


function makeTable($dirname, $file)
{
      global $text;
      global $bgcolor;
      #The name of this directory is in mmddyy format.  We need to spit
it into its individual parts and print it (mm/dd/yy)
      $strMonth = substr($file, 0, 2);
      $strDay = substr($file, 2, 2);
      $strYear = substr($file, 4);
      print "<table cellspacing='0' cellpadding='0' bgcolor='$bgcolor'
border='3'>\n";
      
      print "   <tr>\n";
      print "      <td align='center'>\n";
      
      print "         <h3>Added
$strMonth"."/".$strDay."/".$strYear."</h3>\n";
      print "</td>\n";
      print "</tr>\n";
      print "</table>\n";
      $subdirname = $file;
      $eh = opendir($subdirname);
 
      #We need to make a table for the thumbnails to appear in...
      print "       <table cellspacing='0' cellpadding='0'>\n";      
 
      print "<tr>\n";
      $count = 1;
      while (gettype($subfile = readdir($eh)) != boolean)
      {
         $ext = substr($subfile, strlen($subfile) - 3, 3);
         $ext = strtolower($ext);
         if (!is_dir("$dirname/$subdirname/$subfile") && $ext == "jpg")
         {
            print "<td>\n";
            //print "$subfile<br>\n";
            $subfilename = htmlspecialchars($subfile, ENT_QUOTES);
            $filename = $dirname."/".$subdirname."/mini/mini-".$subfilename;
            print "<a href='".$dirname."/".$subdirname."/".$subfilename."'>\n";
            print "<img src='$filename' width=100 height=100 alt=\"$subfile
\">\n";
            print "</a>\n";
            print "</td>\n";
            $count++;
            if ($count > 5)
            {
               print "</tr>\n";
               print "<tr>\n";
               $count = 1;
            }
         }
      }
      print "          </tr>";
      print "       </table\n";
      print "       <br>\n";
      print "       <br>\n";
}

function makeList($file)
{
   print "      <option>$file</option>\n";
}

function showList()
{
global $dirarray;
global $dirname;
print "<form action='index.php' method='post'>\n";
print "   <select name='Set'>\n";
print "      <option>All</option>\n";
print "      <option selected>Current</option>\n";
foreach ($dirarray as $file)
{
      $strMonth = substr($file, 2, 2);
      $strDay = substr($file, 4, 2);
      $strYear = substr($file, 0, 2);
      $file = $strMonth.$strDay.$strYear;

   makeList($file);
}
print "   <br><br><input type='submit' value='Select'>\n";
print "</form>\n";

}
?> 

Do you see anything here that would cause PHP to output its code instead
of executing it?


Reply via email to