How do I make a simple Password field... More.

W

Wayne Davis

I want to password protect the continued running of a section of javascript.

What I need is for the user to see a login field, they type a code in, if it
is good, the script continues, if bad, it stops dead.
I would like to base the password on julian date so some example numerical
calcs (so I can see how they are structured in Java) would be handy.

Also, how do I time out a group of statements after a preset amount of time
like 1 minute or so.

I am not a Java programmer, but if examples are shown, I can usually figure
out the specific details.

THANKS in advance.
 
S

Stuart Palmer

Problem with JS passsword rotection is that someone may be able to read and
work out the password as they can grab your code even if it's calculated. I
would suggest having the password verified serverside myself.

Stu
 
W

Wayne Davis

I will be using a webpage encrypter on the html. That should protect it
sufficiently no?
 
L

Lasse Reichstein Nielsen

Please don't top post.
I will be using a webpage encrypter on the html. That should protect it
sufficiently no?

No. Any encryption where the client can decrypt the contents unaided
(as it must to use the page) can also be made to show the decrypted
page.

I bet I can break the encrypter in at most 15 minutes, if I want to
(and probably a lot faster).

/L
 
W

Wayne Davis

What is "top post"?

And when I say it is encrypted, I mean the WHOLE PAGE is an encrypted
Javascript. You can read it, but I don't think it would help you. So I
think giving me examples in plain Javascript would suffice.

Below is a sample webpage that says: "Hello There" in the middle of the
screen. This looks like it would thwart most attempts to "break" it. No?
Take a crack at it. I'll post the ORIGINAL page as (I) wrote it later.
--------------------------------------------------------
<SCRIPT LANGUAGE="Javascript"><!--

