Download PHP script questions

First off I’d like to say sorry for making so many topics I"m just creating my own admin panel and I really don’t know how to do a lot of things. So my question is how can I display the .deb version number of the package and show at least 10 downloaders instead of when someone downloads the package the current info gets replaced with the new info.

Here’s the download.php:
[php]<?PHP

include(“config.php”);

$result = mysql_query(“SELECT * FROM download ORDER BY dldate DESC”);

echo “”;
echo "";

while($row = mysql_fetch_array($result)) {

$trimed1 = str_replace(“downloads/”, “”, $row[filename]);
$trimed2 = str_replace(".deb", “”, $trimed1);

echo "

";

}

echo “

Deb Downloads Last downloaded IP Device Firmware Agent
$trimed2 $row[stats] $row[dldate] $row[ip] $row[device] $row[firmware] $row[agent]

?>[/php]

Here is the code I use to display the number of downloads:
[php]<?PHP
$path = $_SERVER[‘DOCUMENT_ROOT’];
$path .= “config.php”;
include_once($path);
$query = “SELECT stats FROM download WHERE filename = ‘downloads/adblockerplus.deb’”;
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {
echo $row[0];
}
?>[/php]

Now I’m going for something like in the pictures that are attached.


IMG_0028.PNG

IMG_0029.PNG

Well, nobody has replied to this because there is not enough info for anyone to answer it for you.
And, post as many as you want here! We love to solve programming puzzles! Glad to help!

You show where you load “stats” from a table “download” for one file. Do you also keep a list of all
files and the downloads of it? If so, you would have to query the table for the 10 files along with the
counts of each or stats of each. That would give you a list of the files with counts and you can display
them. Did that make sense?

Is this a continuation of a previous post? We would have to know more about how your database is
laid out so we could help you fix it up. More info on how all this works and we can help…

The way my database is set u p is the same way that the download.php displays it. I’d like users to tap a link and it will show like the previous versions and how many times each version was downloaded.

Well, you have no control over a link. A link aims at a file. No easy way to create a “callback” latch to make
it come back to the page so you can count it.

But, you could make it a button instead. The button could be in a small form and post out to a download
page. On the page it can count the download by incrementing the database counter and then start the
download for them and then “header” back to the page. From their end it would seem like a regular link
download, but it would really be a programmed download.

No control over when a user presses a link as far as I know. Well, I guess you could link to another page
and then have that page do the same as a button. Either would work, but, the link would give out the
coding scheme and a good hacker could hack all your files…

Sponsor our Newsletter | Privacy Policy | Terms of Service