|
—
本帖被 云天河 从 项目开发 移动到本区(2011-11-23)
—
update_ifconvert.php http://soft.phpwind.me/phpwind/repair - <?php
- error_reporting(0);
- define('P_W',1);
- define('PW_UPLOAD',1);
- define('R_P',getdirname(__FILE__));
- define('D_P',R_P);
- require_once(R_P.'require/common.php');
- include_once(D_P.'data/bbscache/config.php');
- //require_once(R_P.'admin/cache.php');
- @header("Content-Type:text/html; charset=$db_charset");
- include_once(D_P.'data/sql_config.php');
- //if ($database=='mysqli' && Pwloaddl('mysqli')===false) {
- $database = 'mysql';
- //}
- require_once Pcv(R_P."require/db_$database.php");
- $db = new DB($dbhost,$dbuser,$dbpw,$dbname,$PW,$charset,$pconnect);
- $t_k = $_GET['t_k'];
- $action = $_GET['action'];
- $start = $_GET['start'];
- if(!$action){
- $action = 1;
- }
- if(!$start){
- $start = 0;
- }
- if(!$t_k){
- $t_k = 0;
- }
- $percount = 2000;
- if (empty($action)) {
- echo '<a href="update_ifconvert.php?action=step1">开始运行修复html帖和windcode的工具</a>';exit;
- } elseif ($action == 'step1') {
- $query = $db->query("SELECT * FROM pw_tmsgs WHERE tid>$start LIMIT $percount");
- unset($lastid);
- while ($rt = $db->fetch_array($query)){
- $lastid = $rt['tid'];
- $ifconvert = 1;
- $ifsign = 0;
- if(strpos($content,'<FONT')!==false || strpos($content,'[color')!==false){
- $ifconvert = 2;
- }
- if(strpos($content,'<FONT')!==false || strpos($content,'<span')!==false){
- $ifsign = 3;
- }
- $db->update("UPDATE pw_threads SET ifsign = '$ifsign',ifconvert='$ifconvert' WHERE tid=".$rt['tid']);
- }
- $db->free_result($query);
- $maxid = $db->get_value("SELECT max(tid) FROM pw_tmsgs");
- echo '最大id',$maxid,'<br>','最后id',$lastid;
- if($lastid < $maxid){
- echo "<meta http-equiv='refresh' content='0;url=update_ifconvert.php?action=1&start=$lastid'>";
- }else{
- echo '更新update结束';exit;
- }
- }
- function getdirname($path=null){
- if (!empty($path)) {
- if (strpos($path,'\\')!==false) {
- return substr($path,0,strrpos($path,'\\')).'/';
- } elseif (strpos($path,'/')!==false) {
- return substr($path,0,strrpos($path,'/')).'/';
- }
- }
- return './';
- }
- ?>
|