I'm new to this forum and to PHP, please bear with me...
I have this PHP login script where the user logs in and is able to view protected pages. When I create a separate folder at mydomain.net/videos that I want to password protect so that only a registered user who are logged in can access the video content within that folder. But I know you could just go directly to mydomain.net/videos and go around the login script and access the files without being logged in. Suggestion or help is much appreciated
The script that I am using is from http://php-login-script.com
Password Protect a file/folder
Moderator: General Moderators
-
computerikon
- Forum Newbie
- Posts: 3
- Joined: Thu Feb 10, 2011 8:46 am
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Password Protect a file/folder
The safest way to do this is put all your videos beneath the document root, and serve your video's through a php script which checks if they are authenticated, and if they are, serve the file through readfile() + appropriate header()'s
-
computerikon
- Forum Newbie
- Posts: 3
- Joined: Thu Feb 10, 2011 8:46 am
Re: Password Protect a file/folder
Thanks for the reply John,
Would you know where I could find such a script at? Or something that i could work off of. I have been learning web code all on my own, so it has been a rough ride so far.
Would you know where I could find such a script at? Or something that i could work off of. I have been learning web code all on my own, so it has been a rough ride so far.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Password Protect a file/folder
I don't know of any scripts... take a look at readfile(), which has a ton of good examples on using it to serve as a download script.
-
computerikon
- Forum Newbie
- Posts: 3
- Joined: Thu Feb 10, 2011 8:46 am
Re: Password Protect a file/folder
Thanks John, I will look into that.