Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display dynamic list of files in frame

Status
Not open for further replies.

Defey

IS-IT--Management
Jul 30, 2001
9
US
Input from my website visitors is added as a single line to a logfile ("$customer.log") upon each visit. Input from a new visitor would generate a new logfile that would then be appended upon each subsequent visit. I have a logfile administration page where I want all the logfiles displayed in the left frame, and then upon clicking a filename, the lines of content are displayed in the right frame. I am doing this now, but I am hardcoding the file list and I don't know how to make the list of $customer.log files dynamically show new files as new visitors start their logs. Thanks.
 
You would probably want to list the directory contents where all your log files reside.

This might work for you:
Code:
<?php


// initialize counter
$count = 0;

// set directory name
$dir = "./";

// open directory and parse file list
if (is_dir($dir))
{
if ($dh = opendir($dir))
{
// iterate over file list
// print filenames
while (($filename = readdir($dh)) !== false)
{
if (($filename != ".") && ($filename != ".."))
{
$count ++;
echo $dir . "/" . $filename . "\n";
}
}
// close directory
closedir($dh);
}
}

echo "-- $count FILES FOUND --";

?>

This will echo out every file in the preestablished directory. ./ is the current directory where the php file thats running resides.

Hope this helps



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top