webtuto Posted October 17, 2008 Share Posted October 17, 2008 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); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/128878-hiding-original-link-problem/ Share on other sites More sharing options...
rhodesa Posted October 17, 2008 Share Posted October 17, 2008 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); ?> Quote Link to comment https://forums.phpfreaks.com/topic/128878-hiding-original-link-problem/#findComment-668154 Share on other sites More sharing options...
webtuto Posted October 17, 2008 Author Share Posted October 17, 2008 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 ) Quote Link to comment https://forums.phpfreaks.com/topic/128878-hiding-original-link-problem/#findComment-668162 Share on other sites More sharing options...
rhodesa Posted October 17, 2008 Share Posted October 17, 2008 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; ?> Quote Link to comment https://forums.phpfreaks.com/topic/128878-hiding-original-link-problem/#findComment-668181 Share on other sites More sharing options...
webtuto Posted October 17, 2008 Author Share Posted October 17, 2008 thanks it workd Quote Link to comment https://forums.phpfreaks.com/topic/128878-hiding-original-link-problem/#findComment-668210 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.