Jump to content


Photo

Download Counter


  • Please log in to reply
4 replies to this topic

#1 NightCrawler

NightCrawler
  • New Members
  • 12 posts

Posted 14 September 2003 - 09:57 AM

Can anyone pls give me a code to try about registering how many download occurs in my downloadable files?

#2 Detail

Detail

    King Detail

  • Hosted
  • 7,767 posts
  • Location:Dayonic
  • Projects:Dayvi.com
  •  Blu Spy

Posted 14 September 2003 - 12:36 PM

FS-21's script is good and has the option for muliple files.


This one is used for BlackMissile, it only supports 1 file:


Make a link:
<a href="download.php">BlackMissile Download</a>


The download.php files says:

<?php
$fp=fopen("counter.txt","r+");
flock($fp,1);
$count=fgets($fp,6);
$count+=1;
rewind($fp);
fputs($fp,$count);
flock($fp,3);
fclose($fp);
header ("location: BlackMissile.zip");
exit();
?>


the counter.txt file says:

1

it must be CHMOD'ed to 666.

and at the bottom of the page put:

Downloaded <?php include ("counter.txt"); ?> times



#3 NightCrawler

NightCrawler
  • New Members
  • 12 posts

Posted 15 September 2003 - 09:57 AM

i didn't notice before that php looks like C/C++.
Anyway thanks for the reply I'll go for the simple one(Detail's Code),its good enough for my need.
I'm sure this is a good resource for everyone!

#4 genobreaker

genobreaker

    Infantry General

  • Hosted
  • 1,222 posts
  • Location:Philippines
  • Projects:Yuri's Revenge: Zero Hour
  •  Revorian Loyalist - 10th

Posted 15 September 2003 - 09:59 AM

i could use one of those when my mod is ready
Become the Ultimate General - Mod Demo is Available!
Posted Image
Prepare your weapons technology against the worlds most powerful generals.
FREEDOM STUDIOS: http://www.freedomstudios.net

#5 Dark Dragon

Dark Dragon

    >.<

  • Members
  • 453 posts
  • Location:Dallas, TX

Posted 14 October 2003 - 08:03 PM

thx, ive been looking for a code like this for a while now, thx and ill use detail's easier one :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users