Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easy way to Password a html page

Status
Not open for further replies.

tjc240e

Technical User
Nov 12, 2004
133
US
Is there an easy way to password a page?

I dont want to go through some major encryption, or some high powered programming. I just want to do something like go to an intermediate page that askes a question or two, and if you answer correctly you will go to the next html page, otherwise it goes back home or to an error page.

Anyone have anything like that that would help me??

Thanks in advance

TC in PA
 
You would need to do this on the server (using scripting: ASP, PHP, etc.). You can't do this directly in HTML (even with JavaScript). You could do it in JavaScript on the client, but the ansers to the questions would have to be visible in the JavaScript, so anyone could find them out.

[tt]_______________________________________
Roger [pc2]
The Eileens are out there[/tt]
 
Not sure why you would do this since a novice can 'view source' and view the answer.
Code:
<script type="text/javascript">
<!--//
function checkAnswer() {
    var answer = document.this_form.answer.value;
    if ( answer == '[i]INSERT ANSWER HERE[/i]' ) {
        window.location.href = '[i]INSERT URL HERE[/i]';
    }
}
//-->
</script>

<form name="this_form">
<input type="text" name="answer">
<input type="button" onClick="checkAnswer()">
</form>

M. Brooks
 
You can pseudo protect the javascript by encrypting it after it's been generated, but that would still involve using a server side language. Just Google for 'javascript encryption'.

- George
 
well ok darn it, i didnt think about that... well how would you go about using ASP or something server side?
 
You would go ask in the ASP forum (forum333) or somewhere else.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top