error_reporting(0);
//$path = $_SERVER['SCRIPT_NAME'];
//echo "path=$path
";
// Root variable is the name of the JPG file to retrieve, minus the ".jpg"
$root = $_SERVER['QUERY_STRING'];
$root = substr($root,5); // remove "file=" text
//echo "root filename=$root
";
// -- Read the SB description database text file.
$dbfile="fenddiff.txt";
//echo "database file=$dbfile
";
if (file_exists($dbfile)):
$sbinfo = File($dbfile);
$sbinfolen = sizeof($sbinfo);
sort($sbinfo); //-- Sort the array.
$i = 0;
while ($i < $sbinfolen):
$tok = strtok($sbinfo[$i],"|");
$sbname[$i] = $tok;
$tok = strtok("|");
$sbdesc[$i] = $tok;
$sbdesc[$i] =substr($sbdesc[$i],0,strlen($sbdesc[$i])-1); //-- strip off the CR.
//echo "\n";
$i++;
endwhile;
endif;
//--------------------------------
//-- Get the correct file description.
$filenoext=substr($root,0,strlen($root)-4); //-- remove the file extension.
$desc=" ";
$i = 0;
while ($i < $sbinfolen):
if ($sbname[$i] != $filenoext):
//-- Do nothing...
else:
// get the text description.
$desc=$sbdesc[$i];
endif;
$i++;
endwhile;
//-- Print the HTML.
echo "
GuitarHQ.com
- Fender Vintage Guitar detail pictures - $root Description: $desc File: $root |