Ver Mensaje Individual
  #3 (permalink)  
Antiguo 24/09/2012, 12:11
PoLiZe
 
Fecha de Ingreso: marzo-2008
Ubicación: Santa Cruz, Argentina
Mensajes: 433
Antigüedad: 16 años, 1 mes
Puntos: 5
Respuesta: Ocultar URL de descarga externa

Cita:
Iniciado por moro666 Ver Mensaje
Código PHP:
Ver original
  1. <?
  2. /*
  3. Copyright (c) 1999 Marcel Lemmen
  4. All rights reserved.
  5. */
  6. $files=array( 'track01.mp3', 'escreen.exe');
  7. $filenames=array( 'Thank ABBA for the music.mp3', 'Escreen.exe');
  8. $additional_info=array( 'Various artists - Thanx ABBA for the music : 4978602 by
  9. tes', 'Shareware program to make a screenshot: 529920 bytes');
  10. $url= "/home/lemmen/public_html/data/";
  11. /* When the files are on another server, use the
  12. whole address (http://www.server.com/dir/) in stead of /home/lemmen... */
  13.  
  14. $referer=ereg_replace( "?.", "",$HTTP_REFERER);
  15. $thisfile= "http://$HTTP_HOST$PHP_SELF";
  16.  
  17. if ($referer!=$thisfile){
  18. echo "<center><big>Homepage: <a href="http://home.support.nl/~lemmen">
  19. http://home.support.nl/~lemmen</big><br><hr><br><br></center>";
  20. for ($i=0;$i<count($files);$i++)
  21. echo "<P><A HREF="$PHP_SELF?$i">",$filenames[$i], "</A> $additional_i
  22. nfo[$i]n";
  23. }
  24. else {
  25. $i=$QUERY_STRING;
  26. $total=$url . $files[$i];
  27. Header ( "Content-Type: application/octet-stream");
  28. Header ( "Content-Length: ".filesize($total));
  29. Header( "Content-Disposition: attachment; filename=$filenames[$i]");
  30. readfile($total);
  31. }
  32. ?>

Googeleando encontre esto y lo probe, funciona perfectamente y creo que es exactamente lo que querias!!
¡Hola! Gracias por el código, aunque, ya lo había visto, y utiliza el mismo método que también probé para mi sitio, y no funciona, porque lo que hace es descargar el archivo desde el servidor en un archivo temporal, y de ahi, permitir la descarga, entonces, al ser la descarga desde mi servidor, va muy lenta y se corta a cierta cantidad de megas.