国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > ThinkPHP > 正文

thinkphp 驗證碼不現實多半是bom惹的禍

2024-09-09 15:19:42
字體:
來源:轉載
供稿:網友

thinkphp 驗證碼不現實多半是bom惹的禍,下面是驅除bom的代碼:

  1. <?php  
  2. if (isset($_GET['dir'])){ //設置文件目錄  
  3. $basedir=$_GET['dir'];  
  4. }else{  
  5. $basedir = '.';  
  6. }  
  7. $auto = 1;  
  8. checkdir($basedir);  
  9. function checkdir($basedir){  
  10. if ($dh = opendir($basedir)) {  
  11.   while (($file = readdir($dh)) !== false) {  
  12.    if ($file != '.' && $file != '..'){  
  13.     if (!is_dir($basedir."/".$file)) {  
  14.      echo "filename: $basedir/$file ".checkBOM("$basedir/$file")." <br>";  
  15.     }else{  
  16.      $dirname = $basedir."/".$file;  
  17.      checkdir($dirname);  
  18.     }  
  19.    }  
  20.   }  
  21. closedir($dh);  
  22. }  
  23. }  
  24. function checkBOM ($filename) {  
  25. global $auto;  
  26. $contents = file_get_contents($filename);  
  27. $charset[1] = substr($contents, 0, 1);  
  28. $charset[2] = substr($contents, 1, 1);  
  29. $charset[3] = substr($contents, 2, 1);  
  30. if (ord($charset[1]) == 239 && ord($charset[2]) == 187 && ord($charset[3]) == 191) {  
  31.   if ($auto == 1) {  
  32.    $rest = substr($contents, 3);  
  33.    rewrite ($filename$rest);  
  34.    return ("<font color=red>BOM found, automatically removed._<a href=http://www.esoxue.com>http://m.survivalescaperooms.com</a></font>");  
  35.   } else {  
  36.    return ("<font color=red>BOM found.</font>");  
  37.   }  
  38. }  
  39. else return ("BOM Not Found.");  
  40. }  
  41. function rewrite ($filename$data) {  
  42. $filenum = fopen($filename"w");  
  43. flock($filenum, LOCK_EX);  
  44. fwrite($filenum$data);  
  45. fclose($filenum);  
  46. }  
  47. ?>  

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 甘洛县| 海南省| 普宁市| 新乡市| 通江县| 新泰市| 商河县| 大田县| 晋城| 常熟市| 连平县| 湛江市| 沙湾县| 乌拉特后旗| 涪陵区| 兴城市| 辽中县| 皮山县| 平安县| 镇安县| 涟源市| 平利县| 延津县| 潮州市| 兴仁县| 苍梧县| 达孜县| 军事| 尉犁县| 兰西县| 富裕县| 全椒县| 柳河县| 乌兰浩特市| 宕昌县| 乐山市| 怀来县| 尤溪县| 烟台市| 临清市| 额敏县|