网站开发 · 2025年4月24日

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

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

 
 
 
  1. define('ROOT_PATH'str_replace(basename__FILE__), ''str_replace('\\', '/', __FILE__))); 
  2.  
  3. ini_set('max_execution_time''300'); 
  4.  
  5. checkfiles('./''\.php', 0); 
  6. checkfiles('admin/''\.php|\.htm|\.js|\.css|\xml'); 
  7. checkfiles('api/''\.php'); 
  8. checkfiles('includes/''\.php|\.html|\.js',1,'fckeditor');    //fck不检查 
  9. checkfiles('js/''\.js|\.css'); 
  10. checkfiles('languages/''\.php'); 
  11. checkfiles('plugins/''\.php'); 
  12. checkfiles('wap/''\.php|\.wml'); 
  13. /* 
  14. checkfiles('themes/default/', '\.dwt|\.lbi|\.css');   //模板 
  15. checkfiles('uc_client/', '\.php', 0); 
  16. checkfiles('uc_client/control/', '\.php'); 
  17. checkfiles('uc_client/model/', '\.php'); 
  18. checkfiles('uc_client/lib/', '\.php'); 
  19. */ 
  20.  
  21. file_put_contents('./admin/ecshopfiles.md5',$md5str);   //保存文件校验信息 
  22.  
  23. echo "MD5文件生成完成"
  24.  
  25.  
  26.  
  27.  
  28. /**检查文件 
  29. * @param  string $currentdir    //待检查目录 
  30. * @param  string $ext           //待检查的文件类型 
  31. * @param  int    $sub           //是否检查子目录 
  32. * @param  string $skip          //不检查的目录或文件 
  33. */ 
  34. function checkfiles($currentdir$ext = ''$sub = 1, $skip = ''
  35.     global $md5data$md5str
  36.     $dir = @opendir(ROOT_PATH.$currentdir); 
  37.     $exts = '/('.$ext.')$/i'
  38.     $skips = explode(','$skip); 
  39.  
  40.     while($entry = @readdir($dir)) 
  41.     { 
  42.         $file = $currentdir.$entry
  43.         if($entry != '.' && $entry != '..' && $entry != '.svn' && (preg_match($exts$entry) || $sub && is_dir($file)) && !in_array($entry$skips)) 
  44.         { 
  45.             if($sub && is_dir($file)) 
  46.             { 
  47.                 checkfiles($file.'/'$ext$sub$skip); 
  48.             } 
  49.             else 
  50.             { 
  51.                 if($file != './md5.php'
  52.                 { 
  53.                     $md5data[$file] = md5_file($file); 
  54.                     $md5str .= md5_file($file).' *'.$file."\r\n"
  55.                 } 
  56.             } 
  57.  
  58.         } 
  59.  
  60.     } 

好模板搜集该,转载请注明网址!