I have found this code somewhere but I don’t know how to convert it into PHP. It will randomly encrypt given URL… Can someone do it?
[code=php]<SCRIPT language=JavaScript>
<!–
function encryptIt() {
// the following letters are going to be encrypted.
var letters = “abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ”;
var letterCode = 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’,
‘%41′,’%42′,’%43′,’%44′,’%45′,’%46′,’%47′,’%48′,’%49′,’%4a’,
‘%4b’,’%4c’,’%4d’,’%4e’,’%4f’,’%50′,’%51′,’%52′,’%53′,’%54′,
‘%55′,’%56′,’%57′,’%58′,’%59′,’%5a’);
var _form = document.exf1;
var _formIn = _form.input.value.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)%10;
var j = letters.indexOf(_formIn[1].charAt(i));
if (x > 7) {
// 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 < 3) { 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];
_form.output.value = output;
}
function testIt() {
var _l = document.exf1.output.value;
if (_l.indexOf(“http://”)==-1) _l = “http://”+_l;
var myWin = window.open(_l,”TestWin”,”width=700,height=500,location=yes”);
}// End –>
</SCRIPT>