bobo
08-11-2003, 05:32 AM
I want to access a image which is situation in a protected directory.
For security reason I want to encryt the password on display on the url.... so I write a javascript function as follow:
function Login(image) {
var first = "user2";
var second = "user2";
letters = "abcdefghijklmnopqrstuvwxyz/.1234567890~_:";
encrypt = new Array(
"%61","%62","%63","%64","%65","%66",
"%67","%68","%69","%6a","%6b","%6c",
"%6d","%6e","%6f","%70","%71","%72",
"%73","%74","%75","%76","%77","%78",
"%79","%7a","/","."
,"%31","%32","%33","%34","%35","%36","%37","%38",
"%39","%30","~","_","!",":");
var input = second;
hidden = "";
for(var count = 0; count < input.length; count++) {
daChar = input.charAt(count);
for (i = 0; i < letters.length; i++) {
if (daChar == letters.charAt(i)) {
hidden += encrypt[i];
break;
}
}
}
var htsite = "http://" + first + ":" + hidden + "@" + "URL of the site" + image;
return htsite;
}
When I try to display it on th HTML code it doesn't work...
<a href="javascript:Login('image.gif')" ><img border="1"
src="javascript:Login('image.gif')" width="96" height="80"></a>
Can anyone help???
:confused:
For security reason I want to encryt the password on display on the url.... so I write a javascript function as follow:
function Login(image) {
var first = "user2";
var second = "user2";
letters = "abcdefghijklmnopqrstuvwxyz/.1234567890~_:";
encrypt = new Array(
"%61","%62","%63","%64","%65","%66",
"%67","%68","%69","%6a","%6b","%6c",
"%6d","%6e","%6f","%70","%71","%72",
"%73","%74","%75","%76","%77","%78",
"%79","%7a","/","."
,"%31","%32","%33","%34","%35","%36","%37","%38",
"%39","%30","~","_","!",":");
var input = second;
hidden = "";
for(var count = 0; count < input.length; count++) {
daChar = input.charAt(count);
for (i = 0; i < letters.length; i++) {
if (daChar == letters.charAt(i)) {
hidden += encrypt[i];
break;
}
}
}
var htsite = "http://" + first + ":" + hidden + "@" + "URL of the site" + image;
return htsite;
}
When I try to display it on th HTML code it doesn't work...
<a href="javascript:Login('image.gif')" ><img border="1"
src="javascript:Login('image.gif')" width="96" height="80"></a>
Can anyone help???
:confused: