Computing.Net > Forums > Programming > problem understanding jscript

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

problem understanding jscript

Reply to Message Icon

Original Message
Name: noel
Date: February 10, 2003 at 22:37:01 Pacific
Subject: problem understanding jscript
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))
}


Report Offensive Message For Removal


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.


Report Offensive Follow Up For Removal

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.


Report Offensive Follow Up For Removal







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



Results for: problem understanding jscript

2 lines in c about pointers
    Summary: I have problem understanding poiters. can any body explain what these 2 lines do. Thanks FILE *myFile =fopen("file.txt", "r"); char *strg=(char*) malloc(sizeof(char) *255); ...
www.computing.net/answers/programming/2-lines-in-c-about-pointers/9630.html

SQL for a beginer problem.
    Summary: I am haveing a problem understanding the reason for Forign Keys. I am a student and have read a few web pages on this and think that there is an easier explanation than what my book or some web pages...
www.computing.net/answers/programming/sql-for-a-beginer-problem/8332.html

Code Builder in Access2000
    Summary: Thanks Mark for your reply. But you seem not understand my point. What I need is to send emails from the access itself to others outlooks not the opposite. This is what my colleague wrote in the code...
www.computing.net/answers/programming/code-builder-in-access2000/3104.html








Which MP3 player do you have?

iPod/iPhone
Zune
Something Else
None


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge
Poll History






Data Recovery Software