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 13 of 13
  1. #1
    Regular Coder
    Join Date
    Jun 2003
    Location
    hawaii.washington state
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Password Protecting One Page

    Id like to password protect a page on my site, www.ecntrcbeauty.org the treasure box page. I need the viewer, to enter a user ID and a password and then be directed to another page. I looked up javascripts for this but it said that it wasnt the best way, but only way if you dont have a CGI BIN on your domain. I have a CGI BIN, what is the best way to do this? Could anyone help me out? Ive contacted my hosting service, I was reading on one link, that you should contact your hosting service to make sure that it wont mess up your files and things like that.. Does anyone know how to do this and could help me out? Id appreciate it alot. Thanks

    ps theres nothing currently on the page because Id like to set everything up first.

  • #2
    New Coder
    Join Date
    Mar 2005
    Posts
    50
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Hi

    no Javascript won't do this.(well not if the user disables it any way)
    Can you use PHP or ASP with your host?

    how many users will need access to this page? Is is just for you to update content? Or do you want a login system where each user has to create an account before accessing your restricted content?

  • #3
    Regular Coder
    Join Date
    Jun 2003
    Location
    hawaii.washington state
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Can use PHP and Im not sure about ASP. No, my users wont need to make a user name, I will make a default user name and password that all users will type in to access this page. This page is for my son actually. Dosent seem like someone would want to password protect a page for their son but Ive seen too much stealing of pictures and claiming that its their kid or someone figuring out where you live, that type of thing. No Im not paranoid Im being cautious. Yes the interenet is big and maynot be possible but someone people are more smarter than you think. So with that said, I hope you can still help me.

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    Take a look at http://www.felgall.com/php3.php which shows a way to use PHP to password protect the content of the current web page.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #5
    Regular Coder
    Join Date
    Jun 2003
    Location
    hawaii.washington state
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hello
    I tried your password protect, I followed the directions, the login box shows, and then I added in my content and then the code that follows my content but my content showed as well as the login box.. im not sure what I am doing wrong..

  • #6
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Who is your webhost? You might be able to use htaccess. Some webhost have control panels that make password protecting easy.

  • #7
    Regular Coder
    Join Date
    Jun 2003
    Location
    hawaii.washington state
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I already talked with them through email and she recommended not to use htaaccess because it will mess up my domain. I also read up on it a few weeks ago and it also said that to check with your domain when using htaaccess because it will mess with your domain, I also used the password protection directory on my cpanel and for some reason that wouldnt work either. I did what I was suppose to and not sure why its not working. Also my domain supports PHP scripts
    Last edited by ecntrc; 12-23-2005 at 10:26 PM.

  • #8
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Mess up your domain in what way? I have been using it for quite some time now, and htaccess has worked for me.

  • #9
    Regular Coder
    Join Date
    Jun 2003
    Location
    hawaii.washington state
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Password Protecting Pages

    You should not use .htaccess to password protect because it could bring
    your entire site down.

    CPanel will allow you to protect a folder, not a single page. So what
    you can do is create a folder and upload the file to it, then protect
    that folder using CPanel.


    http://www.freewebmasterhelp.com/tutorials/htaccess/

    If she is going to recommend me not to use it Im not going to because I dont want to have problems with my site.

  • #10
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Quote Originally Posted by ecntrc
    Password Protecting Pages

    You should not use .htaccess to password protect because it could bring
    your entire site down.

    CPanel will allow you to protect a folder, not a single page. So what
    you can do is create a folder and upload the file to it, then protect
    that folder using CPanel.


    http://www.freewebmasterhelp.com/tutorials/htaccess/

    If she is going to recommend me not to use it Im not going to because I dont want to have problems with my site.
    I'll have to say whoever that is working at your webhost doesn't know what they are talking about. The best and easiest solution for your case is to use .htaccess. As a matter of fact I am almost certain when you use CPanel to password protect things it uses .htaccess to do so.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #11
    Regular Coder
    Join Date
    Jun 2003
    Location
    hawaii.washington state
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Spookster
    I'll have to say whoever that is working at your webhost doesn't know what they are talking about. The best and easiest solution for your case is to use .htaccess. As a matter of fact I am almost certain when you use CPanel to password protect things it uses .htaccess to do so.
    I asked her to explain to me why it isnt recommended to be used and what would happen, er how she would know that it would bring my site down and I also asked her what they use for their password protect. Because now Im not so sure now.

    www.netrillium.com my hosting service

  • #12
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Quote Originally Posted by ecntrc
    I asked her to explain to me why it isnt recommended to be used and what would happen, er how she would know that it would bring my site down and I also asked her what they use for their password protect. Because now Im not so sure now.

    www.netrillium.com my hosting service
    If you put an .htaccess file in your root directory with the wrong commands or with password protection you could prevent people from viewing your site. But you will know it as soon as you do it. In your case what you will want to do is create a directory that you want to protect and put the html file in that directory. You will also put the .htaccess file in that directory. This will protect all files in that directory and any subdirectories in there. The .htaccess file works with a .htpasswd file. So basically your .htaccess file provides a command to the webserver to do perform a certain action. In this case you can tell it to prevent access to this directory and prompt the user for a login. Your .htaccess file then tells the webserver to go look in the .htpasswd file for the correct login. It's pretty simple and easy. If you do a search in the forums here for htaccess you will pull up examples and instructions on how to do it and we can answer any specific questions you might have.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #13
    Regular Coder
    Join Date
    Jun 2003
    Location
    hawaii.washington state
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes that is actually what they have on my cpanel. I tried it a couple times and it didnt work. But Ive used their help desk and shes helping me out, its just the wait period until she emails me back. Thanks for your help guys. I appreciate it


  •  

    Posting Permissions

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