gzinflate&base64_decode加密&解密

2013年1月15日09:36:39gzinflate&base64_decode加密&解密已关闭评论3,649 1017字阅读3分23秒

gzinflate&base64_decode解密代码:

< ?php
$Code = '要解密的代码'; // base64编码
$File = 'decoded.php';//解码后保存的文件
$Temp = base64_decode($Code);
$temp = gzinflate($Temp);
$FP = fopen($File,"w");
fwrite($FP,$temp);
fclose($FP);
echo "解密成功!";
?>

gzinflate base64_decode加密代码:

< ?php
function encode_file_contents($filename) {
$type=strtolower(substr(strrchr($filename,’.'),1));
if(’php’==$type && is_file($filename) && is_writable($filename)){// 如果是PHP文件 并且可写 则进行压缩编码
$contents = file_get_contents($filename);// 判断文件是否已经被编码处理
$pos = strpos($contents,’powered by Lseven QQ:714345658′);
if(false === $pos || $pos>100){ // 去除PHP文件注释和空白,减少文件大小
$contents = php_strip_whitespace($filename);
// 去除PHP头部和尾部标识
$headerPos = strpos($contents,’< ?php’);
$footerPos = strrpos($contents,’?>’);
$contents = substr($contents,$headerPos+5,$footerPos-$headerPos);
$encode = base64_encode(gzdeflate($contents));// 开始编码
$encode = ‘< ?php’."\n eval(gzinflate(base64_decode("."’".$encode."’".")));\n\n?>";
return file_put_contents($filename,$encode);
}
}
return false;
}
//调用函数
$filename=’code.php’;
encode_file_contents($filename);
echo "OK,加密完成!"
?>


 

继续阅读
本文章来自站群哥LsevenTT博客~转载请注明出处
用PHP根据IP地址判断访问者所在省份,显示不同内容 PHP相关

用PHP根据IP地址判断访问者所在省份,显示不同内容

  在进行网站开发的过程中,有时候我们需要获取访问者的IP地址,根据访问者的IP地址,判断他所在的省份,然后呈现给访问者不同的内容。下面我们介绍一下使用淘宝的IP库来实现对指定省份显示指定内容的方法。 代码如下: <?php...
PHP 获取指定日期的星期 PHP相关

PHP 获取指定日期的星期

PHP 获取指定日期的星期方法如下:   <?php header("Content-type: text/html; charset=utf-8"); //获取星期方法 function get_week($date){ ...
PHP生成首页html静态文件 PHP相关

PHP生成首页html静态文件

  PHP生成首页静态文件代码 分享一个 PHP生成静态首页index.html的代码   <?php $baseCmsUrl = "http://www.LsevenTT.com"; //你网站的根目录不要加反斜...
根据user-agent判断蜘蛛跳转 (php版与js版本) PHP相关

根据user-agent判断蜘蛛跳转 (php版与js版本)

黑帽seo手段中有一个大家都在用的技巧,在服务端判断 客户端浏览器的user-agent然后做进一步操作, 网上一直都有人在用 这个代码 先是一个js代码 判断网站访客来路 如果是搜索引擎来的 就跳转 如果是直接访问则不变化 这段代码是从网...