在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
加密方法: 1 <?php 2 header('Content-Type:text/html;charset=utf-8'); 3 function encode_file_contents($filename) { 4 $type=strtolower(substr(strrchr($filename,'.'),1)); 5 if('php'==$type && is_file($filename) && is_writable($filename)){// 如果是PHP文件 并且可写 则进行压缩编码 6 $contents = file_get_contents($filename);// 判断文件是否已经被编码处理 7 $pos = strpos($contents,'powered by arzn QQ:1314778'); 8 if(false === $pos || $pos>100){ // 去除PHP文件注释和空白,减少文件大小 9 $contents = php_strip_whitespace($filename); 10 // 去除PHP头部和尾部标识 11 $headerPos = strpos($contents,'<?php'); 12 $footerPos = strrpos($contents,'?>'); 13 $contents = substr($contents,$headerPos+5,$footerPos-$headerPos); 14 $encode = base64_encode(gzdeflate($contents));// 开始编码 15 $encode = '<?php'."\n eval(gzinflate(base64_decode("."'".$encode."'".")));\n\n?>"; 16 return file_put_contents($filename,$encode); 17 } 18 } 19 return false; 20 } 21 //调用函数 22 $filename='1.php'; 23 encode_file_contents($filename); 24 echo "OK,加密完成!" 25 ?> 解密方法: 1 <?php 2 $Code = '这里填写要解密的编码'; // base64编码 3 $File = 'decoded.php';//解码后保存的文件 4 $Temp = base64_decode($Code); 5 $temp = gzinflate($Temp); 6 $FP = fopen($File,"w"); 7 fwrite($FP,$temp); 8 fclose($FP); 9 echo "解密成功!"; 10 ?>
|
2022-07-18
2022-08-17
2022-11-06
2022-08-17
2022-08-15
请发表评论