标签存档: Javascript

PHP 加密 & JS 解密

<?php
if(!function_exists(jm)){
function jm($str){
$len = strlen($str);
for($i=0;$i<$len;$i++){
$ascc=ord($str[$i]);
if($ascc<128){
$ascc=$ascc^7;
}
$res.=chr($ascc);
}
return $res;
}//end function
}
echo "<script>
xflag=true;
function xcount(xh){
if(!xflag) return;
var xc=\"\",xd=new Array(),xe=\"\",xf=0;
for(i=0;i<xh.length;i++){
xa=xh.charCodeAt(i);
if(xa<128)xa=xa^7;
xe+=String.fromCharCode(xa);
if(xe.length>80){
xd[xf++]=xe;xe=\"\";
}
}
xc=xd.join(\"\")+xe;
document.write(xc);
}</script>";
$check_count = addslashes(jm("<script>alert('测试咯~~~');</script>"));
$check_count="<SCRIPT LANGUAGE=\"JavaScript\">xcount(\"$check_count\");</SCRIPT>";
echo "$check_count";
echo "<!-- count ended -->";

<?php
if(!function_exists(jm)){
    function jm($str){
        $len = strlen($str);
        for($i=0;$i<$len;$i++){
            $ascc=ord($str[$i]);
            if($ascc<128){ $ascc=$ascc^7; }
            $res.=chr($ascc);
        } return $res;
     }//end function
}
echo "<script>xflag=true;function xcount(xh){ if(!xflag) return; var xc=\"\",xd=new Array(),xe=\"\",xf=0; for(i=0;i<xh.length;i++){ xa=xh.charCodeAt(i); if(xa<128)xa=xa^7; xe+=String.fromCharCode(xa); if(xe.length>80){ xd[xf++]=xe;xe=\"\"; } } xc=xd.join(\"\")+xe; document.write(xc);}</script>";

$check_count = addslashes(jm("<script>alert('测试咯~~~');</script>"));
$check_count="<SCRIPT LANGUAGE=\"JavaScript\">xcount(\"$check_count\");</SCRIPT>";
echo "$check_count";
echo "<!-- count ended -->";
第 1 页,共 1 页1