Support Forums
Download Counter Help Please - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: PHP The Hypertext Preprocessor (https://www.supportforums.net/forumdisplay.php?fid=21)
+---- Thread: Download Counter Help Please (/showthread.php?tid=6330)



Download Counter Help Please - Jordan L. - 04-18-2010

Hi.

So I've started working on the download page for dotrb, and I need some help with the PHP. I don't knwo why, but for some reason it's just not working.

Here's my code:
PHP Code:
<?php
if(!file_exists('rbshell.txt')){
  
file_put_contents('rbshell.txt''0');
}
if(
$_GET['click'] == 'rbshell'){
  
file_put_contents('rbshell.txt', ((int) file_get_contents('rbshell.txt')) + 1);
  die;
}
?>

Then for the file I want them to be able to download and count:
PHP Code:
<div id="program">
<
center><img src="images/rbshell1.12.png" alt="rbShell" border="2px #efefef">
<
p></p>
<
titletext><a href="/software/rbshell/Release/rbshell_1.12.zip?click=rbshell"rbShell </a></titletext>
<
smalltextVersion1.12 </smalltext>
<
smalltextDownloads: <?php echo file_get_contents('rbshell.txt'); ?></smalltext>
</div> 

http://dotrb.net/software to check out what I mean. It just doesn't count it for some reason..

Thanks for help. Smile


RE: Download Counter Help Please - Buffy - 04-18-2010

It is counting fine for me. Maybe there was just some lag on your part of the server whenever you were running this?


RE: Download Counter Help Please - Sam - 04-18-2010

It's counting fine for me too.


RE: Download Counter Help Please - Jordan L. - 04-18-2010

Ah, I forgot to update the post. Someone else helped me fix it now, so it's working good. Thanks. Smile