Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.
Chit Chatforums, a part of the
I've recently put up a personal repo for myself and my beta testers, I got the screenshots page working but no where online can I find help to make a...
10-04-2011, 10:52 PM #1Download counter for my repo's Depiction section.
I've recently put up a personal repo for myself and my beta testers, I got the screenshots page working but no where online can I find help to make a downloads: part. Any help would be great, even if you can just point me in the right direction.
10-05-2011, 05:03 AM #2
If you use the httpd Web server, a database and a server-side programming language like PHP, you can easily track the downloads by making requests for downloading a deb file redirect to a script that counts the number of downloads and then sends the requested deb file.
First, create a database to hold the number of downloads. The rows that you will need are: id (integer), debfile (text) and downloads (integer).
Next, you'll create a script in a server-side language that will set the following headers:
* Content-Type: application/octet-stream
* Content-Length: (the size of the deb in bytes)
* Content-Disposition: inline; attachment=(filename of the deb)
Then it will read the “file” GET parameter, increment the counter for the file in the database, creating a new row if one doesn't already exist and sends the file to the user's device. Don't forget to turn off error reporting in your programming language or you might get corrupt files. And be absolutely sure that the name of the file does not contain a back or forward slash, just in case someone's trying to see a system file on your server. I can help you write this script if your server supports PHP and MySQL or SQLite.
Now, create a file called .htaccess (with the period at the start of the name) and enter this in:
RewriteEngine On RewriteRule ^/cydia/downloads/(.*)$ /cydia/dltracker.php?file=$1 [L,QSA]
Change /cydia/downloads to the folder that your deb files are in and /cydia/dltracker.php to the location of the download tracking script. This will simply forward all requests to download a deb file to the script.
Now try downloading a package from your repo in Cydia. Check your database to see if a row was created for the download. If it worked, you can proceed to making a list of top downloads. With MySQL, you can use a command similar to this one:
SELECT * FROM cydia_downloads SORT BY downloads ASC LIMIT 20
The Following User Says Thank You to thekirbylover For This Useful Post:
10-05-2011, 09:23 AM #3
Thanks for the information and taking the time to help.
10-05-2011, 09:27 AM #4
10-05-2011, 04:12 PM #5
Lol, the frustration of my retardedness is getting to me. Maybe I'll just pay someone to make one for me.
10-05-2011, 08:54 PM #6
My server supports PHP an MySQL... If anyone is willing for money.
10-05-2011, 09:15 PM #7
10-06-2011, 04:21 PM #8
Right on... Looking forward to it.
10-11-2011, 05:21 AM #9