How many downloads

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 13
Joined: Fri Feb 07, 2003 10:11 am
Location: Finland

How many downloads

Postby macce » Sun Feb 16, 2003 3:31 am

How to made a easy script that tells the downloader how many have alredy downloaded a file?

mail me at:

visit me at:

User avatar
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Postby Redcircle » Sun Feb 16, 2003 12:39 pm

What I do is create a table with 3 fields. id,filename, and hits. When I add a file I put the filename into the db and use this function. It uses the $_GET super global from the ULR and increments the hits field and redirects to download the file.

Code: Select all

if(!empty($_GET['file']) && $_GET['file'])
        $db =dbConnect();
        $query = 'update filedls set hits = hits +1 where filename = "'.$file.'"';
        mysql_query($query, $db);

Return to “PHP coding => General”

Who is online

Users browsing this forum: Google [Bot] and 3 guests