首页建站经验 ecshop校验文件生成MD5文件代码

ecshop校验文件生成MD5文件代码

ecshop校验文件生成MD5文件的代码define('ROOT_PATH', str_replace(basename( __FILE__), '', str_replace('//', '/', __FILE__)));ini_set('max_execution_time', '300');…

ecshop校验文件生成MD5文件的代码

define('ROOT_PATH', str_replace(basename( __FILE__), '', str_replace('//', '/', __FILE__)));

ini_set('max_execution_time', '300');

checkfiles('./', '/.php', 0);

checkfiles('admin/', '/.php|/.htm|/.js|/.css|/xml');

checkfiles('api/', '/.php');

checkfiles('includes/', '/.php|/.html|/.js',1,'fckeditor'); //fck不检查

checkfiles('js/', '/.js|/.css');

checkfiles('languages/', '/.php');

checkfiles('plugins/', '/.php');

checkfiles('wap/', '/.php|/.wml');

/*

checkfiles('themes/default/', '/.dwt|/.lbi|/.css'); //模板

checkfiles('uc_client/', '/.php', 0);

checkfiles('uc_client/control/', '/.php');

checkfiles('uc_client/model/', '/.php');

checkfiles('uc_client/lib/', '/.php');

*/

file_put_contents('./admin/ecshopfiles.md5',$md5str); //保存文件校验信息

echo "MD5文件生成完成";

/**检查文件

* @param string $currentdir //待检查目录

* @param string $ext //待检查的文件类型

* @param int $sub //是否检查子目录

* @param string $skip //不检查的目录或文件

*/

function checkfiles($currentdir, $ext = '', $sub = 1, $skip = '')

{

global $md5data, $md5str;

$dir = @opendir(ROOT_PATH.$currentdir);

$exts = '/('.$ext.')$/i';

$skips = explode(',', $skip);

while($entry = @readdir($dir))

{

$file = $currentdir.$entry;

if($entry != '.' && $entry != '..' && $entry != '.svn' && (preg_match($exts, $entry) || $sub && is_dir($file)) && !in_array($entry, $skips))

{

if($sub && is_dir($file))

{

checkfiles($file.'/', $ext, $sub, $skip);

}

else

{

if($file != './md5.php')

{

$md5data[$file] = md5_file($file);

$md5str .= md5_file($file).' *'.$file."/r/n";

}

}

}

}

}

本文来自网络,不代表1号站长-站长学院|资讯交流平台立场。转载请注明出处: https://www.1cn.cc/jianzhan/jingyan/18382.html
上一篇去掉ecshop购物流程的电子邮件必填和电话、手机
下一篇 Discuz3.2后台文件包含漏洞可后台拿shell
admin

作者: admin

这里可以再内容模板定义一些文字和说明,也可以调用对应作者的简介!或者做一些网站的描述之类的文字或者HTML!

为您推荐

评论列表()

    联系我们

    联系我们

    0898-88888888

    在线咨询: QQ交谈

    邮箱: email@wangzhan.com

    工作时间:周一至周五,9:00-17:30,节假日休息

    关注微信
    微信扫一扫关注我们

    微信扫一扫关注我们

    关注微博
    返回顶部