<?php $config = loadconfig(); $db_source = new db_mysql($config['source']); $db_source->connect(); $db_target = new db_mysql($config['target']); $db_target->connect(); $db_uc = new db_mysql($config['ucenter']); if ($setting['config']['ucenter']) { $db_uc->connect(); } $process = load_process('main'); if (empty($process)) { showmessage("请首先选择转换程序", "index.php?action=select&source={$source}"); } $prg = getgpc('prg'); $prg_dir['tables'] = DISCUZ_ROOT . './source/' . $source . '/table/'; $prg_dir['start'] = DISCUZ_ROOT . './source/' . $source . '/'; $prg_dir['steps'] = DISCUZ_ROOT . './source/' . $source . '/'; $prg_done = 0; $prg_next = ''; $prg_total = $prg_total = count($process['tables']) + count($process['start']) + count($process['steps']); foreach (array('start', 'tables', 'steps') as $program) { if (!empty($process[$program]) && !$process[$program . '_is_end']) { foreach ($process[$program] as $k => $v) { if ($v) { $prg_done++; } elseif ($prg_next == '') { $prg_next = $k; } }
<?php /*********************/ /* */ /* Version : 5.1.0 */ /* Author : RM */ /* Comment : 071223 */ /* */ /*********************/ require "db_config.php"; require "db_mysql.class.php"; require "../cache/site_config.php"; date_default_timezone_set("PRC"); $db = new db_mysql(); $db->connect($dbhost, $dbuser, $dbpw, $dbname, $dbpconnect, $dbcharset);
<?php //header('Content-Type: text/html; charset=utf-8'); $dbhost = "192.168.0.95"; //数据库地址 $dbuser = "******"; //MySql数据库用户名 $dbpass = "******"; //MySql数据库密码 $dbname = "crm20140704"; //MySql数据库名称 $dbcharset = "utf8"; //数据库读写所采用的编码,utf8或gb2312 if (empty($dbname)) { echo '<script>top.location="install.php";</script>'; } require_once 'db_function.php'; //数据库操作类 require_once 'function.php'; //引用函数 /*------------------------------------------------ * 数据库连接 *-----------------------------------------------*/ $db = new db_mysql(); $db->connect($dbhost, $dbuser, $dbpass, $dbname, $dbcharset); //mysql_query("set names utf8"); /*防止 PHP 5.1.x 使用时间函数报错*/ if (function_exists('date_default_timezone_set')) { date_default_timezone_set('PRC'); }
if (is_array($newconfig)) { $checkarray = $setting['config']['ucenter'] ? array('source', 'target', 'ucenter') : array('source', 'target'); foreach ($checkarray as $key) { if (!empty($newconfig[$key]['dbhost'])) { $check = mysql_connect_test($newconfig[$key], $key); if ($check < 0) { $error[$key] = lang('mysql_connect_error_' . abs($check)); } } else { $error[$key] = lang('mysql_config_error'); } } save_config_file($configfile, $newconfig, $config_default); if (empty($error)) { $db_target = new db_mysql($newconfig['target']); $db_target->connect(); delete_process('all'); showmessage('config_success', 'index.php?a=select&source=' . $source); } } } showtips('如果无法显示设置项目,请删除文件 data/config.inc.php'); $config = loadconfig('config.inc.php'); if (empty($config)) { $config = $config_default; } show_form_header(); show_config_input('source', $config['source'], $error['source']); show_config_input('target', $config['target'], $error['target']); if ($setting['config']['ucenter']) { show_config_input('ucenter', $config['ucenter'], $error['ucenter']);
include_once DISCUZ_ROOT . './uc_client/lib/xml.class.php'; $post = xml_unserialize(file_get_contents('php://input')); if (in_array($get['action'], array('test', 'deleteuser', 'renameuser', 'gettag', 'synlogin', 'synlogout', 'updatepw', 'updatebadwords', 'updatehosts', 'updateapps', 'updateclient', 'updatecredit', 'getcredit', 'getcreditsettings', 'updatecreditsettings', 'addfeed'))) { $uc_note = new uc_note(); echo $uc_note->{$get}['action']($get, $post); exit; } else { exit(API_RETURN_FAILED); } } else { define('DISCUZ_ROOT', $app['extra']['apppath']); require_once DISCUZ_ROOT . './config/config_global.php'; require_once DISCUZ_ROOT . './source/class/class_core.php'; $discuz = new db_mysql(); $discuz->set_config($_config['db']); $discuz->connect(); } class uc_note { var $dbconfig = ''; var $db = ''; var $tablepre = ''; var $appdir = ''; function _serialize($arr, $htmlon = 0) { if (!function_exists('xml_serialize')) { include_once DISCUZ_ROOT . './uc_client/lib/xml.class.php'; } return xml_serialize($arr, $htmlon); } function uc_note()
$trade_status = $_GET['trade_status']; $dbconfig = (require_once dirname(__FILE__) . "/../../../mysqlconf.php"); require_once dirname(__FILE__) . "/../../../infoconfig.php"; $cfg['tb_pre'] = $dbconfig['DB_PREFIX']; $cfg['db_charset'] = 'utf8'; $cfg['sqlerr'] = '1'; $cfg['errlog'] = '1'; $cfg['timediff'] = '0'; $fr_time = time(); define('FR_ROOT', str_replace("\\", '/', dirname(__FILE__))); define('CACHE_ROOT', $cfg['cache_dir'] ? $cfg['cache_dir'] : FR_ROOT . '/cache'); define('DATA_ROOT', FR_ROOT . '/data'); include '../mysql.class.php'; $db = new db_mysql(); $db->halt = $cfg['sqlerr']; $db->connect($dbconfig['DB_HOST'], $dbconfig['DB_USER'], $dbconfig['DB_PWD'], $dbconfig['DB_NAME'], 0); if ($_GET['trade_status'] == 'TRADE_FINISHED' || $_GET['trade_status'] == 'TRADE_SUCCESS') { //判断该笔订单是否在商户网站中已经做过处理 //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序 //如果有做过处理,不执行商户的业务程序 $inquery = "UPDATE `{$cfg['tb_pre']}member_operation` SET sta=1 WHERE buyid='" . $out_trade_no . "'"; $db->query($inquery); $operation = $db->get_one("SELECT mid,`money`,pname FROM `{$cfg['tb_pre']}member_operation` where buyid='" . $out_trade_no . "' "); $mid = $operation['mid']; $pname = $operation['pname']; $score = $operation['money'] * $infoconfig['cfg_recharge']; $inquery = "UPDATE `{$cfg['tb_pre']}member` SET scores=scores+" . $score . " WHERE mid='" . $mid . "'"; $db->query($inquery); //insert log $inquery = "INSERT INTO `{$cfg['tb_pre']}score_log`(mid,score,typeid,summary,addtime) VALUES('" . $mid . "','" . $score . "','4','" . $pname . "(" . $operation['money'] . ")'," . time() . ") "; $db->query($inquery);
/** * 得到帖子信息 * @param $tid - 帖子ID * @param $returnpid - 返回首帖pid * @param $msgleng - 內容截斷的長度 */ function list_threads($tid = 0, $msgleng = 255) { global $_G, $_SC; $tid = intval($tid); $msgleng = intval($msgleng); $ret_thread = array(); if ($tid > 0) { $bbs_dbpre = $_SC['bbs_dbpre']; $db = new db_mysql(array(1 => array('tablepre' => $_SC['bbs_dbpre'], 'dbcharset' => $_SC['bbs_dbcharset'], 'dbhost' => $_SC['bbs_dbhost'], 'dbuser' => $_SC['bbs_dbuser'], 'dbpw' => $_SC['bbs_dbpw'], 'dbname' => $_SC['bbs_dbname']))); $db->connect(); //$db->charset = $_SC['bbs_dbcharset']; //$db->connect($_SC['bbs_dbhost'], $_SC['bbs_dbuser'], $_SC['bbs_dbpw'], $_SC['bbs_dbname'], 0, 1); $query = $db->query("SELECT pid, authorid, author, subject, message FROM {$bbs_dbpre}posts WHERE tid='{$tid}' AND first='1' LIMIT 1"); $ret_thread = $db->fetch_array($query); if (!empty($ret_thread['message'])) { $ret_thread['message'] = messagecutstr($ret_thread['message'], $msgleng); } $db->close(); unset($db); } return $ret_thread; }
} } @(include DT_ROOT . '/file/data/' . $name . '.inc.php'); include tpl('data_view'); exit; } break; case 'import': $data = array(); @(include DT_ROOT . '/file/data/' . $name . '.php'); $data = dstripslashes($data); extract($data); if ($database == 'mysql') { if ($db_host && $db_user && $db_name) { $sc = new db_mysql(); $sc->connect($db_host, $db_user, $db_pass, $db_name, $CFG['db_expires'], $CFG['db_charset'], $CFG['pconnect']); } else { $sc =& $db; } } else { if ($database == 'mssql') { require DT_ROOT . '/include/db_mssql.class.php'; $sc = new db_mssql(); $sc->connect($db_host, $db_user, $db_pass, $db_name); } else { if ($database == 'access') { require DT_ROOT . '/include/db_access.class.php'; $sc = new db_access(); $sc->connect(DT_ROOT . '/' . $db_host, $db_user, $db_pass, $db_table); } else { msg('配置文件错误');
function mysql_connect_test($config, $type) { global $setting; static $error_code = array('connect_error' => -1, 'table_error' => -2); static $db; $ret = true; if ($db === null) { require_once DISCUZ_ROOT . './include/db.class.php'; $db = new db_mysql(); } $db->set_config($config); $check = $db->connect(false); if (!$check) { $ret = $error_code['connect_error']; } else { if (isset($setting['tablecheck'][$type])) { $find = $db->fetch_first("SHOW TABLES LIKE '{$config[tablepre]}{$setting['tablecheck'][$type]}'"); if (!$find) { $ret = $error_code['table_error']; } } } $db->close(); return $ret; }
<?php include "config.php"; include "db_mysql.class.php"; $db = new db_mysql(); $db->connect($dbhost, $dbuser, $dbpwd, $dbname, $pconnect = 0);
<p>This converter will <strong>not</strong> update your phpMyFAQ version!</p> <p><strong>Please make a backup of your SQL tables before running this update.</strong></p> <p class="center"><input type="submit" value="Go to step 2 of 2" class="button" /></p> </fieldset> </form> <?php } /**************************** STEP 2 OF 2 ***************************/ if ($step == 2) { require_once "../inc/data.php"; require_once "../inc/config.php"; require_once "../inc/functions.php"; require_once "../inc/mysql.php"; define("SQLPREFIX", $DB["prefix"]); $db = new db_mysql(); $db->connect($DB["server"], $DB["user"], $DB["password"], $DB["db"]); $query[] = "UPDATE " . SQLPREFIX . "faqdata SET content = REPLACE(content, '[b]', '<strong>')"; $query[] = "UPDATE " . SQLPREFIX . "faqdata SET content = REPLACE(content, '[/b]', '</strong>')"; $query[] = "UPDATE " . SQLPREFIX . "faqdata SET content = REPLACE(content, '[u]', '<span style=\"text-decoration: underline;\">')"; $query[] = "UPDATE " . SQLPREFIX . "faqdata SET content = REPLACE(content, '[/u]', '</span>')"; $query[] = "UPDATE " . SQLPREFIX . "faqdata SET content = REPLACE(content, '[i]', '<em>')"; $query[] = "UPDATE " . SQLPREFIX . "faqdata SET content = REPLACE(content, '[/i]', '</em>')"; $query[] = "UPDATE " . SQLPREFIX . "faqdata SET content = REPLACE(content, '[ul]', '<ul>')"; $query[] = "UPDATE " . SQLPREFIX . "faqdata SET content = REPLACE(content, '[/ul]', '</ul>')"; $query[] = "UPDATE " . SQLPREFIX . "faqdata SET content = REPLACE(content, '[list]', '<ul>')"; $query[] = "UPDATE " . SQLPREFIX . "faqdata SET content = REPLACE(content, '[/list]', '</ul>')"; $query[] = "UPDATE " . SQLPREFIX . "faqdata SET content = REPLACE(content, '[li]', '<li>')"; $query[] = "UPDATE " . SQLPREFIX . "faqdata SET content = REPLACE(content, '[/li]', '</li>')"; $query[] = "UPDATE " . SQLPREFIX . "faqdata SET content = REPLACE(content, '[center]', '<div style=\"text-align: center;\">')"; $query[] = "UPDATE " . SQLPREFIX . "faqdata SET content = REPLACE(content, '[/center]', '</div>')"; $query[] = "UPDATE " . SQLPREFIX . "faqdata SET content = REPLACE(content, '[php]', '<pre class=\"php\">')";
<?php header('Content-Type: text/html; charset=utf-8'); require_once 'database.inc.php'; //数据库配置文件 require_once 'db_mysql.php'; //数据库操作类 $db = new db_mysql(); //构建数据库操作对象实例 $db->connect(DB_HOST, DB_USER, DB_PWD, DB_NAME, DB_CHARSET); //连接到数据库,保存连接为变量$db /*防止 PHP 5.1.x 使用时间函数报错*/ if (function_exists('date_default_timezone_set')) { date_default_timezone_set('PRC'); }
function syncpost($itemid, $mname) { if (!in_array($mname, array('album', 'good', 'notice', 'consume', 'groupbuy'))) { if ($mname == 'album') { syncalbum($itmeid); return false; } } global $_G, $_SC, $_SGLOBAL; $bbs_dbpre = $_SC['bbs_dbpre']; $db = new db_mysql(array(1 => array('tablepre' => $_SC['bbs_dbpre'], 'dbcharset' => $_SC['bbs_dbcharset'], 'dbhost' => $_SC['bbs_dbhost'], 'dbuser' => $_SC['bbs_dbuser'], 'dbpw' => $_SC['bbs_dbpw'], 'dbname' => $_SC['bbs_dbname'], 'silent' => true))); $db->connect(); $item = DB::fetch_first("SELECT i.*, m.* FROM " . DB::table($mname . "items") . " i LEFT JOIN " . DB::table($mname . "message") . " m ON i.itemid = m.itemid WHERE i.itemid = '{$itemid}' AND i.grade = 3"); if (empty($item)) { $db->close(); unset($db); return false; } getpanelinfo($item['shopid']); $fid = $_SGLOBAL['panelinfo']['syncfid']; if (!checkbbsfid($fid)) { $db->close(); unset($db); return false; } //插入主題信息 $author = $_SGLOBAL['panelinfo']['username']; $authorid = $_SGLOBAL['panelinfo']['uid']; $subject = "[" . b_lang($mname) . "]" . $item['subject']; $message = postformat($mname, $item); $posttable_info = $db->result_first("SELECT svalue FROM {$bbs_dbpre}common_setting WHERE skey = 'posttable_info'"); $posttableid = 0; if (!empty($posttable_info)) { $posttable_info = unserialize($posttable_info); if (is_array($posttable_info)) { foreach ($posttable_info as $key => $info) { if ($info['type'] == 'primary') { $posttableid = $key; } } } } if (!$posttableid) { $tablename = 'forum_post'; } else { $tablename = "forum_post_{$posttableid}"; } if (empty($item['bbstid'])) { $db->query("INSERT INTO {$bbs_dbpre}forum_thread (fid, posttableid, author, authorid, subject, dateline, lastpost, lastposter)\n VALUES ('{$fid}', '{$posttableid}', '{$author}', '{$authorid}', '{$subject}', '{$_G['timestamp']}', '{$_G['timestamp']}', '{$author}')"); $tid = $db->insert_id(); $db->query("UPDATE {$bbs_dbpre}common_member_field_home SET recentnote = '{$subject}' WHERE uid = '{$authorid}'"); $db->query("INSERT INTO {$bbs_dbpre}forum_post_tableid (pid) values (null)"); $pid = $db->insert_id(); if ($pid % 1024 == 0) { $db->query("DELETE FROM {$bbs_dbpre}forum_post_tableid WHERE pid<{$pid}"); } $db->query("REPLACE INTO {$bbs_dbpre}common_syscache (cname, ctype, dateline, data) VALUES ('max_post_id', '0', '{$_G['timestamp']}', '{$pid}')"); if (!$posttableid) { $tablename = 'forum_post'; } else { $tablename = "forum_post_{$posttableid}"; } $db->query("INSERT INTO {$bbs_dbpre}{$tablename} SET `fid`='{$fid}',`tid`='{$tid}',`first`='1',`author`='{$author}',`authorid`='{$authorid}',`subject`='{$subject}',`dateline`='{$_G['timestamp']}',`message`='{$message} ',`useip`='unknown',`invisible`='0',`anonymous`='0',`usesig`='1',`htmlon`='0',`bbcodeoff`='0',`smileyoff`='-1',`parseurloff`='',`attachment`='0',`tags`='',`pid`='{$pid}'"); $db->query("UPDATE {$bbs_dbpre}forum_forum SET lastpost='{$tid} {$subject} {$_G[timestamp]} {$author}', threads=threads+1, posts=posts+1, todayposts=todayposts+1 WHERE fid='{$fid}'"); $db->query("UPDATE {$bbs_dbpre}common_stat SET `thread`=`thread`+1 WHERE daytime='" . date("Ymd", $_G[timestamp]) . "'"); updatetable($mname . 'items', array('bbstid' => $tid), array('itemid' => $item['itemid'])); } else { $tid = $item['bbstid']; $db->query("UPDATE {$bbs_dbpre}forum_thread SET subject='" . $subject . "' WHERE tid='{$tid}'"); $pid = $db->result_first("SELECT pid FROM {$bbs_dbpre}{$tablename} WHERE tid = '{$tid}' AND first = 1"); $db->query("UPDATE {$bbs_dbpre}{$tablename} SET message='{$message}' WHERE pid='{$pid}' AND tid = '{$tid}' AND first = 1"); } }