Thanks for tips, guys. I will give it a try. Regards, Carlos. On 01/11/2007, Brendan Gillatt wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Carlos Marcano wrote: > > Hi fellows, hope you can help me with this: > > > > Does anyone know of a way to keep track of the number of times a file > > has been downloaded from a web server? I am hosting on a shared > > server some packages for Ubuntu Feisty users with Intel 537EP chipset > > modems and I would like to keep the count of how many times each > > packages is downloaded. I have no shell acces to the server but I have > > managed to install some stuff like php scripts. Any ideas? By the way, > > cheap is better :) > > > > Regards, > > > > *Carlos Marcano* > > -Guri, Venezuela- > > If the file is not massive, you could use a php script to open the file > and send it to the browser, saving a count to disk each time. > > As Timothy Weber suggested, it can be useful to know the number of > completed downloads also. For this you could add another counter at the > very end of the PHP script, after the transfer is complete. > > Something along the lines of > > define ( REQUESTLOG, 'requests.log' ); > define ( COMPLETELOG, 'completed.log' ); > define ( FILETOSEND, 'score.html' ); > > // count requests > $counts = file_get_contents ( REQUESTLOG ); > ++$counts; > file_put_contents ( REQUESTLOG, $counts ); > > // send file > readfile ( FILETOSEND ); > > // count completed > $counts = file_get_contents ( COMPLETELOG ); > ++$counts; > file_put_contents ( COMPLETELOG, $counts ); > ?> > > Make sure to create the two logfiles first with just '0' in them each. > > - -- > Brendan Gillatt > brendan {at} brendangillatt {dot} co {dot} uk > http://www.brendangillatt.co.uk > PGP Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xBACD7433 > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.3 (MingW32) > > iD8DBQFHKiVtkA9dCbrNdDMRAvLvAJ0Yzy4YIW9Uo1of4/cCGQl2SGBSOgCfaGAW > EBWvn6i+MW5TxBaNe28oPC4= > =ltY9 > -----END PGP SIGNATURE----- > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist