FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


How do I do this in apache?





jmraker
First off, this is for a website that isn't hosted by frihost.

I need to figure out a way to prevent people from downloading most but not every .flv movies until they are logged in via a php script. Basically the webserver needs to call a php script (but something else might be ok) on every request in a directory to determine if they're logged in and if the movie is public. My idea so far is to use .htaccess to treat the .flv movies as php scripts and turning off short tags and running some php before the file

Quote:
php_value auto_prepend_file in.php
php_value short_open_tag 0

AddType application/x-httpd-php .flv


but I was wondering if there was a better way to do this in apache?
Fire Boar
Yes. Restrict access to the directory containing your .flv files entirely, and in your flash program make it call via a php script, for example, instead of /videos/xyz.flv request /getvideo.php?name=xyz. Alternatively, you could use the RewriteEngine to route all requests to a non-existent file (of any type) to a single PHP script. For example:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ routing.php?q=$1 [L,QSA]

You can then use the $_GET['q'] variable, figure out what the requested file is and do your PHP magic that way.
Related topics
tutorials site
Seeking MySQL-php-Apache installer for WinXP
what is your php mysql apache installer package
I was wondering something if anyone might know the awnser...
How to install PHP and Apache in 5 min on Win98
Fix for deleting files/directories owned by apache
How to set authorisations -Windows sys / Apache webserver
Help Apache problems
apache problem, NEED HELP
Apache *** Stopped *** ?
mysql and apache problem.
WHY DO I GET APACHE PAGE?[RESOLVED]
Indigoperl includes a copy of Apache 2.0.44, PHP 4.2.3, perl
mod_rewrite in Apache and how does it work?
installing apache,mysql and php on windows
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.