note 50975 added to function.symlink
| From: | aircha at cix dot co dot uk | Date: | Tue, 15 Mar 2005 16:49:06 +0000 |
| Subject: | note 50975 added to function.symlink | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-86490@lists.php.net to get a copy of this message | ||
Olszewski's method of creating downloadable links on the fly is pretty good.
I use a different technique under Apache where if you want a file, you might use a url like:
mydomain.com/files/mysecretfile.doc
But in fact Apache redirects this to a script with a url like:
mydomain.com/utilities/downloadfile.php?filename=mysecretfile.doc
(The browser address bar will still show the first url).
The script downloadfile.php can then handle all the mucky stuff like checking session variables to
see if someone is logged on, whether they have access to mysecretfile.doc, and if you want to
encrypt before download.
An advantage of this is that the php code to achieve the equivalent of Olszewski's is shorter,
so might execute faster. But more importantly, a casual hacker might think all he has to do is find
myverysecurefile.doc under the /home/user/public_html/files/mysecretfile.doc, or copy the url - but
there's nothing there! He won't find it or get an Apache error page.
----
Manual Page -- http://www.php.net/manual/en/function.symlink.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+50975
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50975&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50975&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50975&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50975&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50975&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+50975&report=yes
Search -- http://master.php.net/manage/user-notes.php