<?php
// FILE: avoid_misconfig_open_basedir.php
// to make these settings permanent, set in the "php.ini" file
// to temporarily override, use "ini_set()"
// not all directives can be overridden!
// use "open_basedir" to limit where PHP is allowed to open files

date_default_timezone_set('Europe/London');
ini_set('display_errors', 1);

// test "open_basedir"
$safePath = 'c:/xampp/htdocs';				// Windows
//$safePath = '/var/www';						// Linux / Mac
//ini_set('open_basedir', $safePath);

// show contents of sensitive folder
$dir = "c:/Windows/System32/drivers/etc/";	// Windows
//$dir = "/etc/";								// Linux / Mac
$list = glob ($dir . '*');
foreach ($list as $file) {
	echo '<br />' . $file . PHP_EOL;
}
