# How to setup so user has to enter password to view site using Dreamweaver



## senna (May 2, 2002)

I am using Dreamweaver MX. I am wanting to setup a site that when a user types in the URL it comes to a page that the user has to enter a username and password in order to go beyond that page. I don't know anything about PHP or server-side or anything. I was hoping there was something in Dreamweaver, maybe even behaviors, that will allow this to happen. I was wanting to be able to enter peoples names into a database within Dreamweaver and if the person who types things in doesn't type the right username or password then they don't get in. 

Please help me in getting the accomplished.
Thanks,
Senna


----------



## MMJ (Oct 15, 2006)

There have been many threads like this in this forum. Have you tried a search?


----------



## senna (May 2, 2002)

MMJ,
Thanks for your reply. 
I did go to search before I posted but everything I read talked about PHP and server-side. Things I have no idea about. I was hoping I could find something where I could just add usernames and passwords to a script or even a Dreamweaver Behavior. I'm do know how to use Dreamweaver but when it comes to PHP or server-side stuff I am totally lost. 
I also did a google search but couldn't really find anything..

thanks again for your help,
Senna


----------



## MMJ (Oct 15, 2006)

Dreamweaver isn't like a language or anything, it uses languages like html, css, php, asp, etc.

If you want to put a password you will have use server side (php, asp), client side (js, vbs), or with .htaccess

which one do you want?


----------



## senna (May 2, 2002)

MMJ, thanks again for the reply. 
I do know that Dreamweaver _uses_ languages and that it is not a language itself. My problem is I don't know anything about css, php, or asp. I do know HTML. I think when I wrote dreamweaver behavior I meant to say javascript behaviors that are within dreamweaver. Like forms, roll-over images etc. That was my fault as I miss spoke.

I am trying to find client-side. Lke javascript or something. Was hoping that I might be able to find a script or somehting that I could copy and make username and password modifications to fit the people I need to allow access too. 
I am actually trying to help someone else set this up on there webpage and not my own. Not sure how many names they will be using.
I hope this makes since.

Thanks again.
Senna


----------



## MMJ (Oct 15, 2006)

Client side would be way easy to bypass since you can turn js off and also you can view the source. You should either use php or .htaccess.

If only a small amount of people are going to signin then you can use that php that is posted in other threads or else you might want to get a forum or CMS.


----------



## knight_47 (Mar 15, 2006)

Hello Senna,

If you want something client side, you can try this, though it is not recommended for it is pretty easy for a computer savvy guy to bypass this.

Another easy one, and very secure one is using your .htaccess file, click here to start.

But if you still want to use PHP, you first need to make sure your host supports PHP.

Once you can confirm that, you can try a simple password script like this that I wrote. If you notice, this one only needs a password, if you want it to use a username AND a password, simply edit this line:


```
if ($_POST['Submit'] AND $_POST['pass'] == "admin")
```
to this:


