How to place this code to (display result only) in .htm file instead of .php?
Quote:
Originally Posted by
Beverleyh
1 - Put the following code into a file called "counter.php";
PHP Code:
<?php
$counter = 'path/to/counter.txt'; // text file to store download count - create manually and put a 0 (zero) in it to begin the count
$download = 'http://mywebsite.com/file/to/download.zip'; // the link to your download file
$number = file_get_contents($counter); // read count file
$number++; // increment count by 1
$fh = fopen($counter, 'w'); // open count file for writing
fwrite($fh, $number); // write new count to count file
fclose($fh); // close count file
header("Location: $download"); // get download
?>
2 - Create the text file defined in the $counter value/location above and just put a 0 (zero) in it. The sample code file is called "counter.txt".
3 - Create a download link to the "counter.php" file instead of the actual download file;
Code:
<a href="path/to/counter.php">DOWNLOAD</a>
4 - To display the download count on your web page;
PHP Code:
<?php echo file_get_contents('path/to/counter.txt');?>
Hope that helps
Here,
Thank You, Beverleyh.
Step 1,2,3 worked for me but Step no.4 didn't gave me result.
Because i was having my page where result was to shown was html page not php page.
So I want the code of Step 4 in html format!
Can this be done? If possible how?
Waiting for reply, Thank You again...