Website passwords

Started by Jesse, January 05, 2006, 17:21:31

Previous topic - Next topic

Jesse

I want to upload some photos onto my website which I would prefer to password protect, they're family pictures that include my children and don't want unwanted guests browsing them. Some parts of my website I'd like to keep password free but other parts, e.g. the photos, I'd like to have in a folder that cannot be viewed unless the person has the correct password.

How do I password protect certain folders, I use Dreamweaver 4 for publishing the website. Can anyone help? :)
Green fingers are the extension of a verdant heart - Russell Page

http://www.news2share.co.uk

Jesse

Green fingers are the extension of a verdant heart - Russell Page

http://www.news2share.co.uk

glow777

Never used DW as I hand code websites as part of my job, but a basic password protected page can be done with JavaScript. There are plenty of free scripts available just look on google. However Javascript isn't amazingly secure wouldn't use it for anything really "top secret"
A more advanced password can be setup if your webspace supports Php again google for the code.

HTH Ian

Jesse

Ian, I've managed to find something called htaccess so am trying to get my head around that at the minute. It's nothing top secret, just don't want unwanted visitors having a nosey around my family photographs. :)
Green fingers are the extension of a verdant heart - Russell Page

http://www.news2share.co.uk

Travman

for a simple javascript password section you could use cut and paste the following the following.
Just edit it to your own password , I.D  and target.
In this example the I.D is big, the password is plant the target page is google

<script language="javascript">
<!--//
/*This Script allows people to enter by using a form that asks for a
UserID and Password*/
function pasuser(form) {
if (form.id.value=="big") {
if (form.pass.value=="plant") {             
location="www.google.com"
} else {
alert("Invalid Password")
}
} else {  alert("Invalid UserID")
}
}
//-->
</script>

<center>
<table bgcolor="white" cellpadding="12" border="1">
<tr><td colspan="2"><center><h1>Login
Area
</h1></center></td></tr>
<tr><td><h1>UserID:</h1></td><td><form name="login"><input
name="id" type="text"></td></tr>
<tr><td><h1>Password:</h1></td><td><input name="pass"
type="password"></td></tr>
<tr><td><center><input type="button" value="Login"
onClick="pasuser(this.form)"></center></td><td><center>
<input
type="Reset"></form></td></tr></table></center>





Travman

If you want a better but more difficult program look on this page
http://www.javascriptkit.com/script/cut34.shtml

Jesse

Travman, thank you so much for the coding. I think I might have found the solution, I'm getting as far as being prompted for the password but now it won't accept my encrypted password, grrrr! Anyhow, the pages I want to encrypt are photos (jpg files) and a html file, not sure your coding will work on the photos? Thanks :)
Green fingers are the extension of a verdant heart - Russell Page

http://www.news2share.co.uk

glow777

Hi
The code supplied by travman should work fine and you should be able to alter the look of the text in DW.

However the web address for googole should be "http://www.google.com" not "www.google.com" as www.google is an absolute link not a relative link ie not in the same directory as the page you are linking from.

Not sure what yo mean about encryption as there is no encryption here just a password that would let you access another web page. If you are hyperlinking directly to the images it would be easier to hyperlink to a page that contains the images rather than the images themselves.

Failing all this you could paste the pics into a word document and pdf the document using a freeware pdf app (lots on google) and password the pdf. This may suit you better as you could make a photo album that your relatives could download and view at their leisure or look at online.

Finaly the code supplied would suit your needs but anyone who can view the source code would be able to find the password, so nothing too "top secret"

HTH Ian

Jesse

Thanks Ian. The encryption i'm talking about is using .htpasswd and .htaccess files, nothing to do with what travman posted. :)

I'll look at it all again tomorrow when I have some more time, this is all very confusing for me! :)
Green fingers are the extension of a verdant heart - Russell Page

http://www.news2share.co.uk

Jesse

Fantastic Travman, I managed to get your script to work, thank you thank you thank you! :-* :D
Green fingers are the extension of a verdant heart - Russell Page

http://www.news2share.co.uk

glow777

Jesseveve
You may find the following article useful in stopping search engines indexing the pages you want to be accessed via the password.

http://www.g4tv.com/screensavers/features/47579/Leos_Tip_Stop_SearchEngine_Spiders.html

Ian

Jesse

Thanks Ian, I'll take a look in a minute.

Just a question hoping someone can help. I've created a page with the script below, and it all works well and asks for password etc before forwarding me to the html file that contains the photos and stuff. Now have I done this wrong, because if someone knows the url of the html file that contains the photos (i.e. not the url of the html file that contains the login details) it can be viewed without being prompted for the password. Should the script be contained in the same html page as the photos? I did try it that way, but the login box appears, as it should, but all the photos are there visible on the page below the login box.

I'm beginning to think passwording the pages is too much trouble :-\
Green fingers are the extension of a verdant heart - Russell Page

http://www.news2share.co.uk

glow777

The script needs to go in the page that links to the picture page.

Anyone who knows the URI of the page would be able to go directly to it using the JScript code.

This is why you dont want the picture page to be indexed by google etc. And also why it souldn't be called something obvious such as "mytopsecretpictures.htm"

Ian

Travman

jscript  coding is not completely secure as Ian as said.
Ian is correct in saying call the photo page something so obscure that you chances are you would not randomly guess it also search engine may not pick it up.

Just remember this on  internet safety with  photos.
--Avoid posting names of children and do not  post a address--
There Willl always be someone who wil be able to hack in to a method you have running.

Just one other point. Who are you using as your host ?.Most web hosts allow you to password protect pages direct from your host account and will be a secure and manageable then any other method.

Jesse

I can use Tiscali (my ISP) but would prefer not to or I can use the place where I buy website names from (Virtual Names).

If someone knows my website address e.g. www.myweb.com can they do some sort of search to find all the files and folders within that website, like getting a list of directories and files like you can do in DOS for files stored on the hard drive.

I plan to use initials in place of childrens names and I won't have an address listed.
Green fingers are the extension of a verdant heart - Russell Page

http://www.news2share.co.uk

glow777

If you dont include an index.htm or default.htm file in each directory just browsing the directory could display a list of files. As soon as someone with some web design knowledge comes across a JScript password they will look at the source code.

In the case of the example you are using they will see the webpage the script points to.

I have a script somewhere at work where the password is the name of the page and therefore isnt needed in the code.

eg if the user types in hello they will be taken to hello.htm if the file doesnt exist they'll get 404 not found.

I can look this out for you but I'm off work until Wednesday

Ian

glow777

Found it look at

http://javascript.internet.com/passwords/

and scroll down to the "gatekeeper script"
the page gives all instructions and an example (which you have to use to get to the page with the source code)

Ian

Travman

Quote from: Travman on January 05, 2006, 20:56:10
If you want a better but more difficult program look on this page
http://www.javascriptkit.com/script/cut34.shtml

This link i posted ealier is the also the gate keeper program. As ian as said it is a lot better but i found  more difficult to set up.

glow777

Sorry Travman hadn't realised Id duplicated your link - at least it shows we agree on it then!

Ian

Jesse

I'm trying the gatekeeper link now so most probably will have some questions later!

Can I use the gatekeeper script to protect more than one html file, where you put in the file name, can I add more than one file name?
Green fingers are the extension of a verdant heart - Russell Page

http://www.news2share.co.uk

Jesse

 ;D ;D I got it to work! Thanks both of you :-*

Now I'm going to take a look at the spiders thing to stop my pages from being indexed. :)
Green fingers are the extension of a verdant heart - Russell Page

http://www.news2share.co.uk

Powered by EzPortal