Web Analytics Made Easy -
StatCounter Password Protect with PHP? - CodingForum


No announcement yet.

Password Protect with PHP?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Password Protect with PHP?

    Alright so I've got a csv file stored on my server that contains sensitive information. Its a csv file because I have a script that currently writes and adds to it, and its easy to open and read in any spreadsheep application. Anyway, how can I protect this csv file with a password? I've been told that I could use a php page or script that would prompt for a user and password to prevent someone from accessing the file who shouldn't be.

    So, could someone point me in a direction where I could find something like this or perhaps an alternative or more safe way of doing so. Currently the file is on a secure server protected by ssl, but it can still be accessed by anyone.

    I'm pretty much a beginner right now and don't know anything about mysql, which is why i'm not using it.

  • #2
    Since it is just you that needs to access it then it would probably be easier to just use an .htaccess file in conjuction with a .htpasswd file to password protect it. Just put the .csv file in its own directory and put the .htacess file in there with the approriate code as well as set up your .htpasswd file and put it in a non-web accessible directory. This will only work though if you are running Apache on your webserver.
    CodingForum Supreme Overlord
    All Hail Spookster