All pastes #76154 Raw Edit

freeone3000

public text v1 · immutable
·published 2006-07-01 04:04 UTC
rendered paste body
function print_sites() {
$to_repl = array('/_/', '/\./');
$replacements = array(' ', '');

$handle = @opendir(".") or die("Could not read directory!");
while($file = readdir($handle)) {
	$banner_found = false;
	if($file!="." && $file!=".." && is_dir($file) && $file!='privscripts' && $file!='files' &&
		$file!='Connections' && $file!='user') {
		echo('<a href="./'.$file.'/">');
		$file_img = $file.'/img/';
		if(file_exists($file_img)) {
			$fhand = @opendir($file_img) or die();
			while($str = readdir($fhand)) {
				if(stristr($str, "banner")) {
					$file_img_str = $file_img.$str;
					if(is_file($file_img_str)) {
						$banner_found = true;
						echo('<img src="'.$file.'/img/'.$str.'" class="banner" alt="'.$file.' Banner">');
					} else {
						$fhand2 = opendir($file_img_str) or die("Couldn't open directory!");
						while($str2 = readdir($fhand2)) {
							$file_img_str_str2 = $file_img_str.'/'.$str2;
							if(is_file($file_img_str_str2)) {
								$banner_found = true;
								echo('<img src="'.$file_img_str_str2.'" class="banner" alt="'.$file.' Banner">');
								break;
							}
						}
						closedir($fhand2);
					}
					break;
				}
			}
			closedir($fhand);
		}
		if($banner_found==false) {
			$file = ucwords(preg_replace($to_repl, $replacements, $file));
			echo($file);
		}
		echo('</a><br><br>'."\n");
	}
}
closedir($handle);
}
?>