```
if ($_POST['Submit'] AND $_POST['pass'] == "admin" AND $_POST['username'] == "username")
```
You just need to make sure that the username field is called username, and the password field is named admin. (You said you know html, so you should know what I'm talking about)

Hope that helped, and feel free to ask more questions if I didn't make sense.


----------



## MMJ (Oct 15, 2006)

Thanks knight.


----------



## senna (May 2, 2002)

Thanks for your replies!
I went to http://tools.dynamicdrive.com/password/
And here is where I am at:
I went to the above script and created in notepad a file named .htaccess and inside this text file is the following code:

AuthName "Restricted Area" 
AuthType Basic 
AuthUserFile www.yesterdaysneuz.com/.htpasswd 
AuthGroupFile /dev/null 
require valid-user

I then created in notepad another text file called .htpasswd and inside that text file is the following text:

Rob:wEELa87Gj.gRg

__________

Part of my problem is I am not sure what to put for this line:
AuthUserFile www.yesterdaysneuz.com/.htpasswd

my website is www.yesterdaysneuz.com. It is being hosted by GoDaddy so I am really not sure what my exact path is. I know it should look something like: /home/site_name/. But I am not sure what should go in the "home" spot.
I think in the site_name should be "www.yesterdaysneuz.com" Is that right??

Ok, after I created these two text files I uploaded them to my GoDaddy account. Am I suppose to create any type of form fields for them? I thought I could create these files and then it would be like a Windows prompt???

Thank you for your help.

Senna


----------



## knight_47 (Mar 15, 2006)

^^ did it work?


----------



## senna (May 2, 2002)

knight_47,
No it did not work. Any idea what I did wrong??


----------



## knight_47 (Mar 15, 2006)

Hello Senna,

The problem is here where you thought:

AuthUserFile www.yesterdaysneuz.com/.htpasswd - this is wrong, you just need your site's directory only.

try this instead:

AuthUserFile /public_HTML/

Also, there is no need to create a form, it should do that by it's self, for an example, click here, that's how it should look like.


----------



## senna (May 2, 2002)

knight_47,
thanks for your patients!
Ok, I'm still doing something wrong as that didn't work

my .htaccess file now looks like this:
AuthName "Restricted Area" 
AuthType Basic 
AuthUserFile /public_HTML/
AuthGroupFile /dev/null 
require valid-user

And my .htpasswd file looks like this:
Rob:wEELa87Gj.gRg

I have also done a screen capture from my dreamweaver. I'm sure I miss understood about the AuthUserFile /public_HTML/ line. Maybe I was suppose to put something else there. I know you said I just need your site's directory only. But not sure what that exactly is. In my screen capture I put my mouse over where it says "site- yesterdaysneuz (C:\Documents and Settings\Rob\My Documents\Websites\Yesterdaysneuz website) "

Sorry that I am confused on this and thanks again for your patients!

Senna


----------



## senna (May 2, 2002)

Sorry forgot to add the file


----------



## knight_47 (Mar 15, 2006)

Oh ok I think I see the problem, the problem is in the naming you gave the files, it should not be .htaccess.txt it should be .htaccess only! Your computer might prevent you from having just an extension, without a name, so you can just upload the file and remove the .txt while it's on your server.


----------



## senna (May 2, 2002)

Ok, I'm starting to go crazy here. I know it shouldn't be as difficult as I am making it.
I took off the file extensions as you said. They are now unassociated files. I changed them on the server and then changed them locally, deleted what was on the server and then reuploaded them. Just to make sure they were without the .txt extension. They appear to be.
I have included another screenshot and put the files open in notepad in the picture so you can see what is inside each. 
Again, sorry for the lack of understanding and still appriciating your patients! 

Senna


----------



## knight_47 (Mar 15, 2006)

Ok, are the two files, inside a folder? if they are, they shouden't be. If they are not in a folder, and still not working, most likely the problem is line is wrong, and needs to be fixed:

AuthUserFile */public_HTML/*

The bold is what I'm also not so sure about, maybe someone else can help me here...

Where do you host your site?? Do they have a cPanel?


----------



## senna (May 2, 2002)

knight_47,
Ok, I think I am geting somewhere. I tried it on another page I have www.robneuzel.com
The code works but when I type in the username:test password: test it doesn't allow access to the page.

Another screenshot attached.

Thanks again for all your help.


----------



## knight_47 (Mar 15, 2006)

Hm.. Are you sure you set it up on the site so that the username is test, and the password is also test?


----------



## senna (May 2, 2002)

knight_47,
I went to http://tools.dynamicdrive.com/password/ and went through and created the script. For the usename I put in "test" and for the password I put in "test" and then copied those codes to the appropriate files. Uploaded the files to my host account. Made sure that the .txt was off of both files. Went to my webpage, the box came up and I typed in my usename(test) and my password(test) and it wouldn't go through. 
I thought I did it correct.

Senna


----------



## knight_47 (Mar 15, 2006)

senna said:


> knight_47,
> I went to http://tools.dynamicdrive.com/password/ and went through and created the script. For the usename I put in "test" and for the password I put in "test" and then copied those codes to the appropriate files. Uploaded the files to my host account. Made sure that the .txt was off of both files. Went to my webpage, the box came up and I typed in my usename(test) and my password(test) and it wouldn't go through.
> I thought I did it correct.
> 
> Senna


Hm... Who's your host? Like where do you host your site?


----------



## senna (May 2, 2002)

My host is www.godaddy.com. They host the site. I've looked through the control panel in my account and didn't see anything to change. But then I may have seen something and not realized it either.

Senna


----------



## Squashman (Apr 4, 2003)

Read this.
http://www.issociate.de/board/post/...taccess/htpasswd_security_on_GoDaddy.com.html

My other thought is are you sure you are using an Apache web server for you website. I do believe Godaddy offers windows based hosting but I could bewrong.


----------



## MMJ (Oct 15, 2006)

No, the site is hosted on apache. 

http://www.yesterdaysneuz.com/sdfsdf/

Look at the bottom.


----------



## senna (May 2, 2002)

Thanks for your replies.
Squashman, I did go to that link and try changing the code to that but it didn't seem to work.
Again, here are my two files.

.htaccess
AuthName "Restricted Area" 
AuthType Basic 
AuthUserFile /public_HTML/ 
AuthGroupFile /dev/null 
require valid-user

.htpasswd
test:M/oIBvvHXC33Y

Thanks,
Senna


----------



## MMJ (Oct 15, 2006)

okay, I think I know what is wrong. you should have a full path next to AuthUserFile.

For example:

AuthUserFile /home/SITENAME/public_html/.htpasswd


----------



## senna (May 2, 2002)

MMJ,
I changed the file and am still having the same problem.

Here is my code. Maybe I still put the wrong path in.

.htaccess
AuthName "Restricted Area" 
AuthType Basic 
AuthUserFile /home/www.robenuzel.com/public_html/.htpasswd

AuthGroupFile /dev/null 
require valid-user

.htpasswd
test:M/oIBvvHXC33Y

Under the .htaccess I also tried
AuthUserFile /home/robenuzel/public_html/.htpasswd 
and that didn't work.

Thanks for your help,
Senna


----------



## MMJ (Oct 15, 2006)

Do you have cpanel?

If not what is the editor that comes with godaddy's cpanel?

please take a screentshot. use prntscrn, paste it in paint.


----------



## senna (May 2, 2002)

MMJ,
Not sure about cpanel. I went to godaddy and did a search for cpanel and I have attached what it said. 
I don't use a server(besides having godaddy host it) so I am not sure about that. All I do is use Dreamweaver to create the site and upload it to my godaddy account. 

Also, trying to access my cpanel it is saying I need a "IP address for your dedicated server." If I don't have the server, where would I find that? 

Again, thank you for your patients!

Senna


----------



## Squashman (Apr 4, 2003)

senna said:


> Thanks for your replies.
> Squashman, I did go to that link and try changing the code to that but it didn't seem to work.
> Again, here are my two files.
> 
> ...


Everything I read on the Internet and on GoDaddy's website tells me you have the AuthUserFile path wrong. I have helped people solve this issue in the past. And 9 times out of 10 it is their AuthUserFile path.

http://help.godaddy.com/article.php?article_id=91&topic_id=78&&


----------



## MMJ (Oct 15, 2006)

The AuthUserFile is wrong, the problem is finding out the sites name.

I know it tells you in cPanel's editor.

@senna: Log into your sites admin panel, go to file manager, edit a file then take a screenshot.


----------



## senna (May 2, 2002)

I have logged into my account 
and have taken the attached screenshot. This is a screen shot from Domain Management page. I thought the WSC2.JOMAX.NET might mean something. I did a google search of that and it showed me that it is associated with the IP 68.178.211.104
But when I used this to try and access my cpanel it didin't work. I went to my and typed in the following URL https://68.178.211.104:2087 and received the "page cannot be found".

I will try squashmans link as well.

Senna


----------



## MMJ (Oct 15, 2006)

try

AuthUserFile /home/robneuzel/public_html/.htpasswd 

This SHOULD work try it carefully.


----------



## senna (May 2, 2002)

I tried it very slowly and carefully.  Stil lthe same issue. I went back and recreated the script through dynamicdrive just to make sure. I've attached another screenshot. 
Sorry for all of this. It is driving me NUTS!!


----------



## MMJ (Oct 15, 2006)

Same here!

You have the .htaccess AND .htpasswd IN THE SAME FOLDER *IN public_html*?


----------



## senna (May 2, 2002)

I have attached two screenshots! One showing locally and one showing where they are located on the Remote side. Am I suppose to create a folder locally called public_html and then put the two files in there and then upload that under the "/" folder on the remote side? 
Maybe this is my whole problem. But if it was, I would think that when you go to the site you wouldn't see the log in box.
Thanks again,
Senna


----------



## Squashman (Apr 4, 2003)

You normally would not put the .htpasswd file in your public html folder. You would normall put outside of your html directory. One directory above your html folder.

Your Auth_User file is still wrong according to GoDaddy's instructions.


----------



## MMJ (Oct 15, 2006)

They are both in the same folder right?

If so create a new folder under "/" and call it test or whatever.

Create a .htaccess and .htpasswd file in it and put:


.htaccess
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /home/robneuzel/public_html/test/.htpasswd 
AuthGroupFile /dev/null
require valid-user

.htpasswd
test:M/oIBvvHXC33Y


----------



## senna (May 2, 2002)

OK, I'm just going to spend a little longer on this and if I don't get it then will just have to tell my friend that I can't get it.
I've attached the latest. squashman, I did try the script like godaddy suggest. I've got a screenshot of it(attached). The file .htaccess1 is just a file that has the original script I have been using. The .htaccess file has what godaddy suggests.

Thanks again for the great patients. 

Senna


----------



## MMJ (Oct 15, 2006)

That .htaccess file is messed up. Why does it say /t/e/s/test?


----------



## senna (May 2, 2002)

Squashman had provided a link to an article that tells you how to setup a .htppasswd. I tried it just to see if it would work.
http://www.issociate.de/board/post/...taccess/htpasswd_security_on_GoDaddy.com.html

I'm pretty sure I have everything in the correct folders. It's just gotta be that one line

Senna


----------



## Squashman (Apr 4, 2003)

And you read this link on GoDaddy's website which I posted earlier.
http://help.godaddy.com/article.php?article_id=91&topic_id=78&&

Did you run the script they suggest to find the path to your folder?

I am assuming you just put in test because you don't want everyone to know what your username is on the system?


----------



## Squashman (Apr 4, 2003)

Did you finally give up?


----------



## senna (May 2, 2002)

squashman,
Thanks for the reply. With work, I have been really busy lately. I found a program http://www.mtopsoft.com/htmllock/ that I tried last night. It worked perfect! It was very easy to setup and seems very secure. You can go to www.robneuzel.com and see. I was going to post this morning with a progress up date.

Thank you to all that beared through this with me. I greatly appriciate everyones help. That's what makes this forum the best on the net.

Thank you again,
Senna


----------



## MMJ (Oct 15, 2006)

Great, you can mark this solved than.


----------



## Squashman (Apr 4, 2003)

So all that uses is a password to login. Doesn't seem that secure to me. A username and password combination would be much better. I am still pretty convinced you had the Authuser file wrong in your htaccess file.

The very first website I ever built, I used .htaccess. Then I had a cgi script that the administrator could run to add users to the .htpasswd file and change a users password. Normal Users could also change their password with the cgi script. It was pretty darn slick.

It seems to work and will probably keep out the normal person from getting into your site, but give me a day or two and I think I could find my way in.


----------



## MMJ (Oct 15, 2006)

It also uses javascript which also isn't too secure.

But like you said later on: "It seems to work and *will probably keep out the normal person from getting into your site*"


----------



## senna (May 2, 2002)

Thanks guys. I think you are correct that it is secure but may not be the most secure. I'm doing this for a friend who is starting a website for her neighborhood. So, security is an iue but not that big of one. If that makes since. She is not going to put any house values or anything on it. Actually, not really sure why she wants the security but she does and I thought I would help. What is interesting is that when setting it up it allows for a usename and password but when ran only the password field shows up. I did it last night so I still paln on doing alot more tinkering with it tonight or in the next several nights. 

I just want to say again that I really do appriciate your help on this!

Rob Neuzel


----------

