File Directory Php

*/
//
$filename = ""; // File to open. quote out this variable if you are using a form to link to this script.
/*
No cache!!
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
/*
End of No cache
*/
function viewlog($filename) {
$fp = fopen($filename,"r");
$file = fread($fp,65535);
$replaced = eregi_replace(",", "", $file);
$replaced2 = eregi_replace("\n", "", $replaced);
$replaced3 = eregi_replace("\r", "", $replaced2);
fclose($fp);
return $replaced3;
}
echo "CSV File Viewer";
// Start the table definition of your choice
echo "";
echo viewlog($filename);
echo "
";
exit;
?>