if ($_REQUEST['gallery']=="") {
include('/home/www/html/header2.inc');
echo "You must specify a gallery.";
include('/home/www/html/footer2.inc');
exit;
}
//check passed directory for safety
if(strstr($_REQUEST['gallery'],"..")) {
echo "
Possible hack attempt! Gallery name can not contain '..'.
";
exit();
}
//Set root directory, start directory
$photo_root="/home/www/html" . escapeshellcmd ($_REQUEST['gallery']);
$url_root=$_REQUEST['gallery'];
if (file_exists($photo_root . "settings.txt")) {
include ($photo_root . "settings.txt");
// request to pass on to links
$request = "gallery=" . rawurlencode($gallery);
} else {
//Title of gallery
$title_gallery = empty($_REQUEST['title']) ? "Photo Gallery" : filter_input(INPUT_POST | INPUT_GET, 'title', FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_HIGH);
//Numbers of files per row
$number_per_row = empty ($_REQUEST['numperrow']) ? 4 : filter_input(INPUT_POST | INPUT_GET, 'numperrow', FILTER_SANITIZE_NUMBER_INT);
//Number of rows
$number_of_rows = empty($_REQUEST['numrows']) ? 4 : filter_input(INPUT_POST | INPUT_GET, 'numrows', FILTER_SANITIZE_NUMBER_INT);
// width of thumbnails. Height is automatically figured out.
if ($_REQUEST['size']=="" || (int)$_REQUEST['size'] < 50)
$thumbsize = 50;
else
$thumbsize = filter_input(INPUT_POST | INPUT_GET, 'size', FILTER_SANITIZE_NUMBER_INT);
// request to pass on to links
$request = "title=$title_gallery&numperrow=$number_per_row&numrows=$number_of_rows&gallery=" . rawurlencode($gallery) . "&size=$thumbsize&crop=$crop&maxy=$maxy";
}
// Name of this file.
$me = "";
//load the captions if they exist
if (file_exists($photo_root . "captions.txt")) {
$fp = fopen($photo_root . "captions.txt", r);
$captions = array ();
while ($line = fgets($fp)) {
$line_elements = explode(";", $line);
$captions[$line_elements[0]] = $line_elements[1];
}
}
include('/home/www/html/header2.inc');?>
Warning: Undefined variable $number_of_rows in /home/web/www/html/galleries/globalgallery/index.php on line 104
Warning: Undefined variable $number_per_row in /home/web/www/html/galleries/globalgallery/index.php on line 104
Warning: Undefined variable $photo_root in /home/web/www/html/galleries/globalgallery/index.php on line 107
Fatal error: Uncaught TypeError: readdir(): Argument #1 ($dir_handle) must be of type resource or null, false given in /home/web/www/html/galleries/globalgallery/index.php:83
Stack trace:
#0 /home/web/www/html/galleries/globalgallery/index.php(83): readdir()
#1 /home/web/www/html/galleries/globalgallery/index.php(107): GetDirArray()
#2 {main}
thrown in /home/web/www/html/galleries/globalgallery/index.php on line 83