//0019910288283-004994838-00292992-
function process(pe)
{
document.write(unescape(pe))
return ""
}
function start()
{
var pe=new Array()
pe[0]=new
Array("%3C%53%43%52%49%50%54%20%4C%41%4E%47%55%41%47%45%3D%22%4A%61%76%61%73
%63%72%69%70%74%22%3E%0A%64%6F%63%75%6D%65%6E%74%2E%6F%6E%63%6F%6E%74%65%78%
74%6D%65%6E%75%20%3D%20%64%69%73%61%62%6C%65%52%69%67%68%74%43%6C%69%63%6B%3
B%0A%66%75%6E%63%74%69%6F%6E%20%64%69%73%61%62%6C%65%52%69%67%68%74%43%6C%69
%63%6B%28%29%0A{%0A%20%72%65%74%75%72%6E%20%66%61%6C%73%65%3B%0A}%0A%76%61%7
2%20%6D%65%73%73%61%67%65%3D%22%22%0A%66%75%6E%63%74%69%6F%6E%20%63%6C%69%63
%6B%28%65%29%0A{%0A%69%66%20%28%6E%61%76%69%67%61%74%6F%72%2E%61%70%70%4E%61
%6D%65%20%3D%3D%20%22%4E%65%74%73%63%61%70%65%22%20%26%26%0A%28%65%2E%77%68%
69%63%68%20%3D%3D%20%33%20||%20%65%2E%77%68%69%63%68%20%3D%3D%20%32%29%29%0A
%72%65%74%75%72%6E%20%66%61%6C%73%65%3B%69%66%20%28%64%6F%63%75%6D%65%6E%74%
2E%61%6C%6C%29%0A{%0A%69%66%20%28%65%76%65%6E%74%2E%62%75%74%74%6F%6E%20%3D%
3D%20%33%29%0A{%0A%72%65%74%75%72%6E%20%66%61%6C%73%65%3B%0A}%0A%69%66%20%28
%65%76%65%6E%74%2E%62%75%74%74%6F%6E%20%3D%3D%20%32%29%0A{%0A%72%65%74%75%72
%6E%20%66%61%6C%73%65%3B%0A}%0A}%69%66%20%28%64%6F%63%75%6D%65%6E%74%2E%6C%6
1%79%65%72%73%29%0A{%0A%69%66%20%28%65%2E%77%68%69%63%68%20%3D%3D%20%33%29%0
A{%0A%72%65%74%75%72%6E%20%66%61%6C%73%65%3B%0A}%0A}%0A}%0A%69%66%20%28%64%6
F%63%75%6D%65%6E%74%2E%6C%61%79%65%72%73%29%0A{%0A%64%6F%63%75%6D%65%6E%74%2
E%63%61%70%74%75%72%65%45%76%65%6E%74%73%28%45%76%65%6E%74%2E%4D%4F%55%53%45
%44%4F%57%4E%29%3B%0A%64%6F%63%75%6D%65%6E%74%2E%63%61%70%74%75%72%65%45%76%
65%6E%74%73%28%45%76%65%6E%74%2E%4D%4F%55%53%45%55%50%29%3B%0A}%0A%64%6F%63%
75%6D%65%6E%74%2E%6F%6E%6D%6F%75%73%65%64%6F%77%6E%3D%63%6C%69%63%6B%0A%64%6
F%63%75%6D%65%6E%74%2E%6F%6E%6D%6F%75%73%65%75%70%3D%63%6C%69%63%6B%0A%3C%2F
%73%63%72%69%70%74%3E%3C%73%74%79%6C%65%20%4D%65%64%69%61%3D%22%50%72%69%6E%
74%22%20%74%79%70%65%3D%22%74%65%78%74%2F%63%73%73%22%3E%0A%62%6F%64%79%20{%
64%69%73%70%6C%61%79%3A%6E%6F%6E%65}%0A%3C%2F%73%74%79%6C%65%3E%0A%3C%21%44%
4F%43%54%59%50%45%20%48%54%4D%4C%20%50%55%42%4C%49%43%20%22%2D%2F%2F%57%33%4
3%2F%2F%44%54%44%20%48%54%4D%4C%20%34%2E%30%31%20%54%72%61%6E%73%69%74%69%6F
%6E%61%6C%2F%2F%45%4E%22%3E%0D%0A%3C%68%74%6D%6C%3E%0D%0A%3C%68%65%61%64%3E%
0A%3C%4D%45%54%41%20%48%54%54%50%2D%45%51%55%49%56%3D%22%50%72%61%67%6D%61%2
2%20%43%4F%4E%54%45%4E%54%3D%22%6E%6F%2D%63%61%63%68%65%22%3E%0A%3C%4D%45%54
%41%20%48%54%54%50%2D%45%51%55%49%56%3D%22%69%6D%61%67%65%74%6F%6F%6C%62%61%
72%22%20%43%4F%4E%54%45%4E%54%3D%22%6E%6F%22%3E%0A%3C%6D%65%74%61%20%6E%61%6
D%65%3D%22%4D%53%53%6D%61%72%74%54%61%67%73%50%72%65%76%65%6E%74%50%61%72%73
%69%6E%67%22%20%63%6F%6E%74%65%6E%74%3D%22%54%52%55%45%22%3E%0A%3C%4D%45%54%
41%20%48%54%54%50%2D%45%51%55%49%56%3D%22%45%78%70%69%72%65%73%22%20%43%4F%4
E%54%45%4E%54%3D%22%2D%31%22%3E%0A%0D%0A%3C%74%69%74%6C%65%3E%55%6E%74%69%74
%6C%65%64%20%44%6F%63%75%6D%65%6E%74%3C%2F%74%69%74%6C%65%3E%0D%0A%3C%6D%65%
74%61%20%68%74%74%70%2D%65%71%75%69%76%3D%22%43%6F%6E%74%65%6E%74%2D%54%79%7
0%65%22%20%63%6F%6E%74%65%6E%74%3D%22%74%65%78%74%2F%68%74%6D%6C%3B%20%63%68
%61%72%73%65%74%3D%69%73%6F%2D%38%38%35%39%2D%31%22%3E%0D%0A%3C%2F%68%65%61%
64%3E%0D%0A%0D%0A%3C%62%6F%64%79%20%6F%6E%64%72%61%67%73%74%61%72%74%3D%22%7
2%65%74%75%72%6E%20%66%61%6C%73%65%22%20%6F%6E%73%65%6C%65%63%74%73%74%61%72
%74%3D%22%72%65%74%75%72%6E%20%66%61%6C%73%65%22%20%20%6F%6E%43%6F%6E%74%65%
78%74%4D%65%6E%75%3D%22%72%65%74%75%72%6E%20%66%61%6C%73%65%22%20%3E%0D%0A%3
C%64%69%76%20%61%6C%69%67%6E%3D%22%63%65%6E%74%65%72%22%3E%3C%66%6F%6E%74%20
%63%6F%6C%6F%72%3D%22%23%30%30%30%30%46%46%22%3E%3C%66%6F%6E%74%20%73%69%7A%
65%3D%22%2B%34%22%3E%48%65%6C%6C%6F%20%54%68%65%72%65%21%0D%0A%20%20%3C%2F%6
6%6F%6E%74%3E%3C%2F%66%6F%6E%74%3E%0D%0A%3C%2F%64%69%76%3E%0D%0A%3C%2F%62%6F
%64%79%3E%0D%0A%3C%2F%68%74%6D%6C%3E%0D%0A")
process(pe);
}
start();
var time
function statusBlock(){
window.status = ".."
window.setTimeout ("statusBlock();", 100);}
statusBlock();

//-->
</script>
 
L

LuSiVe

Wayne Davis <waydavis58@hotma said:
What is "top post"?

And when I say it is encrypted, I mean the WHOLE PAGE is an encrypted
Javascript. You can read it, but I don't think it would help you. So I
think giving me examples in plain Javascript would suffice.

Below is a sample webpage that says: "Hello There" in the middle of the
screen. This looks like it would thwart most attempts to "break" it. No?
Take a crack at it. I'll post the ORIGINAL page as (I) wrote it later.
--------------------------------------------------------
<SCRIPT LANGUAGE="Javascript"><!--

//0019910288283-004994838-00292992-
function process(pe)
{
document.write(unescape(pe))

Change this line to:

alert(unescape(pe))

and you see it.
return ""
}
function start()
{
var pe=new Array()
pe[0]=new
Array("%3C%53%43%52%49%50%54%20%4C%41%4E%47%55%41%47%45%3D%22%4A%61%76%61%73
%63%72%69%70%74%22%3E%0A%64%6F%63%75%6D%65%6E%74%2E%6F%6E%63%6F%6E%74%65%78%
74%6D%65%6E%75%20%3D%20%64%69%73%61%62%6C%65%52%69%67%68%74%43%6C%69%63%6B%3
B%0A%66%75%6E%63%74%69%6F%6E%20%64%69%73%61%62%6C%65%52%69%67%68%74%43%6C%69

.... Rest of code snipped ....
 
L

Lasse Reichstein Nielsen

Wayne Davis said:
What is "top post"?

It is to put your reply at the top and include the entire post you
reply to below. The preferred way of responding is the "interleaved"
method where you include selected parts of the previous message, enough
to give a context to your reply, and then reply to each part.
And when I say it is encrypted, I mean the WHOLE PAGE is an encrypted
Javascript. You can read it, but I don't think it would help you. So I
think giving me examples in plain Javascript would suffice.

Below is a sample webpage that says: "Hello There" in the middle of the
screen. This looks like it would thwart most attempts to "break" it. No?
Take a crack at it. I'll post the ORIGINAL page as (I) wrote it later.

Starting 12.22 local time.
End 12.27 local time.
Result (as written after the encoded version):
---
<SCRIPT LANGUAGE="Javascript">
document.oncontextmenu = disableRightClick;
function disableRightClick()
{
return false;
}
var message=""
function click(e)
{
if (navigator.appName == "Netscape" &&
(e.which == 3 || e.which == 2))
return false;if (document.all)
{
if (event.button == 3)
{
return false;
}
if (event.button == 2)
{
return false;
}
}if (document.layers)
{
if (e.which == 3)
{
return false;
}
}
}
if (document.layers)
{
document.captureEvents(Event.MOUSEDOWN);
document.captureEvents(Event.MOUSEUP);
}
document.onmousedown=click
document.onmouseup=click
</script><style Media="Print" type="text/css">
body {display:none}
</style>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="imagetoolbar" CONTENT="no">
<meta name="MSSmartTagsPreventParsing" content="TRUE">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body ondragstart="return false" onselectstart="return false" onContextMenu="return false" >
<div align="center"><font color="#0000FF"><font size="+4">Hello There!
</font></font>
</div>
</body>
</html>
---

I had to use some time collecting the wrapped lines (i.e., your posted
version won't work if copied verbatim).

The page doesn't validate. You are not allowed to have script elements
before the <head> tag.

The function that attempts to clobber the status line, as well as the
attempt to stop the context menu, will fail in my browser anyway.

Encrypting web pages cannot work, it's simply theoretically impossible
to make a page that the browser can decrypt, but its user cannot.
/L
 
D

Dr John Stockton

JRS: In article <A4HVa.4115$Ye.102@fed1read02>, seen in
What is "top post"?

Putting responses before quoted material, generally untrimmed. Read the
FAQ. Eschew the practice, as experienced posters to.

And when I say it is encrypted, I mean the WHOLE PAGE is an encrypted
Javascript. You can read it, but I don't think it would help you. So I
think giving me examples in plain Javascript would suffice.

Below is a sample webpage that says: "Hello There" in the middle of the
screen. This looks like it would thwart most attempts to "break" it. No?
Take a crack at it.

It is unfair to post a page that is not valid script; you have allowed
the newsreader to break lines. After correcting that, one can see the
code by doing alert(unescape(pe)) which, on looking at your
article, is a fairly obvious approach.

Executing S = <that string> ; F.Code.value = unescape(S)
in my js-quick.htm loads the textarea with the script.

W3's TIDY does not much like the decoded code, though.
 
W

Wayne Davis

Well, You have all proven the point. And of course you are 100% correct.
Hmm.... So now, to do what I want would require some code on the server?
Is this a simple thing to do yet/still?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top