Results 1 to 4 of 4

Thread: Code needed to stop opening php files directly

  1. #1
    Join Date
    Mar 2007
    Posts
    38
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Smile Code needed to stop opening php files directly

    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

    -NairB

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    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.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Mar 2007
    Posts
    38
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    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

  4. #4
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    .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/
    Thou com'st in such a questionable shape
    Hamlet, Act 1, Scene 4

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •