Web Analytics Made Easy -
StatCounter Protecting .txt files - CodingForum

Announcement

Collapse
No announcement yet.

Protecting .txt files

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Protecting .txt files

    Is there a way of stopping a viewer from looking at .txt files yet still aloowing a PHP script to acces them? In case it matters I'm using Easyphp as my server, I think it's got Apache in it.

  • #2
    Hey

    What about chmodding them to 755, then the user wont be able to access them.

    Just a though as we used to do that with perl.

    Pete

    Comment


    • #3
      Best way is to upload your txt file above your document root, and then just using an include() to get the file.

      ie

      /var/username/public_html

      upload your txt file to

      /var/username

      then use include() to get the file using

      include("/var/username/file.txt");

      No one can get that file without hacking

      Comment


      • #4
        ygrouk;- I'm not sure but will that mean that my PHP scripts won't be able to acces the files? I'm a little hazy on the subject of CHOMDing

        Nightfire; sounds good. I'll try that tommorw

        Comment


        • #5
          your php file will still be able to acces the file but the browser will not be able to

          Comment

          Working...
          X