Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts

    Passwording a dir with MySQL Db?

    OK I have a few perl scripts in my cgi-bin. I want to move away from htaccess and try to password them using a MySQL Db where each client has their own data in the Db.

    1. Is it possible to protect a directory in this way and,

    2. Having 'logged in' to script 1 and they then want to go to script 2 how can I ensure that they do not need to log in again. SessionID's perhaps (gulp), but is it possible to pass a value, on login from a field in the Db record, exclusive to each 'logged in person', which would change every hour automatically or after they have been inactive (logged out) for more than 2 mins?

    perhaps there is a way to store usernames and passwords in a MySQL Db which htaccess can use?

    Any pointers appreciated

    bazz

  • #2
    Regular Coder
    Join Date
    Jan 2007
    Posts
    213
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Firs tof all sessions would be yourr best bet, you could use mysql but that would mean a call on every page to first check if they are within the time scale and second to set the time on the user, two un-needed sql commands when you can just use sessions which timeout anyway plus they carry on through all the pages.

    as for the password a directory yes it is possible, I myself dont use .htaccess to password folders, instead on every file in that folder I call a function called checklogin() which checks the session variable, if there isn't one they get redirected to the login page.
    Matthew Bagley
    Paramiliar Design Studios
    Website Design | Website Development | Search Engine Optimisation (SEO)


  •  

    Posting Permissions

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