Log in

View Full Version : Code needed to stop opening php files directly



NairB
06-17-2007, 06:48 AM
Hi everybody,

I am looking for a simple code to put on a php file that will stop people bypassing my forum and opening the file. I want them to join forum first to view file but if they knew the URL, they could simply type that in without joining and see the content....:(

Here is my link and as you can see opens...

http://www.yamahabikersforum.com/videogallery.php

Many thanks peeps :o

-NairB

djr33
06-18-2007, 09:57 PM
That would require a login check. If they are logged into the forum, allow access.

Depending on how the board works, it probably will be some use of mysql/php/sessions/cookies to check if they are, in fact, logged in.

Integration directly with the board might be very complex, especially if you can't figure out the details of how the sessions work, so you might want to create a mirror login system just for that page, using the same database (meaning same user accounts and passwords), and then you would be able to let them login just for that page, but still require an account.

NairB
06-20-2007, 02:49 AM
Thanks for yur reply djr

I could look at what you suggest but I was thinking along the lines of using include & htaccess somehow to do this.

How would I go about doing so, what is include & htaccess and where would I put these on my forum??

Any ideas.....its all still very new to me.

thanks

NairB

alexjewell
06-20-2007, 03:21 AM
.htaccess has nothing to do with the PHP.
Include just includes other PHP files in a PHP file...

There is a way to do it with .htaccess, though...
http://tools.dynamicdrive.com/password/