Jump to content

Recommended Posts

hey i use this code to let visitors download files and hiding the source link on the same time but it seems that for exemple if the original link is

 

Register a Domain, Find Hosting and Create a Website at Domain.com

 

but when downloading the file the link become -->

 

http:--domain.com-mysite-file.zip

 

so the file douesnt work :s

 

here is the coded im using

 

<?php 
include 'config.php';
$id = intval($_GET['id']);
$sql = mysql_query("select * from artist where id='$id'");
while($oop = mysql_fetch_array($sql))
{
$link = $oop['lien'];
$mo = str_replace("/","-",$link);

$content_len=@filesize($link);
Header("Content-type: application/zip");
Header("Content-type: octet-stream");
Header("Content-Disposition: attachment; filename=$oop[lien]");
if($content_len!=FALSE)
{
Header("Content-length: $content_len");
}
readfile($mo);

}
?> 

Link to comment
https://forums.phpfreaks.com/topic/128878-hiding-original-link-problem/
Share on other sites

what does the data look like in the DB? Can you post the output of this:

 

<?php 
include 'config.php';
$id = intval($_GET['id']);
$sql = mysql_query("select * from artist where id='$id'");
$oop = mysql_fetch_array($sql);
print_r($oop);
?>

the data on the db is like that --> http://rachidox.free.fr/mp3/akon/akon%20remix%20(by%20zik4.com).mp3

 

and using ur code -->

 

Array ( [0] => 4 [id] => 4 [1] => cheb khaled [artist] => cheb khaled [2] => musioc [titre] => musioc [3] => http://rachidox.free.fr/mp3/akon/akon%20remix%20(by%20zik4.com).mp3 [lien] => http://rachidox.free.fr/mp3/akon/akon%20remix%20(by%20zik4.com).mp3 [4] => rai [cat] => rai [5] => http://mixwebs.com/list/rai/chebkhaled.jpg [photo] => http://mixwebs.com/list/rai/chebkhaled.jpg )

so you just want the filename out of lien?

 

try this:

<?php 
  include 'config.php';
  $id = intval($_GET['id']);
  $sql = mysql_query("select * from artist where id='$id' LIMIT 1");
  $oop = mysql_fetch_array($sql);
  if(!$oop)
    die("File not found");
  $link = $oop['lien'];
  $content_len=@filesize($link);
  Header("Content-type: application/zip");
  Header("Content-type: octet-stream");
  Header("Content-Disposition: attachment; filename=".basename($link));
  if($content_len!=FALSE)
    Header("Content-length: $content_len");
  readfile($mo);
  exit;
?> 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.