Is there a way to password protect HTML pages without using a server side language?

后端 未结 10 1611
情深已故
情深已故 2021-01-14 14:36

I have a series of interlinked web pages, and I want to restrict access to these pages by asking the user to provide a login and password. However, my hosting account curren

相关标签:
10条回答
  • 2021-01-14 15:01

    You can create a file .htaccess with something like this :

    AuthUserFile path/to/password.txt
    AuthGroupFile /dev/null
    AuthName "Acces Restreint"
    AuthType Basic
    <Limit GET POST>
    require valid-user
    </Limit>
    

    You then have to create the .htpasswd file.

    0 讨论(0)
  • 2021-01-14 15:02

    I don't know about client side scripts but you can use the web server to restrict access to your site.
    In IIS you can use "directory security" tab settings: configure IIS Web site authentication

    0 讨论(0)
  • 2021-01-14 15:03

    If there was one and only one password for EVERYbody, you could try a public key-type approach. You could provide a simple script for performing RSA decryption (you'd need to do the original encryption somewhere where you have access to some type of programming software). Then, you could supply the content as an encrypted string. You'd display a password box, the user would type the password,then the string would be decrypted according to the password. If the password is correct, the string will decrypt correctly, and the page will show. Otherwise, the page will look like a bunch of garbage. Be careful, though, because this client-side method would be very vulnerable to brute-force.

    0 讨论(0)
  • 2021-01-14 15:03

    Or you could use a cryptic html-filename as the password and ajax in / browse to that page if it exists :-)

    Just as secure (or unsecure) as the other suggestions, but probably easier to implement.

    0 讨论(0)
提交回复
热议问题