分类分类
更新时间:2026-10-06 17:06:23作者:fang
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."rn";
}
}
}
}
}
相关
摄像头远程监控看家2026官方最新版本生活服务36.4 MBv1.0.02026-10-06
下载公务员省考最新手机版学习办公57.5 MBv6.09.112026-10-06
下载野性蜂巢(Wild Hive)经营养成267.49 Mv1.66.42026-10-04
下载趣好卖app网上购物74.76 Mv5.2.52026-10-04
下载兔叽月记app医疗健康55.33 Mv1.5.22026-10-04
下载魔力弹神策略游戏33.56 Mv1.0.02026-10-04
下载大破坏幸存者策略游戏62.28 Mv1.0.32026-10-04
下载啃豆小仓拼豆app实用工具41.74 Mv1.32026-10-04
下载方块公国安卓移植版策略游戏1.58Gv1.2.202026-10-04
下载快车顺风车出行2026官方最新版本生活服务82.0 MBv1.1.22026-10-04
下载网约上门按摩2026官方最新版本生活服务73.9 MBv2.0.22026-10-04
下载道运考试通(道路考练工具)学习办公32.8 MBv6.0.12026-10-04
下载










