RE: [PHP-WIN] Download System
| From: | Ross Fleming | Date: | Sat, 10 Nov 2001 22:36:45 +0000 |
| Subject: | RE: [PHP-WIN] Download System | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-10339@lists.php.net to get a copy of this message | ||
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:great_kent@yahoo.com]
Sent: 09 November 2001 13:41
To: php-windows@lists.php.net
Subject: Re: [PHP-WIN] Download System
Hi Ross,
I'm sorry, would you please further explain?
Kent
"Ross Fleming" <r.fleming@totalise.co.uk> ¼¶¼g©ó¶l¥ó·s»D
:MABBLJAPGGBPMIPHMAGBOEMECDAA.r.fleming@totalise.co.uk...
> $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:great_kent@yahoo.com]
> Sent: 09 November 2001 11:57
> To: php-windows@lists.php.net
> 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: php-windows-unsubscribe@lists.php.net
> For additional commands, e-mail: php-windows-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
For additional commands, e-mail: php-windows-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net