This is a discussion on "Top 20 for most download - how?" within the PHP Forum section. This forum, and the thread "Top 20 for most download - how? are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Top 20 for most download - how?
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Top 20 for most download - how?
I have the number of downloads php script installed so it counts the number of times each is downloaded and shows them. I am just wondering if it would be possible to make a page where it shows the top 10 or 20 download in order of number of downloads. If so what kind of script would i be looking for?
|
|
|
|
|||
|
Re: Top 20 for most download - how?
you mean what would the script be called?
im not really sure as almost every script ive used ive written myself... Im assuming theres a download counter table in your database, then it would be quite easy, just have a query that sets # of downloads as descending and then take the first 10 or 20. the only problem would be matching the new script to the previous one.
__________________
www.MonsterCoding.com - Website Programming and Development Services |
|
|||
|
Re: Top 20 for most download - how?
I use a script which doesnt use databases and stored the information for clicks for several different link ids with in the same clicks.txt file. Does anyone know how I could get the top 10 from this?
|
|
|||
|
Re: Top 20 for most download - how?
Lets say you have a file called script1.php.
Are you saying that for each time the script gets clicked an entry is made in the clicks.txt file? Therefore you have a multiple entries of script1.php. |
|
|||
|
Re: Top 20 for most download - how?
When link.com/phpid=... something along those lines gets clicked the number is upated in the .txt file where it reads: (I only have 2 links enabled at the moment.)
1%%2006/08/13%%http://download.freewebtemplates.com...%%3%%template1 2%%2006/08/13%%http://download.freewebtemplates.com...%%4%%template2 |
|
|||
|
Re: Top 20 for most download - how?
If part of each string in the text file is the count, one way you might tackle it is to read the lines into an array, seperating out the count part, sort the array in decending order and the pick your top 10 or whatever. I have to say that keeping track in a database would be a lot less hassle. |
|
|||
|
Re: Top 20 for most download - how?
Yeah I have been told that but im a newb to php so it seemed a lot more difficult to install that way.
|
|
|||
|
Re: Top 20 for most download - how?
We have a script that shows the top 10 accesses on our web site during the previous 24 hours to lots of areas - you can see how it works here. It works by looking at the log file that our web server provides and counting relevant lines in there - no need for us to even keep a log ourselves within any of our own scripts.
I've put the source code of a simplified version to look just at .pdf files here and you can run that code too if you wish - it's even got a few comments in it! Hope this helps! |
|
|||
|
Re: Top 20 for most download - how?
Yeah that would normally work but i named this thread wrong. I have the not got the files on my server there i link directly to other sites for the downloads. There I actually count the click on links rather than downloads. Therefore the script I actually use my find the top ten most clicked links (out of a select list otherwise it will include my internal links).
|
|
|||
|
Re: Top 20 for most download - how?
You can open a remote URL for reading just as easily as you can open a file on your main server; you could do a counter log there (and that's what I would be tempted to do). However, there would be a bandwidth issue involved there if your counter file is big, so you might like to write a condensing script on the download server and have one piece of PHP reference another.
I use a technique like this on my own web site to collect exchange rates from the European Central Bank once a day so that we can quote an up-to-date price for people, and also to collect train running information from the local station (I'm doing a reliability log!). Take care to ensure you cache the data is you've got a busy site, though - once every 24 hours should be enough in most cases. |
![]() |
| Tags |
| top, most, download |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Download button - to download a PDF file | attila001122 | Web Page Design | 3 | Dec 9th, 2007 16:09 |
| Download | crackafaza | Website Planning | 2 | Oct 10th, 2007 13:13 |
| Download button | sabatier | PHP Forum | 2 | Aug 13th, 2007 14:30 |
| File Download | nileshnaik | JavaScript Forum | 1 | Nov 27th, 2006 16:13 |
| Download | djforemanuk | Introduce Yourself | 1 | Oct 2nd, 2005 15:50 |