How to install download counter in my code

A

Anonymous

Guest
I have a download section in my index.php that I'd like to add a download counter to but have no idea how to accomplish this. The existing code works perfectly but I'd like to know how many times the file is downloaded. Would prefer not to use a database.

Code:
<div id="download" class="stylized">
    <div "myform">
    <div class="container">
        <div class="row">
            <div class="download">
                <br /><br>
                <h1><center>FoxClone Download Page</center></h1>
                   <?php
                    $files = glob('download/*.iso');
                    $file = $files[count($files) -1];
                    $info = pathinfo($file);
                    $filename =  basename($file);
                    $md5file = md5_file($file);
                   ?>

                    <div class="container">
                        <div class="divL">                       
                            <h3>Get the "<?php echo "{$filename}";?>" file (approx. 600MB)</h3>
                        <center>  <a href="<?php echo "/{$file}";?>"><img src="images/button_get-the-app.png" alt=""></a> </center><br />
                            <h3 style="margin-bottom: 0.5rem;">The MD5sum for "<?php echo "{$filename}";?>" is "<?php echo "{$md5file}";?>  

<br>

Thanks in advance,
Larry
 
My idea was to read a text file, increment +1, write back to the text file and display the new number in a text box. Is there an easier way?
 
My idea was to read a text file, increment +1, write back to the text file and display the new number in a text box.
Why did you change your mind?
 
I haven't, just don't know how to code it.

After thinking about it some more, a database on the backend might be more useful in the long run. Until 20 years ago, I wrote front-end software for industrial databases. I'll need to brush-up on my sql queries and foreign-keys first.
 
Back
Top