Computing.Net > Forums > Programming > problem understanding jscript

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

problem understanding jscript

Reply to Message Icon

Name: noel
Date: February 10, 2003 at 22:37:01 Pacific
OS: winblows
CPU/Ram: 32
Comment:

I have problem understanding the jscript below, assume that I run the start running the function testEncode

thanks in advance.

function testEncode(form) {
var dater = new Date();
Day = dater.getDate();
dater = null;
var Ret = encode (form.inputbox1.value, Day)
location = Ret + ".php"
}

function encode (OrigString, CipherVal) {
Ref="0123456789abcdefghijklmnopqrstuvwxyz._~ABCDEFGHIJKLMNOPQRSTUVWXYZ"
CipherVal = parseInt(CipherVal)
var Temp=""
for (Count=0; Count OrigString.length; Count++) {
var TempChar = OrigString.substring (Count, Count+1)
var Conv = cton(TempChar)
var Cipher=Conv^CipherVal
Cipher=ntoc(Cipher)
Temp += Cipher
}
return (Temp)
}

function cton (Char) {
return (Ref.indexOf(Char));
}

function ntoc (Val) {
return (Ref.substring(Val, Val+1))
}



Sponsored Link
Ads by Google

Response Number 1
Name: Random
Date: February 11, 2003 at 16:19:04 Pacific
Reply:

I didn't find a problem with it, aside from the code styling.

Try this:

function testEncode(form) {
var dater = new Date();
var Day = dater.getDate();
location.href= encode( form.inputbox1.value, Day ) + ".php" );
}

function encode( OrigString, CipherVal ) {
var Ref = "0123456789abcdefghijklmnopqrstuvwxyz._~ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var Temp = "";
for( Count = 0; Count OrigString.length; Count++ ) {
Temp += Ref.charAt( Ref.indexOf( OrigString.charAt( Count ) ) ^ parseInt( CipherVal ) );
}
return Temp;
}

And remember to put in the less than sign between Count and OrigString.length in the for(;;) loop declaration.


0

Response Number 2
Name: noel
Date: February 16, 2003 at 08:07:06 Pacific
Reply:

em, I understand there isnt any problem with the code and it can run but does it review to ppl the password to following page?

do you think is insecure?

can you get the password that you need to type in in order to get to the next page?

if you can it means is insecure.

thank you again.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


vb 6 preforming file sear... Urgent: need help with c+...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: problem understanding jscript

SQL for a beginer problem. www.computing.net/answers/programming/sql-for-a-beginer-problem/8332.html

2 lines in c about pointers www.computing.net/answers/programming/2-lines-in-c-about-pointers/9630.html

VB types www.computing.net/answers/programming/vb-types/9331.html