Announcement

Collapse
No announcement yet.

Simple password protection for section

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

    Simple password protection for section

    Any advice as to the easiest way to put a simple password protection on a shop section? I don't want to institute full user accounts, just ask for a single simple password entry to get into the page (it doesn't have to be terribly secure either, just a psychological barrier!).

    I've played with a couple of versions of using a simple javascript on entry, but for some reason although these work fine in Firefox they don't seem to work in IE (in the full uploaded online version not just the page previews where I know there are issues with js).

    Has anybody got a simple script or other solution that you know has worked that just invites a password entry before taking the user into the page? All suggestions gratefully received!

    #2
    Have a look here - password protection using .htaccess

    Comment


      #3
      A couple of years back I password protected a couple of pages by adding a few lines to the .htaccess file.

      See an example of the code below:

      Code:
      AuthName "Restricted Area" 
      AuthType Basic 
      AuthUserFile /home/username/.htpasswds/.htpasswd 
      AuthGroupFile /dev/null 
      <Files section8.html>
      require valid-user
      </Files>
      I cannot remember much about it so you would probably need to search around on the net for further details of the above code.
      Darren Guppy
      Golf Tee Warehouse
      Golf Tees and Golf Accessories.

      Comment


        #4
        Thanks Grant, but that method seems to be to password protect a full folder rather than a single page - or can I put an Actinic shop section into a sub-folder? I didn't think that was an option.

        Comment


          #5
          It is possible to only password protect a single page as that is what I did in my situation.
          Darren Guppy
          Golf Tee Warehouse
          Golf Tees and Golf Accessories.

          Comment


            #6
            Thanks Darren, googling on the .htaccess solution I see you can do it for individual pages. New problem though - it's for Apache servers and I'm using Windows so I don't think it will work for that environment

            Comment


              #7
              Although I do have a way of password protecting a sub-folder on the Windows server, but not individual files - so is it possible to put the section page in a sub-folder??

              Comment


                #8
                Why not set up customer account?
                Alan Johnson

                Quality Parrot Cages & Accessories by Parrotize UK
                Pet Accessories by Animal Instinct

                Comment


                  #9
                  Alan, my understanding is customer account pre-fills with address details etc - I just want to use a simple single password that everyone can use with the same password to access a specified page. Definitely don't want to get involved in pre-allocating usernames and passwords etc.

                  Comment


                    #10
                    You could set up a single guest account with dummy name & address which the user can overwrite. It is not prefect but gives you access control.
                    Alan Johnson

                    Quality Parrot Cages & Accessories by Parrotize UK
                    Pet Accessories by Animal Instinct

                    Comment


                      #11
                      Thanks Alan - but was hoping for something simpler that just gives access to a page.

                      I don't understand why the javascript solutions don't work in IE - unless they're conflicting with something in the js files that Actinic loads anyway.

                      Comment


                        #12
                        OK I think I cracked it! Keeping the javascript really simple, I've got a script file as follows:
                        Code:
                        function login(form)
                         {
                        if (form.password.value=="passwd")
                        {
                        location="http://www.sunglass-show.com/"
                        }
                        else 
                        {
                        alert("Invalid Password")
                        }
                        }
                        Then just a simple form in the page with input box called 'password':

                        Code:
                          <form id="form1"  name="login-form">
                          Enter your password here: <input name="password" type="password" size="20" />
                          <input type="button" value="Login" onclick="login(this.form)" />
                          </form>
                        Nothing fancy but it seems to do what I was after.

                        Thanks everyone for the suggestions!

                        Comment

                        Working...
                        X