壓縮編碼(加密)代碼: 復(fù)制代碼 代碼如下:<?php function encode_f " /> 久久国产精品久久w女人spa,香蕉成人久久,亚洲精选一区

色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

PHP base64+gzinflate壓縮編碼和解碼代碼

base64+gzinflate壓縮編碼(加密)過的文件通常是以 <? eval(gzinflate(base64_decode( 為頭的一個(gè)php文件。以下我們給出了相關(guān)的編碼解碼(加密解密)代碼。

壓縮編碼(加密)代碼:
復(fù)制代碼 代碼如下:
<?php
function encode_file_contents($filename) {
$type=strtolower(substr(strrchr($filename,'.'),1));
if('php'==$type && is_file($filename) && is_writable($filename)){// 如果是php文件 并且可寫 則進(jìn)行壓縮編碼
$contents = file_get_contents($filename);// 判斷文件是否已經(jīng)被編碼處理
$pos = strpos($contents,'/*Protected by 草名 http://www.crazyi.cn Cryptation*/');
if(false === $pos || $pos>100){ // 去除php文件注釋和空白,減少文件大小
$contents = php_strip_whitespace($filename);
// 去除php頭部和尾部標(biāo)識(shí)
$headerPos = strpos($contents,'<?php');
$footerPos = strrpos($contents,'?>');
$contents = substr($contents,$headerPos+5,$footerPos-$headerPos);
$encode = base64_encode(gzdeflate($contents));// 開始編碼
$encode = '<?php'." /*Protected by 草名 http://www.crazyi.cn Cryptation*//n eval(gzinflate(base64_decode(".$encode.")));/n /*Reverse engineering is illegal and strictly prohibited- (C)草名 Cryptation 2008*/ /n?>";
return file_put_contents($filename,$encode);
}
}
return false;
}
//調(diào)用函數(shù)
$filename='g:/我的文檔/桌面/test.php';
encode_file_contents($filename);
?>
<?php
function encode_file_contents($filename) {
$type=strtolower(substr(strrchr($filename,'.'),1));
if('php'==$type && is_file($filename) && is_writable($filename)){// 如果是php文件 并且可寫 則進(jìn)行壓縮編碼
$contents = file_get_contents($filename);// 判斷文件是否已經(jīng)被編碼處理
$pos = strpos($contents,'/*Protected by 草名 http://www.crazyi.cn Cryptation*/');
if(false === $pos || $pos>100){ // 去除php文件注釋和空白,減少文件大小
$contents = php_strip_whitespace($filename);
// 去除php頭部和尾部標(biāo)識(shí)
$headerPos = strpos($contents,'<?php');
$footerPos = strrpos($contents,'?>');
$contents = substr($contents,$headerPos+5,$footerPos-$headerPos);
$encode = base64_encode(gzdeflate($contents));// 開始編碼
$encode = '<?php'." /*Protected by 草名 http://www.crazyi.cn Cryptation*//n eval(gzinflate(base64_decode(".$encode.")));/n /*Reverse engineering is illegal and strictly prohibited- (C)草名 Cryptation 2008*/ /n?>";
return file_put_contents($filename,$encode);
}
}
return false;
}
//調(diào)用函數(shù)
$filename='g:/我的文檔/桌面/test.php';
encode_file_contents($filename);
?>


壓縮解碼(解密)代碼:
復(fù)制代碼 代碼如下:
<?php
$Code = '這里填寫要解密的編碼'; // base64編碼
$File = 'test.php';//解碼后保存的文件
$Temp = base64_decode($Code);
$temp = gzinflate($Temp);
$FP = fopen($File,"w");
fwrite($FP,$temp);
fclose($FP);
echo "解密成功!";
?>

php技術(shù)PHP base64+gzinflate壓縮編碼和解碼代碼,轉(zhuǎn)載需保留來源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 奇台县| 永康市| 临江市| 微博| 平原县| 晴隆县| 尖扎县| 沙雅县| 井研县| 盐源县| 潜山县| 呼图壁县| 蓬莱市| 岳阳市| 沧源| 南江县| 平度市| 金坛市| 溆浦县| 茂名市| 沁水县| 安阳市| 郧西县| 江陵县| 信宜市| 庆城县| 晋城| 东台市| 青浦区| 太原市| 阳高县| 奇台县| 枣庄市| 萝北县| 达孜县| 三河市| 交城县| 铜鼓县| 大渡口区| 泾源县| 铁岭市|