>
Help | Search | Members | Calendar

Reply to this topicStart new topicStart Poll

> forcedownload - hidden link, hiden a download link!
Hybrid
Posted: Sep 2 2007, 10:15 PM
Quote Post

Advanced Member
***

Group: Members
Posts: 95
Member No.: 484
Joined: 15-March 04



Hello =)

Here's my problem;

I'm making a page on my site where people have to log in as a first, to get into the member section! Once in, they can navigate to a page where they can download an mp3 (of the band) or video (of the band) (note: nothing illegal + I'm aware uzipp doesnt support multimedia on the server, which is not the case), the multimedia is location on a server of a friend who's server does allow multimedia.

why did I use this?
* basically, to hide the download link, so people won't hotlink to my files!
* so as a result, people have to be a member of the site to be able to download smile.gif


I'm using the following code:
( I left out the piece of code that restricts the access to the page if ur not a member)

CODE
<?

session_cache_limiter('none');
session_start();


   $fileid=intval($_GET[id]);

$sql = "SELECT id, URL, title, size, downloads FROM multimedia WHERE id=' $fileid' ";

   $res = mysql_query($sql);

       # display results
       while ($row = @mysql_fetch_array($res)) {
       $fileurl = $row['URL'];


    $file_extension = strtolower(substr(strrchr($fileurl,"."),1));

          switch ($file_extension) {
     case "mpg": $ctype="video/x-mpg"; break;
     case "mp3": $ctype="audio/mpeg"; break;
              default: $ctype="application/force-download"; //force-download
          }

// required for IE, otherwise Content-disposition is ignored
if(ini_get('zlib.output_compression'))
ini_set('zlib.output_compression', 'Off');

          header("Pragma: public");
          header("Expires: 0");
          header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
          header("Cache-Control: private",false);
    header("Content-Type: video/x-mpg");
    header("Content-Type: audio/mpeg");
          header("Content-Type: $ctype");
          header('Content-Type: application/octet-stream');
    header("Content-Disposition: attachment; filename=\"".basename($fileurl)."\";");
          header("Content-Transfer-Encoding: binary");
          header("Content-Length: ".filesize($fileurl));
          set_time_limit(0);
          @readfile("$fileurl") or die("File not found.");
   
    exit();

}

?>


I'm left with a few problems:

* When the download starts, the file size is not shown..
(but i'm guessing this is normal, as the file is NOT located on the same server as the webpages (where the scripts are on) )

my probably biggest problem:
* when a download is busy... the visitor is NOT able to navigate around the site until the download is either complete or stopped (the page seems stuck or so)

Any ideas, especially on the last issue, would be MUCH appreciated!

thank you for your time!


--------------------
Love Is The Only Light
PM Email Poster
Top
Stevens Online
Posted: Sep 2 2007, 11:57 PM
Quote Post

SysAdmin
*****

Group: Team UZIPP
Posts: 2445
Member No.: 201
Joined: 17-May 03



Just to clarify, there are only restrictions on hosting media files on the old unmetered accounts. If you don't have one of those then you can host media on your site as long as you are legally entitled to distribute it, it is not streaming from the server and it does not cause any server load issues. The same applies for accounts which are transferred to GHXhosting.com, although I will soon be updating the TOS/AUP to make sure that it is easier to understand and clarify a few points which are not yet as clear as they should be.

As for the problem you are having with your script, I have seen the file size issue before when downloading from one or two websites but I have no idea what causes it, or why visitors become stuck on the download page. Perhaps someone with more experience in this area can help... smile.gif


--------------------
Mark Stevens
user posted image SysAdmin

Director of GHXhosting.com Ltd
PM Email Poster Users Website AOL MSN
Top

Reply to this topicStart new topicStart Poll

 



[ Script Execution time: 0.0362 ]   [ 12 queries used ]   [ GZIP Enabled ]

 
hosting sign up why uzipp! about us support contact http://www.uzipp.com