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');
- checkfiles('js/', '\.js|\.css');
- checkfiles('languages/', '\.php');
- checkfiles('plugins/', '\.php');
- checkfiles('wap/', '\.php|\.wml');
-
-
-
-
-
-
-
-
- file_put_contents('./admin/ecshopfiles.md5',$md5str);
-
- echo "MD5文件生成完成";
-
-
-
-
-
-
-
-
-
-
- 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";
- }
- }
-
- }
-
- }
- }
最模板搜集该ecshop教程,转载请注明网址! (责任编辑:最模板) |