469,657 Members | 1,825 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,657 developers. It's quick & easy.

pasword

I am trying to have a link from my page to another page which requires a
password so that only certain viewers have access.

How can this be done - I know this may not be a java question but I thought
that I would give it a shot.

Thank you
Nov 13 '06 #1
6 1033
prophet said the following on 11/12/2006 10:59 PM:
I am trying to have a link from my page to another page which requires a
password so that only certain viewers have access.

How can this be done - I know this may not be a java question but I thought
that I would give it a shot.
<form id="myForm">
Password:<input name="password">
</form>
<button onclick="goThere()">Go There</button>

function goThere(){
location.href=document.myForm.password.value + '.html'
}

Then, the password is the name of the file. If they want to get to page
myPage101.html, they put myPage101 in and it goes......

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 13 '06 #2
google for "basic authentication apache" its all done server side, no
client scripting required. its not SSL, but it works for low security
sites, and the password can only be sniffed or bruteforced.

Nov 13 '06 #3
ASM
prophet a écrit :
I am trying to have a link from my page to another page which requires a
password so that only certain viewers have access.

How can this be done - I know this may not be a java question but I thought
that I would give it a shot.
Easiest :

<form action="javascript_needed.htm" method="get"
onsubmit="location='myFolder/'+pass.value+'.html';">
<p>Enter password here :
<input name="pass" type="password" />
and hit touch Enter</p>
</form>

All what you have to do is to name your html file with password
and to place this file in your folder 'myFolder'.

password = 'toto';
file = toto.html

If password is not correct, the visitor will be redirected to the 404
page of server (Page not found)
Better :
use server-side way with : htaccess

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Nov 13 '06 #4
Lee
ASM said:
>
prophet a écrit :
>I am trying to have a link from my page to another page which requires a
password so that only certain viewers have access.

How can this be done - I know this may not be a java question but I thought
that I would give it a shot.

Easiest :

<form action="javascript_needed.htm" method="get"
onsubmit="location='myFolder/'+pass.value+'.html';">
It's dangerous practice to pull the page out from under a form
submission like that. Just use an input button.
--

Nov 13 '06 #5

"prophet" <M_*****@hotmail.comwrote in message
news:V4S5h.296951$5R2.107323@pd7urf3no...
>I am trying to have a link from my page to another page which requires a
password so that only certain viewers have access.

How can this be done - I know this may not be a java question but I
thought that I would give it a shot.

Thank you
So here is what I received from someone and it works ok.

I know that this is going to be so simple to fix, but I have been pulling my
hair out trying to see the forest through the trees......

What I want to do is change the onMouseOver so that when you click on
'ENTER', it goes to the gatekeeper, not just by running the mouse over it.

Thanks,
<HEAD>
<!-- Begin
var nifty_little_window = null;
function gateKeeper() {
nifty_little_window = window.open('gatekeep.html', 'theKeeper',
'width=350,height=200,resizable=1');
}
// End -->
</SCRIPT>
</HEAD>

<body>
<td width="70">
<p align="center"><A HREF="" onMouseOver="gateKeeper()"
class="navgreen">ENTER</A></td>

</body>


Nov 13 '06 #6
prophet said the following on 11/13/2006 4:33 PM:
"prophet" <M_*****@hotmail.comwrote in message
news:V4S5h.296951$5R2.107323@pd7urf3no...
>I am trying to have a link from my page to another page which requires a
password so that only certain viewers have access.

How can this be done - I know this may not be a java question but I
thought that I would give it a shot.

Thank you

So here is what I received from someone and it works ok.

I know that this is going to be so simple to fix, but I have been pulling my
hair out trying to see the forest through the trees......

What I want to do is change the onMouseOver so that when you click on
'ENTER', it goes to the gatekeeper, not just by running the mouse over it.
Change it from onmouseover to onclick="gateKeeper();return false"

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 13 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.