rts-league.org

You are not logged in.

Announcement

Do you want a new forum account? Send us an e-mail with your desired nick and we'll get it done!
(If the link doesn't work for you, right-click on it and save the e-mail address for use in your e-mail client)

#1 2008-05-11 06:26:41

Soji
Member
Registered: 2008-05-11
Posts: 10

Rec downloads number + top 5 most downloaded

Well i saw it's not working and that's sad. I can help you if you doesn't know how to fix this.

You've to go through a page who will increment the download and echo the  game with a mime type

header ("Content-type: application/octet-stream");
    header('Content-Disposition: attachment; filename="'.$name.'"');

    $target=$_GET['$target'];
        $id=$_GET['id'];

        //works better with a fopen ^^
        $ch=curl_init();
    curl_setopt($ch, CURLOPT_URL, $target);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    $data=curl_exec($ch);
    curl_close($ch);
        //echo the game, remember that with the mime type it's like this page become a real rec file wink
    echo $data;

        //updating the downloads
    require("../lib/class.mysql.php");
    $db=connect();
    $query_top=mysql_query("SELECT dls FROM games WHERE id=$id LIMIT 1") or die(mysql_error());
    $game=mysql_fetch_array($query_top)
        $dls=$game['dls'];
    $dls++;
    $query_top=mysql_query("UPDATE games SET dls=$dls WHERE topic=$tid") or die(mysql_error());
    deco($db);

Last edited by Soji (2008-05-11 06:29:46)

Offline

 

#2 2008-05-11 14:09:58

Pedestrian
Webmaster
From: Saint Louis, MO, USA
Registered: 2007-11-10
Posts: 1603

Re: Rec downloads number + top 5 most downloaded

Soji wrote:

header ("Content-type: application/octet-stream");
    header('Content-Disposition: attachment; filename="'.$name.'"');

That's very clever!

I haven't had much chance to work on the site since my classes started again, but I was wondering how I could get that to work.

Thanks man!

Offline

 

#3 2008-05-25 10:21:46

Soji
Member
Registered: 2008-05-11
Posts: 10

Re: Rec downloads number + top 5 most downloaded

no prob wink

Offline

 

Board footer

©Copyright 2007-2017 by RTS-League.com Hosting provided by Maximumdirect.net This page generated in 5 milliseconds.