Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-13-2004, 01:19 PM   PM User | #1
lnxusr86
New Coder

 
Join Date: Nov 2003
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
lnxusr86 is an unknown quantity at this point
Hide URL

I need to hide the url from which a file is being downloaded, would i do that in a server side scripting language like php? and how would i do it?
lnxusr86 is offline   Reply With Quote
Old 04-13-2004, 01:30 PM   PM User | #2
lnxusr86
New Coder

 
Join Date: Nov 2003
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
lnxusr86 is an unknown quantity at this point
Exclamation

Please move this thread the PHP section, thanks

okay i found this php code

Quote:
<?
/*
Copyright (c) 1999 Marcel Lemmen
E-mail: lemmen@support.nl
All rights reserved.

Version: V1.1
Homepage: http://home.support.nl/~lemmen/a-leech.php3

This code provided "As Is" with no warrantees express or implied.
The author and contributors are not liable for anything good or bad
that results from your use of this code.

You are free to distribute this for free provided this notice is included.
Please forward fixes/enhancements to the
author for inclusion in the next revision.

Usage:
Replace $files with the original with your files.
Replace $filenames with the filename people see when
downloading (CAN be different then file's!!!)
Replace $URL with your directory or the other URL.
Replace $additional_info with the info on each file.

That's all!!!

*/

$files=array( 'track01.mp3', 'escreen.exe');
$filenames=array( 'Thank ABBA for the music.mp3', 'Escreen.exe');
$additional_info=array( 'Various artists - Thanx ABBA for the music : 4978602 bytes', 'Shareware program to make a screenshot: 529920 bytes');
$url= "/home/lemmen/public_html/data/";
/* When the files are on another server, use the
whole address (http://www.server.com/dir/) in stead of /home/lemmen... */

$referer=ereg_replace( "\?.", "",$HTTP_REFERER);
$thisfile= "http://$HTTP_HOST$PHP_SELF";

if ($referer!=$thisfile){
echo "<center><big>Homepage: <a href=\"http://home.support.nl/~lemmen\">http://home.support.nl/~lemmen</big><br><hr><br><br></center>";
for ($i=0;$i<count($files);$i++)
echo "<P><A HREF=\"$PHP_SELF?$i\">",$filenames[$i], "</A> $additional_info[$i]\n";
}
else {
$i=$QUERY_STRING;
$total=$url . $files[$i];
Header ( "Content-Type: application/octet-stream");
Header ( "Content-Length: ".filesize($total));
Header( "Content-Disposition: attachment; filename=$filenames[$i]");
readfile($total);
}
?>
Is the script safe to use? or is there a more secure script? or is there a safer way to do it? maybe with anouther server side scripting launguage?

Last edited by lnxusr86; 04-13-2004 at 01:37 PM..
lnxusr86 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:43 PM.


Advertisement
Log in to turn off these ads.