Results 1 to 9 of 9

Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.


Thread: Download counter for my repo's Depiction section.

  1. #1
    Green Apple ibyte24's Avatar
    Join Date
    Apr 2011
    Location
    Las Vegas, NV
    Posts
    43
    Thanks
    3
    Thanked 3 Times in 3 Posts

    Question Download 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.

  2. #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:

    Code:
    RewriteEngine On
    RewriteRule ^/cydia/downloads/(.*)$ /cydia/dltracker.php?file=$1 [L,QSA]
    And save that in your Website root. If you already have a htaccess file, paste that code at the bottom of it.
    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:

    Code:
    SELECT * FROM cydia_downloads SORT BY downloads ASC LIMIT 20
    And then you need to print out a HTML table of the results given by the database.

  3. The Following User Says Thank You to thekirbylover For This Useful Post:

    ibyte24 (10-05-2011)

  4. #3
    Green Apple ibyte24's Avatar
    Join Date
    Apr 2011
    Location
    Las Vegas, NV
    Posts
    43
    Thanks
    3
    Thanked 3 Times in 3 Posts

    Thanks for the information and taking the time to help.

  5. #4
    Quote Originally Posted by ibyte24 View Post
    Thanks for the information and taking the time to help.
    You're welcome

  6. #5
    Green Apple ibyte24's Avatar
    Join Date
    Apr 2011
    Location
    Las Vegas, NV
    Posts
    43
    Thanks
    3
    Thanked 3 Times in 3 Posts

    Lol, the frustration of my retardedness is getting to me. Maybe I'll just pay someone to make one for me.

  7. #6
    Green Apple ibyte24's Avatar
    Join Date
    Apr 2011
    Location
    Las Vegas, NV
    Posts
    43
    Thanks
    3
    Thanked 3 Times in 3 Posts

    My server supports PHP an MySQL... If anyone is willing for money.

  8. #7
    Quote Originally Posted by ibyte24 View Post
    My server supports PHP an MySQL... If anyone is willing for money.
    I've had a bit of a further look into this and I'll write a tutorial for it on my blog. I'll give you the link when I'm done.

  9. #8
    Green Apple ibyte24's Avatar
    Join Date
    Apr 2011
    Location
    Las Vegas, NV
    Posts
    43
    Thanks
    3
    Thanked 3 Times in 3 Posts

    Right on... Looking forward to it.

  10. #9
    Quote Originally Posted by ibyte24 View Post
    Right on... Looking forward to it.
    Here you go: http://adamscode.wordpress.com
    Try it on a test server first before putting it online and tell me if you have any problems.

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •