Hi all I am in need to of some help. As I just sorted out a loging scritp to. I can't seem to add a downloading counter within the members page. So say for example after when the user logs and then wants to view the speacial page the download counter should appear but it is not apperaing and need to some help intgrating it. The code shown below.
This is the page that comes up after when the user has loged in.
<?php
session_name('tzLogin');
session_set_cookie_params(2*7*24*60*60);
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Partners Area</title>
<link rel="stylesheet" type="text/css" href="demo.css" media="screen" />
</head>
<body>
<div id="main">
<div class="container">
<h1>Partners Area</h1>
<h2>Login to view this resource!</h2>
</div>
<div class="container">
<?php
if($_SESSION['id'])
echo '<h1>Hello, '.$_SESSION['usr'].'! You are logged in!</h1>';
else echo '<h1>Please, <a href="demo.php">login</a> and come back later!</h1>';
?>
</div>
<div class="container tutorial-info"> Please click here to return back to the main page to logout <a href="http://www.sumwebsite.org.uk/logster/demo.php" target="_self">Main Partners Page</a>.</div>
</div>
</body>
</html>
I want to integrate this page within the above code:
<?php
error_reporting(E_ALL^E_NOTICE);
require 'connectdm.php';
$extension='';
$files_array = array();
/* Opening the thumbnail directory and looping through all the thumbs: */
$dir_handle = @opendir($directory) or die("There is an error with your file directory!");
while ($file = readdir($dir_handle))
{
/* Skipping the system files: */
if($file{0}=='.') continue;
/* end() returns the last element of the array generated by the explode() function: */
$extension = strtolower(end(explode('.',$file)));
/* Skipping the php files: */
if($extension == 'php') continue;
$files_array[]=$file;
}
/* Sorting the files alphabetically */
sort($files_array,SORT_STRING);
$file_downloads=array();
$result = mysql_query("SELECT * FROM download_manager");
if(mysql_num_rows($result))
while($row=mysql_fetch_assoc($result))
{
/* The key of the $file_downloads array will be the name of the file,
and will contain the number of downloads: */
$file_downloads[$row['filename']]=$row['downloads'];
}
?>
<!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=utf-8" />
<title></title>
<link rel="stylesheet" type="text/css" href="dm.css" />
<link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox-1.2.6.css" media="screen" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<div id="file-manager">
<ul class="manager">
<?php
foreach($files_array as $key=>$val)
{
echo '<li><a href="download.php?file='.urlencode($val).'">'.$val.'
<span class="download-count" title="Times Downloaded">'.(int)$file_downloads[$val].'</span> <span class="download-label">download</span></a>
</li>';
}
?>
</ul>
</div>
</body>
</html>
Anyhelp would be good and much apprecieated.
Kind Regards
Bow103