| | |
PHP Query, Make users login before accessing a movie?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
PLEASE BE CAREFUL!!!!!
if you start usign variables in the following script other users can do very malicious things with it! Including download your PHP source code!!!! which (if you use a db) would contain your database passwords!!!!
you must also set the appropiate MIME type if you are not usign the type i specified. and replace the whole login thing with your own validation scheme, this should be all u need.
if you start usign variables in the following script other users can do very malicious things with it! Including download your PHP source code!!!! which (if you use a db) would contain your database passwords!!!!
you must also set the appropiate MIME type if you are not usign the type i specified. and replace the whole login thing with your own validation scheme, this should be all u need.
PHP Syntax (Toggle Plain Text)
<?php if (!$logged_in) { echo "so sorry you must log in!"; exit(); } //the following 3 lines means they must always download a fresh copy (just to verify they are logged in!) header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Pragma: no-cache"); header("Content-type: video/mpeg"); //works for .mpe .mpeg .mpg //to force the end user to download the file, uncomment the following line, otherwise it will stream from your site (aka lots of bandwidth) //header("Content-Disposition: attachment; filename=video.mpg"); //replace this next line with the appropiate file name readfile('my-super-secret-private-video.mpg'); ?>
•
•
•
•
Originally Posted by alee
so its ok if i just use that code without editing it?
•
•
•
•
Originally Posted by alee
But thanks VERY much, but surely. can't they still point their browser to the actual file?
Advanced note: when usign relatives path your "/" directory is NOT always the same in php as it is in FTP / SSH (check with your webhost to find out what is your home directory or look in the phpinfo() command)
![]() |
Similar Threads
- PHP & Apache Server Security Questions (PHP)
- Users have to login and logout twice, why? (PHP)
- Warning: session_start(): Cannot send session cache limiter - headers already sent (PHP)
- erro on login code (PHP)
- PHP query CSV (PHP)
Other Threads in the PHP Forum
- Previous Thread: New to php and getting frustrated
- Next Thread: Need Help with Side Nav Include
| Thread Tools | Search this Thread |
# 5.2.10 alexa apache api array beginner binary broken cakephp checkbox class clean clients cms code cron curl database date directory display dissertation dynamic echo echo$_get[x]changingitintovariable... email encode error fairness file files folder form forms function functions google href htaccess html image images include indentedsubcategory insert ip javascript joomla legislation limit link local login mail memberships menu mlm multiple multipletables mysql mysqlquery newsletters oop open paypal pdf persist php problem provider query radio random recursion remote rss script search secure server sessions sms sockets source space spam sql syntax system table tutorial update upload url validator variable video web youtube






