论坛风格切换
  • 3040阅读
  • 0回复

[常用修复工具]修复html帖和windcode的工具 [复制链接]

上一主题 下一主题
离线太史慈
 

发帖
766
金币
626
威望
556
只看楼主 倒序阅读 使用道具 楼主  发表于: 2011-11-23
— 本帖被 云天河 从 项目开发 移动到本区(2011-11-23) —
update_ifconvert.php

http://soft.phpwind.me/phpwind/repair

  1. <?php
  2. error_reporting(0);
  3. define('P_W',1);
  4. define('PW_UPLOAD',1);
  5. define('R_P',getdirname(__FILE__));
  6. define('D_P',R_P);
  7. require_once(R_P.'require/common.php');
  8. include_once(D_P.'data/bbscache/config.php');
  9. //require_once(R_P.'admin/cache.php');
  10. @header("Content-Type:text/html; charset=$db_charset");
  11. include_once(D_P.'data/sql_config.php');
  12. //if ($database=='mysqli' && Pwloaddl('mysqli')===false) {
  13.     $database = 'mysql';
  14. //}
  15. require_once Pcv(R_P."require/db_$database.php");
  16. $db = new DB($dbhost,$dbuser,$dbpw,$dbname,$PW,$charset,$pconnect);
  17. $t_k = $_GET['t_k'];
  18. $action = $_GET['action'];
  19. $start = $_GET['start'];
  20. if(!$action){
  21.     $action = 1;
  22. }
  23. if(!$start){
  24.     $start = 0;
  25. }
  26. if(!$t_k){
  27.     $t_k = 0;
  28. }
  29. $percount = 2000;
  30. if (empty($action)) {
  31.     echo '<a href="update_ifconvert.php?action=step1">开始运行修复html帖和windcode的工具</a>';exit;
  32. } elseif ($action == 'step1') {
  33.     $query = $db->query("SELECT * FROM pw_tmsgs WHERE tid>$start LIMIT $percount");
  34.     unset($lastid);
  35.     while ($rt = $db->fetch_array($query)){
  36.         $lastid = $rt['tid'];
  37.         $ifconvert = 1;
  38.         $ifsign = 0;
  39.         if(strpos($content,'<FONT')!==false || strpos($content,'[color')!==false){
  40.             $ifconvert = 2;
  41.         }
  42.         if(strpos($content,'<FONT')!==false || strpos($content,'<span')!==false){
  43.             $ifsign = 3;
  44.         }
  45.         $db->update("UPDATE pw_threads SET ifsign = '$ifsign',ifconvert='$ifconvert' WHERE tid=".$rt['tid']);
  46.     }
  47.     $db->free_result($query);
  48.     $maxid = $db->get_value("SELECT max(tid) FROM pw_tmsgs");
  49.     echo '最大id',$maxid,'<br>','最后id',$lastid;
  50.     if($lastid < $maxid){
  51.         echo "<meta http-equiv='refresh' content='0;url=update_ifconvert.php?action=1&start=$lastid'>";
  52.     }else{
  53.         echo '更新update结束';exit;
  54.     }
  55. }
  56. function getdirname($path=null){
  57.     if (!empty($path)) {
  58.         if (strpos($path,'\\')!==false) {
  59.             return substr($path,0,strrpos($path,'\\')).'/';
  60.         } elseif (strpos($path,'/')!==false) {
  61.             return substr($path,0,strrpos($path,'/')).'/';
  62.         }
  63.     }
  64.     return './';
  65. }
  66. ?>


[url=http://www.phpwind.com]phpwind[/url]
快速回复
限100 字节
如果您在写长篇帖子又不马上发表,建议存为草稿
 
提到某人:
选择好友
上一个 下一个