Hmm... ok, thinking about it, this maybe solves only half the problem...
Here goes anyway, + my ramblings and theories as to how you could maybe do
the other half...

I'll check I've got the right problem though... You want to have links at
http://mydomain.com that point to a download, but only allow people to
download by clicking on there?  Yes?  If so, here's a solution as I see it

start off by validating where it came from:

if ($HTTP_REFERER!="http://mydomain.com";)
  {echo("Kindly go to http://mydomain.com and download from there."); }
else
  {
/* Allow the person to download the file */
}

Now here's where I'm hoping someone will be able to jump in here, but is it
possible for PHP to control the download?  ie send a file from somewhere
other than htdocs, so that the user can't download it through conventional
methods?  Surely you can get php to open a file outside the webspace (ie
c:/downloads etc) and send it to a user?

I'm looking for a person to step in here! :)

All I can suggest is this:
if ($HTTP_REFERER!="http://mydomain.com";)
  {echo("Kindly go to http://mydomain.com and download from there."); }
else
  {
Header("Location: http://servername/$file"}; /* Where $file is passed in as
a variable, choosing the filename */
}

I need other peoples input please?  PHP controllable downloads?

Ross

-----Original Message-----
From: GK [mailto:[EMAIL PROTECTED]]
Sent: 09 November 2001 13:41
To: [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] Download System


Hi Ross,
I'm sorry, would you please further explain?

Kent

"Ross Fleming" <[EMAIL PROTECTED]> ¼¶¼g©ó¶l¥ó·s»D
:[EMAIL PROTECTED]
> $HTTP_REFERER holds the address that the browser was referred from.  This
is
> an apache variable that PHP has access to.
>
> Be aware though, that this variable should be set by the users browser,
and
> not all browsers do that...
>
> Ross
>
> -----Original Message-----
> From: GK [mailto:[EMAIL PROTECTED]]
> Sent: 09 November 2001 11:57
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] Download System
>
>
> Hello guys,
> I'm running PHP on Apache on a Linux system. I would like to check where
the
> requests come from before allowing users to download a particular file.
For
> example,  if the request comes from http://abc.domain.com/ then allow the
> user to download the file, else the user cannot access the file. I wonder
if
> it can be achieved by PHP?
> Thanking you in advance.
>
> Kent
>
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>



--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to