Exemple #1
0
function check_authority()
{
    require GAME_ROOT . './include/modules/core/sys/config/server.config.php';
    $_COOKIE = gstrfilter($_COOKIE);
    $cuser = $_COOKIE[$gtablepre . 'user'];
    $cpass = $_COOKIE[$gtablepre . 'pass'];
    require GAME_ROOT . './include/db_' . $database . '.class.php';
    $db = new dbstuff();
    $db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
    unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
    $result = $db->query("SELECT * FROM {$gtablepre}users WHERE username='******'");
    if (!$db->num_rows($result)) {
        echo "<span><font color=\"red\">Cookie无效,请登录。</font></span><br>";
        die;
    }
    $udata = $db->fetch_array($result);
    if ($udata['password'] != $cpass) {
        echo "<span><font color=\"red\">Cookie无效,请登录。</font></span><br>";
        die;
    } elseif ($udata['groupid'] < 9 && $cuser !== $gamefounder) {
        echo "<span><font color=\"red\">要求至少9权限。</font></span><br>";
        die;
    }
    unset($db);
    unset($cuser);
    unset($cpass);
    unset($udata);
    unset($result);
}
 public function update_user_credit($mobile, $credit)
 {
     //$mobile = '18782963909';
     //$credit = 1;
     $db = new dbstuff();
     $db->connect(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, 0);
     $sql = "SELECT `uid` FROM " . DZ_DBTABLEPRE . "common_member WHERE `username`={$mobile}";
     $result = $db->query($sql);
     if ($db->num_rows($result) == 0) {
         return false;
     } else {
         $row = $db->fetch_array($result);
         $uid = $row['uid'];
         $sql = "SELECT * FROM " . DZ_DBTABLEPRE . "common_member_count WHERE `uid`={$uid}";
         $result = $db->query($sql);
         if ($db->num_rows($result) == 0) {
             return false;
         } else {
             $row = $db->fetch_array($result);
             if ($row['extcredits2'] < $credit) {
                 return false;
             } else {
                 //print_r($row);$row['extcredits2'] = 376;
                 $new_credit = $row['extcredits2'] - $credit;
                 $sql = 'UPDATE ' . DZ_DBTABLEPRE . "common_member_count SET extcredits2='{$new_credit}' WHERE uid='{$uid}'";
                 $re = $db->query($sql);
                 if ($db->num_rows($re) == 0) {
                     return false;
                 } else {
                     return true;
                 }
             }
         }
     }
 }
function getImCount()
{
    $db_uch = new dbstuff();
    $db_uch->charset = dbcharset;
    $db_uch->connect(dbhost, dbuser, dbpw, dbname, pconnect);
    $result = $db_uch->result($db_uch->query("SELECT COUNT(*) FROM " . tname("spacefield") . " WHERE qq <> ''"), 0);
    return $result;
}
 public function UcenterLogin($data)
 {
     $db = new dbstuff();
     $db->connect(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, 0);
     list($uid, $username, $email) = uc_get_user($data['username']);
     if (is_null($uid)) {
         $_data['email'] = $data['email'];
         $_data['username'] = $data['username'];
         $_data['password'] = $data['password'];
         $_data['user_id'] = $data['user_id'];
         $uid = self::UcenterReg($_data);
         return self::UcenterLogin($data);
     } else {
         $ucsynlogin = uc_user_synlogin($uid);
     }
     //var_dump($uid);
     return $ucsynlogin;
 }
Exemple #5
0
	function loadmultiserver($type = '') {
		global $db, $dbcharset, $multiserver;
		$type = empty($type) && defined('CURSCRIPT') ? CURSCRIPT : $type;
		static $sdb = null;
		if($type && !empty($multiserver['enable'][$type])) {
			if(!is_a($sdb, 'dbstuff')) $sdb = new dbstuff();
			if($sdb->link > 0) {
				return $sdb;
			} elseif($sdb->link === null && (!empty($multiserver['slave']['dbhost']) || !empty($multiserver[$type]['dbhost']))) {
				$setting = !empty($multiserver[$type]['host']) ? $multiserver[$type] : $multiserver['slave'];
				$sdb->connect($setting['dbhost'], $setting['dbuser'], $setting['dbpw'], $setting['dbname'], $setting['pconnect'], false, $dbcharset);
				if($sdb->link) {
					return $sdb;
				} else {
					$sdb->link = -32767;
				}
			}
		}
		return $db;
	}
