Location: PHPKode > scripts > dScript - PHP File Download Counter > dscript-php-file-download-counter/index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
	<title>dScript Download Counter</title>
	
	<link rel="stylesheet" href="./Includes/css/jquery.treeview.css" />
	<link rel="stylesheet" href="./Includes/css/styles.css" />
	
	<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js" type="text/javascript"></script>
	<script src="./Includes/js/jquery.treeview.js" type="text/javascript"></script>
	
	<script type="text/javascript">
	$(document).ready(function(){
		$("#browser").treeview({
			collapsed: true,
			animated: "normal"
		});
	});
	</script>
</head>
<body>

<!-- Start drawing container -->
<div id="container">
	<h1>Contents of <?=dirname($_SERVER['PHP_SELF']);?></h1>
	<div id="breadcrumbs"> <a href="<?=$_SERVER['PHP_SELF'];?>"></a></div>
		<div id="listingcontainer">
		    <div id="listingheader"> 
				<div id="headerfile">File</div>
				<div id="headersize">Size</div>
				<div id="headermodified">Downloads</div>
			</div>
			<div id="listing">

<!-- Start of script -->
<?php

include_once('./Includes/TalkPHP_Timer.class.php');
include_once('./Includes/functions.php');
$dir = '.'; //Set the directory to the download directory

$pTimer->start();  // Start timer
$ignore = array('Includes','download.php','index.php','.DS_Store'); // Exclude Script files. Add any other files to ignore here.
$path = getcwd(); // Get current directory

// Check if log file is present or is writable
if(!file_exists("$path/Includes/log") || !is_writable("$path/Includes/log"))
{
	echo "Log file 'log' does not exist or permission not set to 777 ";
	
}

$log = read_log();  // Read log into array
$list = scan_directory_recursively($dir); // Recursively scan current directory
sort($list); // Sort array
$out = create_nested_list($list); // Create output of files
echo $out; // Display output

$pTimer->stop();  // Stop Timer
echo "</div></div></div><div id='copy'>This page took ". $pTimer->display() . " seconds of computer time to generate.</div></body></html>";
?>
Return current item: dScript - PHP File Download Counter