Download counter
Download counter
Hey, does anyone know where I can get a good download counter that doesn't cost anything and that doesn't have disgusting adverts? I won't need it for a little while, but I'd like to know how many times my game has been downloaded from my site. Thanks.
Re:Download counter
Well it depends, are you looking for a script to do it? Or a service?
Re:Download counter
If you have PHP installed, then make a link to the game point to a PHP file (and don't forget to create and use chmod on the file counter.txt):
Edit: I thought that someone could actually learn something from my code, so I changed it a bit and added comments for a better readability...
Code: Select all
<a href="game.zip">Download the game.</a><br>
<?php
# Opening the file for reading
$filename = "counter.txt";
$openfile = fopen ($filename, "r");
$readfile = fread ($openfile, filesize ($filename));
# Checking whether the file has never been downloaded, downloaded only once or more times, and printing out the corresponding message
switch ($readfile) {
case (NULL or 0) : echo "This game has never been downloaded.";
break;
case (1) : echo "This game has been downloaded only once.";
break;
default : echo "This game has been downloaded $readfile times.";
break;
}
# Closing the file
fclose ($openfile);
# Opening the file for writing
if (@fopen ($filename, "w")) {
$openfile = fopen ($filename, "w");
}
else {
echo "Error: failed to open the file for writing.";
}
# Writing the new value of the counter into the file
fwrite ($openfile, $readfile+1);
# Closing the file
fclose ($openfile);
?>
Re:Download counter
Well, probably the script. A service would most definitely require either money or ads. I've never been very good at programming in html (usually use frontpage or something like that), but I think I can figure this out. Eero makes it look rather easy, so I'll use his ideas here. Silly me, I'll have to look up PHP and chmod, but I'm sure I'll understand them quickly.Chris Cromer wrote: Well it depends, are you looking for a script to do it? Or a service?
Thanks.
Re:Download counter
Well his php script isn't written properly for what you are wanting to do. Your page is an html page, while the script uses php. So inserting that into your page will have no effect. Not only that but his code would count visits to the page the download is on and not just how many times the file was downloaded. So it won't be accurate in how many times it was downloaded.
Anyway, to use php you have to have a site that has php installed on it. geocities for instance does not have php installed.
If you want to use a script you need a website that supports php, perl, or asp. Otherwise your going to have to find a service because without a server side scripting language installed you can't really keep track of downloads.
Anyway, to use php you have to have a site that has php installed on it. geocities for instance does not have php installed.
If you want to use a script you need a website that supports php, perl, or asp. Otherwise your going to have to find a service because without a server side scripting language installed you can't really keep track of downloads.
Re:Download counter
Oh, well, that sux. I do indeed host my game on a geocities site. I guess I'll just use a service. People can deal with an advert to download my game. It's no big deal I guess. Thanks, Chris.
Re:Download counter
Well it is still possible to find a free service without ads... although it won't be easy because just about nothing in this world is free.
Re:Download counter
Not really much of a choice, it wouldn't be right to make money off of someone else's closed-source game system. We wheren't exactly given permission to use AGI/SCI to make our own games using their system. :-X
Re:Download counter
Come on, you're ruining my ethical moment. Anyway, my next game will not be AGI. It will be a system I could legally charge for, but I'm still not going to. My time and effort is still worth something, even if I'm using someone else's system. It's my contribution in trade for all the time and effort people put into projects that I am downloading for "free".
Anyway, do you have any idea of a place to get one of these download counter services?
Anyway, do you have any idea of a place to get one of these download counter services?
Re:Download counter
I just used the way most of the services use to count the downloads. I did left out the code that starts the download automatically though:Chris Cromer wrote: Well his php script isn't written properly for what you are wanting to do. Your page is an html page, while the script uses php. So inserting that into your page will have no effect. Not only that but his code would count visits to the page the download is on and not just how many times the file was downloaded. So it won't be accurate in how many times it was downloaded.
Code: Select all
<meta HTTP-EQUIV="refresh" content="1; URL=http://www.game.com/game.zip">
Code: Select all
header ("Location: http://www.game.com/game.zip");
And I said to put it in a PHP file...
Rich: You can still use my method by finding a free no-ads low-bandwidth PHP-enabled host (should be easily found), and place only the counter there, and leave the actual game to your current site...
Re:Download counter
just get a free service. who cares about the ads. they are on almost every other site, so whats the difference if its on yours?
Re:Download counter
Some people just hate ads, including me... It's the main reason why I haven't got my web page up. I don't want to pay for hosting, and my current connection's upload speed sucks too much for making a server with a decent speed. At least I should get a new one in few months...
Re:Download counter
Before you even think about turning your pc into a public server you might want to check the ISP's policy's because alot of ISP's don't like people running servers through them and will terminate your contract and internet connection for doing so.Eero R?nik wrote: Some people just hate ads, including me... It's the main reason why I haven't got my web page up. I don't want to pay for hosting, and my current connection's upload speed sucks too much for making a server with a decent speed. At least I should get a new one in few months...
For instance my ISP won't let me do it, so I have to pay for a server instead of using my pc as a server.
Re:Download counter
Thanks for a warning, but I did already. My ISP is absolutely great, they allow to make servers on their connection, give unlimited bandwidth, have cheap prices...