|
-
Mar 31st, 2004, 09:26 AM
#1
Thread Starter
Supreme User
HTML > VB [Part 1 - RESOLVED]
Ive had a go at converting two completely different HTML codes into VB, with no luck yet. The first HTML code is a URL Encrypter (This one remains encrypted when the page loads). Its source is as followed:
Code:
<html>
<head>
<!--
This file retrieved from the JS-Examples archives
http://www.js-examples.com
1000s of free ready to use scripts, tutorials, forums.
Author: JS-Examples - http://www.js-examples.com/
-->
<SCRIPT LANGUAGE="JavaScript">
<!--
function custLog(x,base) {
// Created 1997 by Brian Risk. http://members.aol.com/brianrisk
return (Math.log(x))/(Math.log(base));
}
function mod(divisee,base) {
// Created 1997 by Brian Risk. http://members.aol.com/brianrisk
return Math.round(divisee - (Math.floor(divisee/base)*base));
}
function custRound(x,places) {
// Created 1997 by Brian Risk. http://members.aol.com/brianrisk
return (Math.round(x*Math.pow(10,places)))/Math.pow(10,places)
}
function fractApprox(x,maxDenominator) {
// Created 1997 by Brian Risk. http://members.aol.com/brianrisk
maxDenominator = parseInt(maxDenominator);
var approx = 0;
var error = 0;
var best = 0;
var besterror = 0;
for (var i=1; i <= maxDenominator; i++) {
approx =Math.round(x/(1/i)); error =(x - (approx/i))
if (i==1) {best =i; besterror =error;} if (Math.abs(error) != Math.abs(besterror)) {best = i; besterror = error;}
}
return (Math.round(x/(1/best)) + "/" + best);
}
function baseConverter (number,ob,nb) {
// Created 1997 by Brian Risk. http://members.aol.com/brianrisk
number = number.toString().toUpperCase();
var list = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var dec = 0;
for (var i = 0; i <= number.length; i++) {
dec +=(list.indexOf(number.charAt(i))) * (Math.pow(ob , (number.length - i - 1)));
}
number =""; var magnitude =Math.floor((Math.log(dec))/(Math.log(nb))); for (var i =magnitude; i >= 0; i--) {
var amount = Math.floor(dec/Math.pow(nb,i));
number = number + list.charAt(amount);
dec -= amount*(Math.pow(nb,i));
}
return number;
}
function encryptIt(_in,_out) {
// the following letters are going to be encrypted.
var letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var letterCode=new Array();
for(var i=0;i<letters.length;i++)
{
var _temp=baseConverter(letters.charCodeAt(i),10,16);
letterCode[i]="%"+_temp;
}
alert(letterCode[letters.indexOf("j")]);
var _search = _in.value.indexOf("?")==-1?"":"?"+_in.value.split("?")[1];
var _formIn = _in.value.indexOf("?")==-1?_in.value.split("."):_in.value.split("?")[0].split(".");
var output = _formIn[0]+".";
for(var i = 0; i < _formIn[1].length; i++) {
if(letters.indexOf(_formIn[1].charAt(i))!=-1) {
if (letters.indexOf(_formIn[1].charAt(i))!=-1) {
// its a letter
var x = (Math.random()*1000);
var j = letters.indexOf(_formIn[1].charAt(i));
if (x > 500) {
// j should be 0 through 25 for lowercase and 26 through 51 for uppercase
// switch them
if (j < 26) j += 26;
else j -= 26;
}
if (x < 300) { output += _formIn[1].charAt(i);
} else { output += letterCode[j]; }
} else { output += escape(_formIn[1].charAt(i)); }
} else { output += _formIn[1].charAt(i); }
}
for(var i=2;i<_formIn.length;i++)
output += "."+_formIn[i];
_out.value = output+_search;
}
function testIt() {
var _l = document.exf1.output.value;
if (_l.indexOf("http://")==-1) _l = "http://"+_l;
alert(_l);
//var myWin = window.open(_l,"TestWin","width=500,height=50,location=yes");
}
// End -->
</script>
</head>
<body>
<form name=exf1>
Enter into this box the URL that you want to encrypt:
<BR>
<input type=text name=input size=50 value="www.js-examples.com">
<input type=button value="Encrypt URL" onclick="encryptIt(this.form.input,this.form.output)">
<BR>
This is where the encrypted URL will appear:
<BR>
<input type=text name=output size=50 value="">
<input type=button value="Test Encrypted URL" onclick="testIt()">
</form>
<BR><center><a href='http://www.js-examples.com'>JS-Examples.com</a></center>
</body>
</html>
Grateful for any help/advice. Ill attempt it again now.......
Last edited by Madboy; Mar 31st, 2004 at 01:50 PM.
-
Mar 31st, 2004, 11:33 AM
#2
Hyperactive Member
For the URl Encrypter try visit http://www.planetsourcecode.com/
It has some examples in vb code but not like it!
For the second , it is impossible!
-
Mar 31st, 2004, 01:49 PM
#3
Thread Starter
Supreme User
Cheers anyway
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|