Hola, tengo un problema con un script. Resulta que necesito traducir esto a codigo comprensible html, para ello necesito hacerlo con php.
Se trata de una cadena de texto que mediante JS se convierte a html. Necesitaria hacer el proceso en php y mi pregunta es si pasando las funciones a su respectivo codigo php seria posible hacerlo funcionar.
Esta es la funcion que se convierte en html.
Código HTML:
decodeBase64('yFA/B6/fgVeTFPS4NIqijSVtVUemN39H+e6EuYNxcNiHnCsZeU3W0iY29Fbye4GjyIrqXD9RTiVAU/gI7Pq7Qi1vnoRkLooganMExe36ySUofSME6cF5zgQPoQvnsRNQbp0owGrUZ0fx0EuMWghIg8Pebr7CXoKyNeMzf0neyBePLXvg6u0tYdvCHF7JdLLGpH20CWO6mX8bc2rDAz+bUNshJS/eHNhLCblzvrKbJcddzQRfOkyriWOTusBm3wDZ1kZMs2fEckZRMBvUIiQljZ0L1IV3wDkVQ9cbdDqEIHlWi/xmHtVsb4G+SAMpsBNpXJzfzle4IZaHWdt+GOsI+y1DiHdRJ9mizN0+mEUsIhGqgJMiIMzeFeSmRQ21PxDVXP0yLKcsX3IPfPlcIOGcAGXcpXLgchisgZoyej4aEk0MTsRFGto4kvGzHBAyFrsf+UfKZf4ZqYQmx1pFMl8A0CQbhAoOgKioUFNOASCSTpvNqwiL1aRJuYQo/MzOLjhTcwrTua5Cg50513LwRkC7BJcIsHKCuWvU3CyKKV5Iz1M4qB5C4dBISifGiaisjwmprQk4VWeLVmyba+lzpfDa7PjGs3Hh54cE6BoN4aJVqaUpLvbxJfd2A4ODlTrOQZmFa129XbYkApB5EejTqY6TU4AW3p9G+Kd4TNAjTE2KVfUIW5bhXSvEE5Gs8JCp1xxgPcwrSTVdqe+VsjhqKjihnMouWiXn5pQzv2DlsGzDB1jShTmdWvo9gv4kya16ZzBUalTPTXVVPlapL4OMIJgwXzGPkO+2mwjgdjF8jzaUjn3AuH+WaaKk1JxpfJmI5IlHAJYKL4T0oVBE+gMFJsUa09IuBMi48ARSa8hXDmGf9nCpcAJ8jCrBdtj0Apm3CgaNWwd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nwQvN+T0QroVOIaRNW0wb3qKaCRXjOPsrFX/Qlvl6v06qdEMNdDtl1vJKuYnXE69iUvEoMriXhSSehdh4U2KHOGTE5Meqvl+Vv8s8L0q5tF9p+n42r85SRGsWEnaAhYfwe62BW2o4jPkjVLBDXCbqzptaxkgzFYFrGUVS+fSaM1f0DZIE2COIKp4GRau2BHALI05uJarLOcEA9iltL29xbanduUtQ7ntJfs5oLRBCAsZIKZ1PdGENhFM61g0ttZlPVJUHtlmQjKpzyRmCvJlgkZFhQxzzPmkkk+7D+EG6IWC6YXGgMhtR/8oje+wVIM0TT/7C1j0Zu49BD8EGTNcHT8JayxI1YMCSPCaNmPlsZ8joSSmfJccuy4JKOihiRNObO3CBIwEkB2gCeQKXV+Z68XpLqfHk/RzYKKH6S/g==');
Y este es el fichero JS con las funciones de desencriptarlo:
Código Javascript
:
Ver originalfunction Decripta(key, pt) {
s = new Array();
for (var i=0; i<256; i++) {
s[i] = i;
}
var j = 0;
var x;
for (i=0; i<256; i++) {
j = (j + s[i] + key.charCodeAt(i % key.length)) % 256;
x = s[i];
s[i] = s[j];
s[j] = x;
}
i = 0;
j = 0;
var ct = '';
for (var y=0; y<pt.length; y++) {
i = (i + 1) % 256;
j = (j + s[i]) % 256;
x = s[i];
s[i] = s[j];
s[j] = x;
ct += String.fromCharCode(pt.charCodeAt(y) ^ s[(s[i] + s[j]) % 256]);
}
return(ct);
}
function Procesa(key, ct) {
document.write(Decripta(key, ct));
}
var END_OF_INPUT = -1;
var base64Chars = new Array(
'A','B','C','D','E','F','G','H',
'I','J','K','L','M','N','O','P',
'Q','R','S','T','U','V','W','X',
'Y','Z','a','b','c','d','e','f',
'g','h','i','j','k','l','m','n',
'o','p','q','r','s','t','u','v',
'w','x','y','z','0','1','2','3',
'4','5','6','7','8','9','+','/'
);
var reverseBase64Chars = new Array();
for (var i=0; i < base64Chars.length; i++){
reverseBase64Chars[base64Chars[i]] = i;
}
function setBase64Str(str){
base64Str = str;
base64Count = 0;
}
function decodeBase64(str){
setBase64Str(str);
var result = "";
var inBuffer = new Array(4);
var done = false;
while (!done && (inBuffer[0] = readReverseBase64()) != END_OF_INPUT
&& (inBuffer[1] = readReverseBase64()) != END_OF_INPUT){
inBuffer[2] = readReverseBase64();
inBuffer[3] = readReverseBase64();
result += ntos((((inBuffer[0] << 2) & 0xff)| inBuffer[1] >> 4));
if (inBuffer[2] != END_OF_INPUT){
result += ntos((((inBuffer[1] << 4) & 0xff)| inBuffer[2] >> 2));
if (inBuffer[3] != END_OF_INPUT){
result += ntos((((inBuffer[2] << 6) & 0xff) | inBuffer[3]));
} else {
done = true;
}
} else {
done = true;
}
}
Procesa('cryptkey', result);
}
function readReverseBase64(){
if (!base64Str) return END_OF_INPUT;
while (true){
if (base64Count >= base64Str.length) return END_OF_INPUT;
var nextCharacter = base64Str.charAt(base64Count);
base64Count++;
if (reverseBase64Chars[nextCharacter]){
return reverseBase64Chars[nextCharacter];
}
if (nextCharacter == 'A') return 0;
}
return END_OF_INPUT;
}
function ntos(n){
n=n.toString(16);
if (n.length == 1) n="0"+n;
n="%"+n;
return unescape(n);
}
Es bastante complejo para mi con lo que agtradeceria cualquier ayuda.
Muchas gracias!