SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast escocia1's Avatar
    Join Date
    May 2001
    Location
    oaxaca, mexico
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Form input processing

    Using .htaccess i have a password protected folder online containing 7 files with one single user/pass combination.
    User is not allowed to see that 7 files are available.
    User enters 1 of 7 "Access Keys" in a simple HTML Form text input which is then processed (script?)
    User is then redirected automatically to the related file (for download) e.g.
    Access Key #1 redirects user to Protected File #1
    Access Key #4 redirects user to Protected File #4
    etc.

    What's the best way to implement this? Perl/CGI? PHP? Javascript?
    David Sutherland

  2. #2
    SitePoint Evangelist stonedeft's Avatar
    Join Date
    Aug 2009
    Posts
    589
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    go for the simplest solution: .htaccess

    create a different .htaccess log in for each file.
    Don't Panic

  3. #3
    SitePoint Enthusiast escocia1's Avatar
    Join Date
    May 2001
    Location
    oaxaca, mexico
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Stonedeft!

    As stated above, the website visitor is not allowed to see that 7 different files are available.

    If i have 7 different .htaccess logins, how would i relate them automatically to each of the 7 files?

    e.g. Would each login be able to trigger a different page redirect to download the files?
    David Sutherland

  4. #4
    Non-Member
    Join Date
    Oct 2009
    Posts
    1,852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    just make 7 different dirs
    place .htaccess (and .htpass) into each, as well as protected files

    if you have one single user/pass combination, you can't prevent users to see other's files

  5. #5
    SitePoint Enthusiast escocia1's Avatar
    Join Date
    May 2001
    Location
    oaxaca, mexico
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no problem! i've made 7 different directories with 7 different user/pass combos which give access to the 7 different files for download.

    however, when the visitor arrives on the website, i need to direct them to the correct directory/file (relative to their access key) without showing the 7 links, it's this initial stage where i need to program a trigger of some kind relative to the "Access Key" they get via telephone.

    Would a simple HTML form and a little bit server-side code do the job?

    i appreciate your feedback.
    David Sutherland

  6. #6
    Non-Member
    Join Date
    Oct 2009
    Posts
    1,852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I can suggest some hint! No form or links needed. No access key even.
    In most cases you can pop HTTP login form from your script.
    After this you will have entered username in the $_SERVER['HTTP_AUTH_USER']
    So, you can just locate them with Header Location

    Try this code from manual, #1 example.
    http://php.net/manual/en/features.http-auth.php
    if it works, you will need only one line of code.


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
  •