Exemple #6
0
    {
        api_msg('run_sql_error', $message . '<br /><br />' . $sql . '<br /> ' . mysql_error());
    }
}
$db = new dbstuff();
$version = '';
if ($apptype == 'discuz') {
    //note discuz
    define('BACKUP_DIR', ROOT_PATH . 'forumdata/');
    //note 數據庫備份文件放置路徑
    $tablepre = $tablepre;
    //note 表前綴賦值,不同的產品請修改此表達式
    if (empty($dbcharset)) {
        $dbcharset = in_array(strtolower($charset), array('gbk', 'big5', 'utf-8')) ? str_replace('-', '', $charset) : '';
    }
    $db->connect($dbhost, $dbuser, $dbpw, $dbname, $dbcharset, $pconnect, $tablepre);
    define('IN_DISCUZ', true);
    include ROOT_PATH . 'discuz_version.php';
    $version = DISCUZ_VERSION;
} elseif ($apptype == 'uchome' || $apptype == 'supesite' || $apptype == 'brand' || $apptype == 'other') {
    //note uchome
    define('BACKUP_DIR', ROOT_PATH . './data/');
    //note 數據庫備份文件放置路徑
    $tablepre = $_SC['tablepre'];
    //note 表前綴賦值,不同的產品請修改此表達式
    $dbcharset = $_SC['dbcharset'];
    $db->connect($_SC['dbhost'], $_SC['dbuser'], $_SC['dbpw'], $_SC['dbname'], $dbcharset, $_SC['pconnect'], $tablepre);
} elseif ($apptype == 'ucenter') {
    //note ucenter
    define('BACKUP_DIR', ROOT_PATH . './data/backup/');
    //note 數據庫備份文件放置路徑
    }
    $keywords['general'] = $generalnew;
    $threadlist = array();
    if ($relatedthreadlist) {
        foreach ($relatedthreadlist as $key => $relatedthread) {
            if ($relatedthread['insite'] == 1) {
                $threadlist['bbsthread'][] = $relatedthread;
            } elseif ($qihoo['relate']['webnum']) {
                if (empty($qihoo['relate']['banurl']) || !preg_match($qihoo['relate']['banurl'], $relatedthread['tid'])) {
                    $threadlist['webthread'][] = $relatedthread;
                }
            }
        }
        $threadlist['bbsthread'] = $threadlist['bbsthread'] ? array_slice($threadlist['bbsthread'], 0, $qihoo['relate']['bbsnum']) : array();
        $threadlist['webthread'] = $threadlist['webthread'] ? array_slice($threadlist['webthread'], 0, $qihoo['relate']['bbsnum'] - count($threadlist['bbsthread'])) : array();
        $relatedthreadlist = array_merge($threadlist['bbsthread'], $threadlist['webthread']);
    }
    $keywords['general'] = $keywords['general'][0] ? implode("\t", $keywords['general']) : '';
    $keywords['trade'] = $keywords['trade'][0] ? implode("\t", $keywords['trade']) : '';
    $relatedthreads = $relatedthreadlist ? addslashes(serialize($relatedthreadlist)) : '';
    $expiration = $nextuptime ? $nextuptime : $timestamp + 86400;
    require_once './include/db_' . $database . '.class.php';
    $db = new dbstuff();
    $db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
    $db->select_db($dbname);
    unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
    $db->query("REPLACE INTO {$tablepre}relatedthreads (tid, type, expiration, keywords, relatedthreads)\r\n\t\tVALUES ('{$tid}', 'general', '{$expiration}', '{$keywords['general']}', '{$relatedthreads}')", 'UNBUFFERED');
    if ($relatedadstatus && $keywords['trade']) {
        $db->query("REPLACE INTO {$tablepre}relatedthreads (tid, type, expiration, keywords, relatedthreads)\r\n\t\t\tVALUES ('{$tid}', 'trade', '{$expiration}', '{$keywords['trade']}', '{$relatedthreads}')", 'UNBUFFERED');
    }
}
error_reporting(7);
$mtime = explode(' ', microtime());
$starttime = $mtime[1] + $mtime[0];
$prev = $_SERVER['HTTP_REFERER'];
$addtime = time();
$action = $_POST['action'];
$act = $_GET['act'];
$refer = $_POST['refer'] ? $_POST['refer'] : $_GET['refer'];
//返回地址
$backto = $_POST['backto'] ? $_POST['backto'] : $_GET['backto'];
//ajax 回调
$urlrefer = $_COOKIE["urlrefer"];
include ET_ROOT . "/include/db_mysql.class.php";
include ET_ROOT . '/config.inc.php';
$db = new dbstuff();
$db->connect($server, $db_username, $db_password, $db_name, $pconnect, true);
@mysql_query("set names utf8");
include ET_ROOT . "/include/template.class.php";
include ET_ROOT . '/include/etfunctions.func.php';
include ET_ROOT . '/include/cache.inc.php';
$setok = trim($_COOKIE["setok"]);
dsetcookie('setok', -1);
if (!$API) {
    if (is_admin_path == "yes") {
        $options = array('template_dir' => '../admin/templates', 'cache_dir' => '../admin/templates/cache', 'auto_update' => true, 'cache_lifetime' => 0);
    } else {
        $options = array('template_dir' => './templates', 'cache_dir' => './templates/cache', 'auto_update' => true, 'cache_lifetime' => 0);
    }
    $template = Template::getInstance();
    $template->setOptions($options);
}
Exemple #9
0
 if (strpos($tablepre, '.') !== false) {
     show_msg('tablepre_invalid', $tablepre, 0);
 }
 if ($username && $password) {
     if (strlen($username) > 15 || preg_match("/^\$|^c:\\con\\con\$| |[,\"\\s\t\\<\\>&]|^游客|^Guest/is", $username)) {
         show_msg('admin_username_invalid', $username, 0);
     }
 } else {
     show_msg('admininfo_invalid', '', 0);
 }
 show_header();
 $confstatus = config_edit();
 if ($confstatus['status'] == 1) {
     //入库
     $db = new dbstuff();
     $db->connect($dbhost . ":" . $dbport, $dbuser, $dbpw, $dbname, DBCHARSET);
     $sqlfile = 'sql/data.sql';
     $sql = file_get_contents($sqlfile);
     $sql = str_replace("\r\n", "\n", $sql);
     show_install();
     runquery($sql);
     $sqlfile = 'sql/other.sql';
     $sql = file_get_contents($sqlfile);
     $sql = str_replace("\r\n", "\n", $sql);
     runquery($sql);
     //系统设置中网站名称的修改
     /**
      * 转码
      */
     if (strtoupper(DBCHARSET) == 'GBK') {
         $username = iconv('UTF-8', 'GBK', $username);
Exemple #10
0
define('IN_DISCUZ', TRUE);
define('ROOT_PATH', dirname(__FILE__) . '/../');
@(include_once ROOT_PATH . './config/config_global.php');
define('CHARSET', $_config['output']['charset']);
define('DBCHARSET', $_config['db']['1']['dbcharset']);
$lock_file = ROOT_PATH . './data/restore.lock';
if (file_exists($lock_file)) {
    show_msg('restored_error');
}
require_once ROOT_PATH . './source/discuz_version.php';
$operation = trim(getgpc('operation', 'G'));
$operation = $operation ? $operation : 'import';
$phpself = htmlspecialchars($_SERVER['SCRIPT_NAME'] ? $_SERVER['SCRIPT_NAME'] : $_SERVER['PHP_SELF']);
$siteurl = htmlspecialchars('http://' . $_SERVER['HTTP_HOST'] . preg_replace("/\\/+(api)?\\/*\$/i", '', substr($phpself, 0, strrpos($phpself, '/'))) . '/');
$db = new dbstuff();
if (!@$db->connect($_config['db']['1']['dbhost'], $_config['db']['1']['dbuser'], $_config['db']['1']['dbpw'], $_config['db']['1']['dbname'], $_config['db']['1']['dbcharset'])) {
    show_msg('connect_error');
}
if ($operation == 'import') {
    if (!submitcheck('importsubmit', 1)) {
        $exportlog = $exportsize = $exportziplog = array();
        check_exportfile($exportlog, $exportziplog, $exportsize);
        if (empty($exportlog) && empty($exportziplog)) {
            show_msg('backup_file_unexist');
        }
        show_importfile_list($exportlog, $exportziplog, $exportsize);
    } else {
        $readerror = 0;
        $datafile_vol1 = trim(getgpc('datafile_vol1'));
        if ($datafile_vol1) {
            $datafile = $datafile_vol1;
Exemple #11
0
}
define('DBCHARSET', $dbcharset);
define('SiteUrl', $site_url);
if ($version != '20130705') {
    @header("Content-type: text/html; charset=UTF-8");
    echo "已经安装完成或版本错误,本程序只适用于“ShopNC 2.4”的系统。";
    exit;
}
$db = new dbstuff();
if (strtoupper(DBCHARSET) == 'GBK') {
    $dbcharset = 'gbk';
} else {
    $dbcharset = 'utf8';
}
$dbserver = $dbserver . ":" . $dbserver_port;
$db->connect($dbserver, $dbuser, $dbpasswd, $dbname, $dbcharset);
$tablepre = $db_pre;
$current = $_GET['act'];
if (is_file('../config.ini.php') && $current != '2') {
    @header("Content-type: text/html; charset=UTF-8");
    echo "您已经安装过微商城模块。";
    exit;
}
//新增表
function update_db()
{
    if (strtoupper(DBCHARSET) == 'GBK') {
        $sqlfile = 'gbk.sql';
    } else {
        $sqlfile = 'utf8.sql';
    }
Exemple #12
0
<?php

error_reporting(0);
ini_set("magic_quotes_runtime", 0);
define('IN_VWS', TRUE);
define('VWS_ROOT', substr(dirname(__FILE__), 0, -3));
function __autoload($className)
{
    if (preg_match('#Core$#', $className) && file_exists($classPath = VWS_ROOT . "/core/{$className}.php")) {
        include_once $classPath;
    }
}
include_once VWS_ROOT . '/core/DBCore.php';
include_once VWS_ROOT . '/core/DictCore.php';
include_once 'config.inc.php';
$db = new dbstuff();
$db->connect($dbhost, $dbuser, $dbpassword, $dbname);
Exemple #13
0
function init()
{
    global $gtablepre, $tablepre, $wtablepre, $room_prefix, $moveut, $moveutmin;
    global ${$gtablepre . 'user'}, ${$gtablepre . 'pass'}, $___MOD_SRV;
    if (isset($_COOKIE)) {
        $_COOKIE = gstrfilter($_COOKIE);
        foreach ($_COOKIE as $key => $value) {
            if ($key == $gtablepre . 'user' || $key == $gtablepre . 'pass') {
                ${$key} = $value;
            }
        }
    }
    ob_clean();
    ob_start();
    global $db;
    if (!isset($db)) {
        global $dbhost, $dbuser, $dbpw, $dbname, $pconnect, $database;
        require GAME_ROOT . './include/db_' . $database . '.class.php';
        $db = new \dbstuff();
        $db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
        //$db->select_db($dbname);
        unset($dbhost, $dbuser, $dbpw, $dbname, $pconnect);
    }
    global $___LOCAL_INPUT__VARS__INPUT_VAR_LIST;
    if (isset($___LOCAL_INPUT__VARS__INPUT_VAR_LIST[$gtablepre . 'user'])) {
        ${$gtablepre . 'user'} = $___LOCAL_INPUT__VARS__INPUT_VAR_LIST[$gtablepre . 'user'];
    }
    if (isset($___LOCAL_INPUT__VARS__INPUT_VAR_LIST[$gtablepre . 'pass'])) {
        ${$gtablepre . 'pass'} = $___LOCAL_INPUT__VARS__INPUT_VAR_LIST[$gtablepre . 'pass'];
    }
    if (isset($___LOCAL_INPUT__VARS__INPUT_VAR_LIST['___GAME_ROOMID'])) {
        $room_prefix = (string) $___LOCAL_INPUT__VARS__INPUT_VAR_LIST['___GAME_ROOMID'];
    } else {
        if (isset(${$gtablepre . 'user'})) {
            $result = $db->query("SELECT roomid FROM {$gtablepre}users where username='******'user'} . "'");
            if ($db->num_rows($result)) {
                $zz = $db->fetch_array($result);
                $room_prefix = $zz['roomid'];
            } else {
                $room_prefix = '';
            }
        } else {
            $room_prefix = '';
        }
    }
    $room_status = 0;
    if ($room_prefix != '' && $room_prefix != 'n' && $room_prefix[0] != 's') {
        $room_prefix = '';
    } else {
        if ($room_prefix != '' && $room_prefix[0] == 's') {
            $result = $db->query("SELECT status FROM {$gtablepre}rooms where roomid='" . substr($room_prefix, 1) . "'");
            if ($db->num_rows($result)) {
                $zz = $db->fetch_array($result);
                $room_status = $zz['status'];
                if ($zz['status'] == 0) {
                    $room_prefix = '';
                }
            } else {
                $room_prefix = '';
            }
        }
    }
    $tablepre = $gtablepre . $room_prefix;
    if ($room_prefix == '') {
        $wtablepre = $gtablepre;
    } else {
        $wtablepre = $gtablepre . $room_prefix[0];
    }
    //自动初始化表
    if ($room_prefix != '') {
        $result = $db->query("show tables like '{$wtablepre}winners';");
        if (!$db->num_rows($result)) {
            //某个非主房间是第一次使用,则创建表并初始化
            $db->query("create table if not exists {$wtablepre}winners like {$gtablepre}winners;");
        }
        $result = $db->query("show tables like '{$tablepre}game';");
        if (!$db->num_rows($result)) {
            //某个非主房间是第一次使用,则创建表并初始化
            $db->query("create table if not exists {$tablepre}game like {$gtablepre}game;");
            $result = $db->query("SELECT count(*) as cnt FROM {$tablepre}game");
            if (!$db->num_rows($result)) {
                $cnt = 0;
            } else {
                $zz = $db->fetch_array($result);
                $cnt = $zz['cnt'];
            }
            if ($cnt == 0) {
                $db->query("insert into {$tablepre}game (gamenum) values (0);");
            }
            $result = $db->query("SELECT count(*) as cnt FROM {$wtablepre}winners");
            if (!$db->num_rows($result)) {
                $cnt = 0;
            } else {
                $zz = $db->fetch_array($result);
                $cnt = $zz['cnt'];
            }
            if ($cnt == 0) {
                $db->query("insert into {$wtablepre}winners (gid) values (0);");
            }
            $sql = file_get_contents(GAME_ROOT . './gamedata/sql/reset.sql');
            $sql = str_replace("\r", "\n", str_replace(' bra_', ' ' . $tablepre, $sql));
            $db->queries($sql);
            $sql = file_get_contents(GAME_ROOT . './gamedata/sql/players.sql');
            $sql = str_replace("\r", "\n", str_replace(' bra_', ' ' . $tablepre, $sql));
            $db->queries($sql);
        }
    }
    //$errorinfo ? error_reporting(E_ALL) : error_reporting(0);
    date_default_timezone_set('Etc/GMT');
    //$now = time() + $moveutmin*60;
    global $now;
    $now = time() + $moveut * 3600 + $moveutmin * 60;
    global $sec, $min, $hour, $day, $month, $year, $wday;
    list($sec, $min, $hour, $day, $month, $year, $wday) = explode(',', date("s,i,H,j,n,Y,w", $now));
    //if($attackevasive) {
    //	include_once GAME_ROOT.'./include/security.inc.php';
    //}
    //COMBAT INFO INIT
    //已经一起做进数据库里了
    //global $hdamage,$hplayer,$noisetime,$noisepls,$noiseid,$noiseid2,$noisemode;
    //include GAME_ROOT.'./gamedata/combatinfo.php';
    //GAME INFO INIT
    global $now, $db, $tablepre;
    $result = $db->query("SELECT * FROM {$tablepre}game");
    global $gameinfo;
    $gameinfo = $db->fetch_array($result);
    foreach ($gameinfo as $key => $value) {
        global ${$key};
        ${$key} = $value;
    }
    if ($room_status == 2 && $gamestate == 0 && $room_prefix != '' && $room_prefix[0] == 's') {
        $db->query("UPDATE {$gtablepre}rooms SET status=1 WHERE roomid='" . substr($room_prefix, 1) . "'");
    }
    $arealist = explode(',', $arealist);
    global $cuser, $cpass;
    $cuser = ${$gtablepre . 'user'};
    $cpass = ${$gtablepre . 'pass'};
    //这里实在没办法,一堆文件都直接引用mode和command这两个来自input的变量,但又不能让所有文件都依赖input…… 只能恶心一下了……
    global $mode, $command, $___MOD_SRV;
    if ($___MOD_SRV) {
        global $___LOCAL_INPUT__VARS__mode, $___LOCAL_INPUT__VARS__command;
        global $___LOCAL_INPUT__VARS__INPUT_VAR_LIST;
        if (isset($___LOCAL_INPUT__VARS__INPUT_VAR_LIST['mode'])) {
            $mode = $___LOCAL_INPUT__VARS__INPUT_VAR_LIST['mode'];
        } else {
            $mode = $___LOCAL_INPUT__VARS__mode;
        }
        if (isset($___LOCAL_INPUT__VARS__INPUT_VAR_LIST['command'])) {
            $command = $___LOCAL_INPUT__VARS__INPUT_VAR_LIST['command'];
        } else {
            $command = $___LOCAL_INPUT__VARS__command;
        }
    } else {
        global $___LOCAL_INPUT__VARS__mode, $___LOCAL_INPUT__VARS__command;
        $mode = $___LOCAL_INPUT__VARS__mode;
        $command = $___LOCAL_INPUT__VARS__command;
    }
}
Exemple #14
0
<?php 
include_once './common.php';
include_once './class/db_mysql.class.php';
@(include_once './uc_client/client.php');
$devdb = new dbstuff();
$devdb->charset = 'utf8';
$devdb->connect('200.200.0.24', 'root', 'pr', 'sangfordedecmsv56utf', 0);
$catemap = array('技术支持' => array('id' => '196', 'type' => 'rdp'), '预研技能' => array('id' => '195', 'type' => 'rdp'), '测试技能' => array('id' => '194', 'type' => 'rdp'), '编码技能' => array('id' => '193', 'type' => 'rdp'), '设计技能' => array('id' => '193', 'type' => 'rdp'), '项目管理' => array('id' => '191', 'type' => 'rdp'), '产品规划' => array('id' => '190', 'type' => 'rdp'), 'C/C++编程' => array('id' => '197', 'type' => 'devtech'), '工具使用' => array('id' => '202', 'type' => 'devtech'), 'Windows开发' => array('id' => '200', 'type' => 'devtech'), 'Linux内核驱动' => array('id' => '199', 'type' => 'devtech'), 'Linux开发' => array('id' => '198', 'type' => 'devtech'), '调试技术' => array('id' => '201', 'type' => 'devtech'), '数据库' => array('id' => '203', 'type' => 'devtech'), '算法设计' => array('id' => '204', 'type' => 'devtech'), '协议分析' => array('id' => '205', 'type' => 'devtech'), '网络编程' => array('id' => '206', 'type' => 'devtech'), '性能优化' => array('id' => '207', 'type' => 'devtech'), '手机开发' => array('id' => '208', 'type' => 'devtech'), 'AC' => array('id' => '52', 'type' => 'modules'), 'WOC' => array('id' => '58', 'type' => 'modules'), '其他' => array('id' => '52', 'type' => 'modules'), '知识管理' => array('id' => '191', 'type' => 'rdp'), '常用命令' => array('id' => '198', 'type' => 'devtech'), '应用识别' => array('id' => '52', 'type' => 'modules'), '版本经理' => array('id' => '191', 'type' => 'rdp'), '用户认证' => array('id' => '52', 'type' => 'modules'), '企业文化' => array('id' => '1', 'type' => 'news'), '研发规范' => array('id' => '192', 'type' => 'rdp'), '开发工具' => array('id' => '202', 'type' => 'devtech'), '开发流程' => array('id' => '192', 'type' => 'rdp'), '部门风采' => array('id' => '1', 'type' => 'news'), 'SSL' => array('id' => '56', 'type' => 'modules'));
$reg_msg = array('-1' => '用户名非法', '-2' => '注册信息包括不允许的词', '-3' => '用户名已存在', '-4' => 'Email地址格式非法', '-5' => 'Email地址没有注册', '-6' => 'Email地址已被注册');
$cnt = 0;
$sqlstr = 'SELECT * FROM dede_member';
$query = $devdb->query($sqlstr);
while ($user = $devdb->fetch_array($query)) {
    //用户处理
    echo '<br />处理用户:' . $user['userid'] . '...';
    $newuid = uc_user_register($user['userid'], $user['pwd'], $user['email']);
    if ($newuid <= 0) {
        if ($newuid == -3) {
            echo '用户已存在,用户ID为:';
            list($newuid, $username, $email) = uc_get_user($user['userid']);
            echo $newuid . ' 原用户ID为:' . $user['mid'] . '<br />';
        } else {
            echo '<font color="red">注册用户失败:' . $reg_msg[$newuid] . ',跳过...</font><br />';
            $sqlstr0 = "SELECT * FROM dede_archives WHERE mid='" . $user['mid'] . "'";
            $query0 = $devdb->query($sqlstr0);
            while ($res0 = $devdb->fetch_array($query0)) {
                echo '其发表文章:' . $res0['title'] . '<br />';
            }
            continue;
        }
    } else {
Exemple #15
0
 function query($sql, $type = '')
 {
     if (preg_match("/^\\s*[Ss][Ee][Ll][Ee][Cc][Tt]/", $sql)) {
         return $this->rdb->query($sql, $type);
     }
     if (!$this->writeable) {
         dbstuff::connect($this->dbhost, $this->dbuser, $this->dbpw, $this->dbname, $this->pconnect, $this->halt);
         $this->writeable = true;
     }
     return dbstuff::query($sql, $type);
 }
Exemple #16
0
 }
 $timestamp = time();
 if ($timestamp - $get['time'] > 3600) {
     exit('Authracation has expiried');
 }
 if (empty($get)) {
     exit('Invalid Request');
 }
 $action = $get['action'];
 require_once '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', 'getcreditsettings', 'updatecreditsettings'))) {
     require_once 'include/db_mysql.class.php';
     $db_uc = new dbstuff();
     include "config.inc.php";
     $db_uc->connect(UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, UC_DBCONNECT);
     if ($get[username]) {
         $db_uc->query("SET NAMES gbk");
         $query = $db_uc->query("SELECT * FROM " . UC_DBTABLEPRE . "members WHERE `username`='{$get['username']}'");
         while ($uc_rs = $db_uc->fetch_array($query)) {
             $uc_info[] = $uc_rs;
         }
         $get['salt'] = $uc_info[0]['salt'];
         $get['email'] = $uc_info[0]['email'];
         $get['oldpass'] = $uc_info[0]['password'];
     }
     $uc_note = new uc_note();
     exit($uc_note->{$get}['action']($get, $post));
 } else {
     exit(API_RETURN_FAILED);
 }
Exemple #17
0
<?php

/**
 * 第二步
 */
define('IN_TP_COUPON', TRUE);
include_once './global.php';
include_once './classes/db.class.php';
if (isPost()) {
    $conf = (include '../Conf/db_config.php');
    $tablepre = $conf['DB_PREFIX'];
    $db = new dbstuff();
    $db->connect($conf['DB_HOST'], $conf['DB_USER'], $conf['DB_PWD'], $conf['DB_NAME'], DBCHARSET);
    include $template->getfile('116to117_2');
}
function add_db_tables()
{
    global $tablepre, $db;
    $sql = "CREATE TABLE `" . $tablepre . "mall_promotion` (\r\n  `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,\r\n  `cate_id` smallint(5) unsigned NOT NULL DEFAULT '0',\r\n  `m_id` mediumint(8) unsigned NOT NULL DEFAULT '0',\r\n  `m_name` varchar(200) NOT NULL,\r\n  `title` varchar(200) NOT NULL,\r\n  `gourl` varchar(150) NOT NULL DEFAULT '' COMMENT '购买跳转地址',\r\n  `description` text NOT NULL,\r\n  `logo` varchar(100) NOT NULL,\r\n  `sort_order` smallint(5) unsigned NOT NULL DEFAULT '9999',\r\n  `expiry` int(11) unsigned NOT NULL DEFAULT '0',\r\n  `addtime` int(11) unsigned NOT NULL DEFAULT '0',\r\n  PRIMARY KEY (`id`),\r\n  KEY `c_id` (`cate_id`),\r\n  KEY `m_id` (`m_id`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=" . DBCHARSET;
    $db->query($sql);
    showjsmessage('创建数据表:' . $tablepre . 'mall_promotion ... 完成');
    $sql = "CREATE TABLE `" . $tablepre . "zhekou_category` (\r\n  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,\r\n  `name` varchar(100) NOT NULL,\r\n  `sort_order` smallint(5) unsigned NOT NULL DEFAULT '1',\r\n  PRIMARY KEY (`id`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=" . DBCHARSET;
    $db->query($sql);
    showjsmessage('创建数据表:' . $tablepre . 'zhekou_category ... 完成');
    $sql = "CREATE TABLE `" . $tablepre . "mall_zhekou` (\r\n  `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,\r\n  `cate_id` smallint(5) unsigned NOT NULL DEFAULT '0',\r\n  `m_id` mediumint(8) unsigned NOT NULL DEFAULT '0',\r\n  `m_name` varchar(200) NOT NULL,\r\n  `title` varchar(200) NOT NULL,\r\n  `gourl` varchar(150) NOT NULL DEFAULT '' COMMENT '购买跳转地址',\r\n  `description` text NOT NULL,\r\n  `logo` varchar(100) NOT NULL,\r\n  `sort_order` smallint(5) unsigned NOT NULL DEFAULT '9999',\r\n  `price` float unsigned NOT NULL DEFAULT '0',\r\n  `addtime` int(11) unsigned NOT NULL DEFAULT '0',\r\n  `use_coupon` tinyint(1) unsigned NOT NULL DEFAULT '1',\r\n  PRIMARY KEY (`id`),\r\n  KEY `c_id` (`cate_id`),\r\n  KEY `m_id` (`m_id`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=" . DBCHARSET;
    $db->query($sql);
    showjsmessage('创建数据表:' . $tablepre . 'mall_zhekou ... 完成');
}
function add_site_config()
{
    global $tablepre, $db;
Exemple #18
0
 public function register()
 {
     $username = trim($_POST['username']);
     if (!$this->checkRight($username)) {
         exit("用户名不符合标准");
     }
     if (UC_START && UC_START == 'on') {
         @(include_once dirname(__FILE__) . '/../../config.inc.php');
         $uctable = explode('.', UC_DBTABLEPRE);
         $tablepre = substr($uctable[1], 0, -8);
         if (UC_KEY == "" || UC_API == "") {
             return "注册失败,请检查ucenter配置文件.";
         }
         include_once dirname(__FILE__) . '/../../uc_client/client.php';
         $passwd = trim($_REQUEST['passwd']);
         $email = $_REQUEST['email'];
         $uid = uc_user_register($username, $passwd, $email);
         if ($uid <= 0) {
             if ($uid == -6) {
                 $this->_tpl->assign('msg', '注册失败,email已注册');
             } elseif ($uid == -5) {
                 $this->_tpl->assign('msg', '注册失败,Email 不允许注册');
             } elseif ($uid == -4) {
                 $this->_tpl->assign('msg', '注册失败,Email 格式有误');
             } elseif ($uid == -3) {
                 $this->_tpl->assign('msg', '注册失败,用户名已经存在');
             } elseif ($uid == -2) {
                 $this->_tpl->assign('msg', '注册失败,包含不允许注册的词语');
             } elseif ($uid == -1) {
                 $this->_tpl->assign('msg', '注册失败,用户名不合法');
             }
             return $this->fetch('msg.html');
         } else {
             include_once dirname(__FILE__) . '/../../include/db_mysql.class.php';
             $db = new dbstuff();
             $conn = $db->connect(UC_DBHOST, UC_DBUSER, UC_DBPW);
             $password = md5($_REQUEST['passwd']);
             $sql = "INSERT INTO " . UC_DBNAME . "." . $tablepre . "common_member (`uid`,`email`,`username`,`password`)";
             $sql .= " VALUES ('{$uid}','{$email}','{$username}','{$password}')";
             @$db->query($sql);
             //at 管理员还是user
             if ($_REQUEST['at'] == 1) {
                 needRole('admin');
                 return header("Location:  /admin/index.php?c=user&a=pageUsers");
             }
             $this->_tpl->assign('msg', '注册成功');
             return $this->_tpl->fetch('msg.html');
         }
     }
     $money = daocall('setting', 'get', array('reg_user_price'));
     $result = daocall('user', 'newUser', array($username, trim($_REQUEST['passwd']), $_REQUEST['email'], $_REQUEST['name'], $_REQUEST['ids'], 0, $money));
     if ($result) {
         registerRole('user', $username);
         $external = $_REQUEST['external'];
         if ($external == '1') {
             $url = "?fc=user&fa=index";
         } else {
             $url = "?c=user&a=index";
         }
         header("Location: " . $url);
         die;
     } else {
         exit('注册失败');
     }
 }
Exemple #19
0
     show_msg('admininfo_invalid', '', 0);
 }
 $uid = DZUCFULL ? 1 : $adminuser['uid'];
 $authkey = substr(md5($_SERVER['SERVER_ADDR'] . $_SERVER['HTTP_USER_AGENT'] . $dbhost . $dbuser . $dbpw . $dbname . $username . $password . $pconnect . substr($timestamp, 0, 6)), 8, 6) . random(10);
 $_config['db'][1]['dbhost'] = $dbhost;
 $_config['db'][1]['dbname'] = $dbname;
 $_config['db'][1]['dbpw'] = $dbpw;
 $_config['db'][1]['dbuser'] = $dbuser;
 $_config['db'][1]['tablepre'] = $tablepre;
 $_config['admincp']['founder'] = (string) $uid;
 $_config['security']['authkey'] = $authkey;
 $_config['cookie']['cookiepre'] = random(4) . '_';
 $_config['memory']['prefix'] = random(6) . '_';
 save_config_file(ROOT_PATH . CONFIG, $_config, $default_config);
 $db = new dbstuff();
 $db->connect($dbhost, $dbuser, $dbpw, $dbname, DBCHARSET);
 if (!VIEW_OFF) {
     show_header();
     show_install();
 }
 if (DZUCFULL) {
     install_uc_server();
 }
 $sql = file_get_contents($sqlfile);
 $sql = str_replace("\r\n", "\n", $sql);
 runquery($sql);
 runquery($extrasql);
 $sql = file_get_contents(ROOT_PATH . './install/data/install_data.sql');
 $sql = str_replace("\r\n", "\n", $sql);
 runquery($sql);
 $onlineip = $_SERVER['REMOTE_ADDR'];
Exemple #20
0
     show_msg('数据表前缀为空,或者格式错误,请检查', $tablepre);
 }
 if ($admininfo['username'] && $admininfo['password'] && $admininfo['email'] && $admininfo['password'] == $admininfo['password2']) {
     if (StrLenW2($admininfo['username']) > 12 || StrLenW2($admininfo['username']) < 3 || !$admininfo['username']) {
         show_msg('非法用户名,用户名长度不应当超过 12 个英文字符,一般是中文,字母或者数字', $admininfo['username']);
     } elseif (!strstr($admininfo['email'], '@') || $admininfo['email'] != stripslashes($admininfo['email']) || $admininfo['email'] != htmlspecialchars($admininfo['email'])) {
         show_msg('Email 地址错误,此邮件地址已经被使用或者格式无效,请更换为其他地址', $admininfo['email']);
     }
 } else {
     show_msg('管理员信息不完整,请检查管理员账号,密码,邮箱', '');
 }
 save_config_file($dbinfo, QCS_ROOT . './Conf/config.inc.php');
 save_uc_config_file($dbinfo, QCS_ROOT . './Conf/uc_config.inc.php');
 touch($lockfile);
 $db = new dbstuff();
 $db->connect($dbinfo['dbhost'], $dbinfo['dbuser'], $dbinfo['dbpw'], $dbinfo['dbname'], 0, true);
 @mysql_query("set names utf8");
 $tablepre = $dbinfo['tablepre'];
 $sql = file_get_contents(QCS_ROOT . './install/include/data.sql');
 $sql = str_replace("\r\n", "\n", $sql);
 show_header();
 show_install();
 runquery($sql);
 $auth_code = generate_key();
 $invitecode = uniqid() . rand(1000, 9999);
 $regtime = time();
 $pwd = md5(strrev(md5($admininfo['password'])) . base64_encode($admininfo['password']));
 $db->query("INSERT INTO {$tablepre}user (name,pwd,province,city,county,email,invitecode,invitecount,regtime) VALUES ('{$admininfo['username']}', '{$pwd}','{$admininfo['province']}','{$admininfo['city']}','{$admininfo['county']}','{$admininfo['email']}','{$invitecode}',5,'{$regtime}');");
 $db->query("UPDATE {$tablepre}setting SET value = '{$auth_code}' WHERE name = 'auth_key'");
 $db->query("UPDATE {$tablepre}setting SET value = '{$dbinfo['sitename']}' WHERE name = 'site_name'");
 curl_post('http://www.quoracms.com/qcs/index.php?m=Index&a=addsite', "from=" . $default_appurl . "&type=install");
Exemple #21
0
			 <input type="submit" name="submit" value="提交" tabindex="3" />
			</div>
	        
	    </form>
	</div>';
	specialdiv();
	echo "<script>$('jsmenu').style.display='inline';</script>";
	htmlfooter();
	}
} elseif($action == 'dz_rpthreads') {//批量修复主题
//初始化数据库连接帐号
	define('IN_DISCUZ', TRUE);
	require_once TOOLS_ROOT."./config.inc.php";
	require_once TOOLS_ROOT."./include/db_mysql.class.php";
    	$db = new dbstuff;
	$db->connect($dbhost, $dbuser, $dbpw, $dbname, $pconnect, true, $dbcharset);
	$dbuser = $dbpw = $dbname = $pconnect = NULL;
  
	if($db->version > '4.1') {
			$serverset = "character_set_connection=$dbcharset, character_set_results=$dbcharset, character_set_client=binary";
			$serverset && $db->query("SET $serverset");
	}
	if($rpthreadssubmit) {
		  if(empty($start)) {
			  $start = 0;
		  }
		if($fids) {
			 if(is_array($fids)) {
				$fidstr = implode(',', $fids);
			 } else {
				$fidstr = $fids;
Exemple #22
0
function db_init()
{
    global $sqlfile, $db, $multitable, $step, $lockfile;
    if (!isset($_SESSION['dbinfo'])) {
        header("location: index.php?step=2");
    }
    $dbname = $_SESSION['dbinfo']['dbname'];
    $dbinfo = $_SESSION['dbinfo'];
    $adminpwd = $_SESSION['adminpwd'];
    $adminemail = $_SESSION['founderemail'];
    $multitable = $_SESSION['multitable'];
    $config = "<?php \r\ndefine('SSO_MODE', '{$_SESSION['sso_mode']}');\r\n";
    $config .= "define('MULTI_TABLE', '{$_SESSION['multitable']}');\r\n";
    $config .= '$GLOBALS ["gDataBase"] ["db"] = array (
  "dbname" => "' . $dbname . '",
  "type" => "mysql",
  "host" => "' . $dbinfo['dbhost'] . '",
  "port" => 3306,
  "user" => "' . $dbinfo['dbuser'] . '",
  "passwd" => "' . $dbinfo['dbpw'] . '",
  "charset"=> "utf8",
);
?>';
    $fp = fopen(CONFIG, 'w');
    fwrite($fp, $config);
    fclose($fp);
    $db = new dbstuff();
    $db->connect($dbinfo['dbhost'], $dbinfo['dbuser'], $dbinfo['dbpw'], $dbname, 'UTF8');
    $sql = file_get_contents($sqlfile);
    $sql = str_replace("\r\n", "\n", $sql);
    if (!VIEW_OFF) {
        show_install();
    }
    runquery($sql);
    $user['user'] = $adminemail;
    $user['user_email'] = $adminemail;
    $user['user_question'] = '';
    $user['user_answer'] = '';
    $user['user_password'] = md5(md5($adminpwd) . $user['user']);
    $user['user_nickname'] = 'administrator';
    $user['user_sex'] = 1;
    $user['user_reg_ip'] = '127.0.0.1';
    createNewUser($user);
    VIEW_OFF && show_msg('initdbresult_succ');
    $step++;
    if (!VIEW_OFF) {
        echo '<script type="text/javascript">document.getElementById("laststep").disabled=false;document.getElementById("laststep").value = \'' . lang('install_succeed') . '\';</script>' . "\r\n";
    }
}