Jump to content

help with this code please


wkdw1ll1ams

Recommended Posts

  • Replies 63
  • Created
  • Last Reply

Run this:

<?php
function dirContents($dir) {
if (is_dir($dir)) {	
	if ($dh = opendir($dir)) {			
		while (($file = readdir($dh)) !== false) {
			if(in_array($file,array('.','..'))) { continue; }
			if(is_dir($dir.'/'.$file)) {					
				$contents[$dir.'/'.$file] = dirContents($dir.'/'.$file);
			} else {
				$contents[] = $dir . '/' . $file;
			}
		}			
		closedir($dh);
	}
}
return $contents;
}

function processArray($array) {
if(is_array($array)) {
	echo '<ol>';
	foreach($array as $key => $value) {
		if(is_int($key)) {
			echo '<li><a href="'.$value.'">'.str_replace('/','',strstr(strrchr($value,'/'),'.',true)).'</a></li>';
		}
		else {
			echo '<li><span style="font-weight:bold">' . $key . '</span>';
			processArray($value);
			echo '</li>';
		}
	}
	echo '</ol>';
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type" />
<meta name="author" content="FilmZilla">
<meta name="publisher" content="FilmZilla">
<meta name="copyright" content="FilmZilla">
<style type="text/css">
@import url(styles.css);
</style>
<title>FilmZilla</title>
</head>

<body>
<div id="header">FilmZilla</div>
<div id="bar_nav">
<ul>
<a href="#">Home</a>
<a href="Donate.html">Donate</a>
</ul>
</div>
<div id="content_left">
<h1>Newest Films</h1>
Planet 51
<BR>
Scream 4
<BR>
Xmen First Class
</div>
<!--
this is where the film links are ##################################################
-->
<div id="content"><h1>Films</h1>
<?php
$dir = 'films';
$files = dirContents($dir);
processArray($files);
?>
<!--this is where the film links end ##################################################
-->
</div>
<div id="bar_bottom2"><marquee>Films are all DVDRIP.  Please donate. Do not take credit for these movies!</marquee></div>

<div id="bar_bottom">© 2011   |   Copyright © FileZilla</a></div>

<!--[if IE]></div><![endif]--> 

<div style="text-align: center; font-size: 0.75em;">Copyright© FilmZilla</a>.</div></body>
<link rel="shortcut icon" href="icon.ico">
<link rel="icon" type="image/gif" href="icon.png">
</html>

 

Don't change anything, but put this script in the directory that HOLDS the 'films' folder!  NOT in the 'films' folder.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.