Okay, I have some good results here now, thought I'd post thyem as well. This works perfectly, maybe the code has some unneeded references I don't know about?
<?
include ("global.php");
$movie = "movie";
$dir = "/" . $content_dir . "/";
$filesexist = array();
$scanned_dirs = array();
$dbi = mysql_connect ("$hostName", "$userName", "$password");
mysql_select_db($databaseName);
function getstuff($dir, $mode, $movie){
global $dbi;
global $filesexist;
$foundsets = array();
$result = mysql_query("SELECT path FROM sets ORDER BY path ASC"); // WHERE movie != '$movie'
$numrows = mysql_num_rows($result);
for ($i=0; $i<$numrows; $i++) {
$rows = mysql_fetch_array($result);
$foundset = $rows[0];
$foundsets[] = $foundset;
}
asort($foundsets);
print "<b><font size=3>Viewing Current Content</font></b><hr>\n";
print "DIRECTORY<br>\n";
if($mode=="view"){
foreach ($foundsets as $item) {
print "<b><a href=\"scandirs_b.php?mode=edit&dirname=$item\" target=\"main\">$item</a></b><BR>\n";
}
}else{
getFiles($dir, $foundsets);
}
}
# you can use this function to get all of your file names out of your modules directory
function getFiles($dir, $foundsets){
global $filesexist;
global $scanned_dirs;
if($d = opendir($dir)) {
while (false !== ($entry = readdir($d))){
if(($entry!=".") && ($entry!="..") && (!ereg("[!|\(|\)|\?|@|%|&|\*|;|,|~|\{|\}]",$entry)))
{
if (@is_dir($dir.$entry)){
$filesexist = $dir.$entry."/";
getFiles($filesexist, $foundsets);
}
}
} // end while
closedir($d);
$filesexist = ereg_replace("//","/",$filesexist);
$linktext = $filesexist;
if ((!in_array($linktext,$foundsets)) && (!in_array($filesexist,$scanned_dirs))) {
echo "<a href=\"content.php?do=Process&format=$format&dirname=$linktext\" target=\"main\">" . $linktext . "</a><BR>";
$scanned_dirs[] = $filesexist;
}
} // end if
} // close getFiles func
getstuff($dir, add, movie);
?>