• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP syntablestruct函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: runquery

function runquery($queries){//执行sql语句
	global $tablepre,$whereis;
	$sqlquery = splitsql(str_replace(array(' cdb_', ' {tablepre}', ' `cdb_'), array(' '.$tablepre, ' '.$tablepre, ' `'.$tablepre), $queries));
	$affected_rows = 0;
	foreach($sqlquery as $sql) {
	$sql = syntablestruct(trim($sql), $my_version > '4.1', $dbcharset);
	if(trim($sql) != '') {
		mysql_query(stripslashes($sql));
		if($sqlerror = mysql_error()) {
			break;
			} else {
			$affected_rows += intval(mysql_affected_rows());
			}
		}
	}
	if(strpos($queries,'seccodestatus') && $whereis == 'is_dz') {
		dz_updatecache();	
	}
	if(strpos($queries,'bbclosed') && $whereis == 'is_dz') {
		dz_updatecache();	
	}
	if(strpos($queries,'template') && $whereis == 'is_uch') {
		uch_updatecache();	
	}
	if(strpos($queries,'seccode_login') && $whereis == 'is_uch') {
		uch_updatecache();	
	}
	if(strpos($queries,'close') && $whereis == 'is_uch') {
		uch_updatecache();	
	}
	errorpage($sqlerror? $sqlerror : "数据库升级成功,影响行数:  $affected_rows",'数据库升级');

	if(strpos($queries,'settings') && $whereis == 'is_dz') {
		require_once './include/cache.func.php';
		updatecache('settings');		
	}
}
开发者ID:noikiy,项目名称:ejia,代码行数:37,代码来源:tools.php


示例2: fread

     if ($identify[3] == 'multivol') {
         $sqldump .= fread($fp, filesize($datafile_root));
     }
     fclose($fp);
 } else {
     if (isset($_GET['autoimport'])) {
         cpmessage('the_volumes_of_data_into_databases_success', 'admincp.php?ac=backup');
     } else {
         cpmessage('data_file_does_not_exist');
     }
 }
 if ($identify[3] == 'multivol') {
     $sqlquery = splitsql($sqldump);
     unset($sqldump);
     foreach ($sqlquery as $sql) {
         $sql = syntablestruct(trim($sql), $_SGLOBAL['db']->version() > '4.1', $_SC['dbcharset']);
         if (!empty($sql)) {
             $_SGLOBAL['db']->query($sql, 'SILENT');
             //Ignore error
             if ($_SGLOBAL['db']->error() && $_SGLOBAL['db']->errno() != 1062) {
                 $_SGLOBAL['db']->halt('MySQL Query Error', $sql);
             }
         }
     }
     if (isset($_GET['delunzip'])) {
         @unlink(S_ROOT . './data/' . $_GET['datafile']);
     }
     $identify[4] = intval($identify[4]);
     $datafile_next = preg_replace("/-({$identify['4']})(\\..+)\$/", '-' . ($identify[4] + 1) . '\\2', $_GET['datafile']);
     if ($identify[4] == 1) {
         $showform = 5;
开发者ID:v998,项目名称:discuzx-en,代码行数:31,代码来源:admincp_backup.php


示例3: trim

    }
}
if (isset($_GET['do'])) {
    $do = trim($_GET['do']);
    if ($do == "refresh" && !empty($_GET['id'])) {
        $datafile = DATA_PATH . "backup_" . $backupdir . DS . $_GET['id'];
        if (!file_exists($datafile)) {
            flash("file_not_exists");
        } else {
            if (@($fp = fopen($datafile, 'rb'))) {
                $sqldump = fread($fp, filesize($datafile));
                fclose($fp);
                $sqlquery = splitsql($sqldump);
                unset($sqldump);
                foreach ($sqlquery as $sql) {
                    $sql = syntablestruct(trim($sql), $db->version() > '4.1', $dbcharset);
                    if ($sql != '') {
                        $db->query($sql);
                        if (($sqlerror = $db->error()) && $db->errno() != 1062) {
                            $db->halt('MySQL Query Error', $sql);
                        }
                    }
                }
                flash("db_restored", "db.php?do=restore");
            } else {
                flash();
            }
        }
    }
    if ($do == "del" && !empty($_GET['id'])) {
        $datafile = DATA_PATH . "backup_" . $backupdir . DS . $_GET['id'];
开发者ID:renduples,项目名称:alibtob,代码行数:31,代码来源:db.php


示例4: template

 if ($checkperm !== true) {
     $msg = $checkperm;
     $msg_type = 'text-error';
     include template('database');
     exit;
 }
 $runquerys = array();
 //include_once(DZZ_ROOT.'source/admincp/admincp_quickquery.php');
 if (!submitcheck('sqlsubmit')) {
 } else {
     $queries = $_GET['queries'];
     $sqlquery = splitsql(str_replace(array(' {tablepre}', ' cdb_', ' `cdb_', ' pre_', ' `pre_'), array(' ' . $tablepre, ' ' . $tablepre, ' `' . $tablepre, ' ' . $tablepre, ' `' . $tablepre), $queries));
     $affected_rows = 0;
     foreach ($sqlquery as $sql) {
         if (trim($sql) != '') {
             $sql = !empty($_GET['createcompatible']) ? syntablestruct(trim($sql), $db->version() > '4.1', $dbcharset) : $sql;
             DB::query($sql, 'SILENT');
             if ($sqlerror = DB::error()) {
                 break;
             } else {
                 $affected_rows += intval(DB::affected_rows());
             }
         }
     }
     if ($sqlerror) {
         $msg = lang('template', 'database_run_query_invalid', array('sqlerror' => $sqlerror));
         $msg_type = 'text-error';
         $redirecturl = dreferer();
     } else {
         $msg = lang('template', 'database_run_query_succeed', array('affected_rows' => $affected_rows));
         $msg_type = 'text-success';
开发者ID:druphliu,项目名称:dzzoffice,代码行数:31,代码来源:database.php


示例5: mediumint

                 $indexoption[] = $identifier;
             }
         }
     }
     $create_table_sql .= ($create_tableoption_sql ? $create_tableoption_sql . ',' : '') . "tid mediumint(8) UNSIGNED NOT NULL DEFAULT '0',fid smallint(6) UNSIGNED NOT NULL DEFAULT '0',dateline int(10) UNSIGNED NOT NULL DEFAULT '0',expiration int(10) UNSIGNED NOT NULL DEFAULT '0',";
     $create_table_sql .= "KEY (fid), KEY(dateline)";
     if ($indexoption) {
         foreach ($indexoption as $index) {
             $create_table_sql .= "{$separator} KEY {$index} ({$index})\r\n";
             $separator = ' ,';
         }
     }
     $create_table_sql .= ") TYPE=MyISAM;";
     $dbcharset = empty($dbcharset) ? str_replace('-', '', CHARSET) : $dbcharset;
     $db = DB::object();
     $create_table_sql = syntablestruct($create_table_sql, $db->version() > '4.1', $dbcharset);
     DB::query($create_table_sql);
 } else {
     $tables = array();
     $db = DB::object();
     if ($db->version() > '4.1') {
         $query = DB::query("SHOW FULL COLUMNS FROM " . DB::table('forum_optionvalue') . "{$_G['gp_sortid']}", 'SILENT');
     } else {
         $query = DB::query("SHOW COLUMNS FROM " . DB::table('forum_optionvalue') . "{$_G['gp_sortid']}", 'SILENT');
     }
     while ($field = @DB::fetch($query)) {
         $tables[$field['Field']] = 1;
     }
     foreach ($addoption as $optionid => $option) {
         $identifier = $insertoptionid[$optionid]['identifier'];
         if (!$tables[$identifier]) {
开发者ID:pan289091315,项目名称:Discuz,代码行数:31,代码来源:admincp_threadtypes.php


示例6: fread

         $sqldump .= fread($fp, filesize($datafile));
     }
     fclose($fp);
 } else {
     if (getgpc('autoimport', 'G')) {
         touch($lock_file);
         show_msg('database_import_multivol_succeed', '', 'message', 1);
     } else {
         show_msg('database_import_file_illegal');
     }
 }
 if ($dumpinfo['method'] == 'multivol') {
     $sqlquery = splitsql($sqldump);
     unset($sqldump);
     foreach ($sqlquery as $sql) {
         $sql = syntablestruct(trim($sql), $db->version() > '4.1', DBCHARSET);
         if ($sql != '') {
             $db->query($sql, 'SILENT');
             if (($sqlerror = $db->error()) && $db->errno() != 1062) {
                 $db->halt('MySQL Query Error', $sql);
             }
         }
     }
     $delunzip = getgpc('delunzip', 'G');
     if ($delunzip) {
         @unlink($datafile);
     }
     $datafile_next = preg_replace("/-({$dumpinfo['volume']})(\\..+)\$/", "-" . ($dumpinfo['volume'] + 1) . "\\2", $datafile);
     $datafile_next = urlencode($datafile_next);
     if ($dumpinfo['volume'] == 1) {
         show_msg(lang('database_import_multivol_redirect', TRUE, array('volume' => $dumpinfo['volume'])), $siteurl . "restore.php?operation=import&datafile_server={$datafile_next}&autoimport=yes&importsubmit=yes&confirm=yes" . (!empty($delunzip) ? '&delunzip=yes' : ''), 'redirect');
开发者ID:v998,项目名称:discuzx-en,代码行数:31,代码来源:restore.php


示例7: DoImport

	function DoImport()
	{
		$this->CheckAdminPrivs('dbimport');
		extract($this->Post);
		extract($this->Get);
		$readerror = 0;
		$datafile = '';
		if($from == 'server') {
			$datafile = ROOT_PATH.'./'.$datafile_server;
		}
		$dbcharset = $this->DatabaseHandler->Charset;

		
		if(@$fp = fopen($datafile, 'rb')) {
			$sqldump = fgets($fp, 256);
			$identify = explode(',', base64_decode(preg_replace("/^# Identify:\s*(\w+).*/s", "\\1", $sqldump)));
			$dumpinfo = array('method' => $identify[3], 'volume' => intval($identify[4]));
			if($dumpinfo['method'] == 'multivol') {
				$sqldump .= fread($fp, filesize($datafile));
			}
			fclose($fp);
		} else {
			if($autoimport) {
				clearcache();
				$this->Messager('分卷数据成功导入数据库。',null);
			} else {
				$this->Messager('数据文件不存在: 可能服务器不允许上传文件或尺寸超过限制。',null);
			}
		}

		if($dumpinfo['method'] == 'multivol') {
			$sqlquery = splitsql($sqldump);
			unset($sqldump);
			$supetablepredot = strpos($supe['tablepre'], '.');
			$supe['dbname'] =  $supetablepredot !== FALSE ? substr($supe['tablepre'], 0, $supetablepredot) : '';

			foreach($sqlquery as $sql) {

				$sql = syntablestruct(trim($sql), $this->DatabaseHandler->GetVersion() > '4.1', $dbcharset);

				if(substr($sql, 0, 11) == 'INSERT INTO') {
					$sqldbname = substr($sql, 12, 20);
					$dotpos = strpos($sqldbname, '.');
					if($dotpos !== FALSE) {
						if(empty($supe['dbmode'])) {
							$sql = 'INSERT INTO `'.$supe['dbname'].'`.'.substr($sql, 13 + $dotpos);
						} else {
													}
					}
				}

				if($sql != '') {
					$this->DatabaseHandler->Query($sql, 'SKIP_ERROR');
					if(($sqlerror = $this->DatabaseHandler->GetLastErrorString()) && $this->DatabaseHandler->GetLastErrorNo() != 1062) {
						die('MySQL Query Error'.$sql);
					}
				}
			}

			if($delunzip) {
				@unlink($datafile_server);
			}

			$datafile_next = preg_replace("/-($dumpinfo[volume])(\..+)$/", "-".($dumpinfo['volume'] + 1)."\\2", $datafile_server);

			if($dumpinfo['volume'] == 1) {
				$to="admin.php?mod=db&code=doimport&from=server&datafile_server=".urlencode($datafile_next)."&autoimport=yes&importsubmit=yes".(!empty($delunzip) ? '&delunzip=yes' : '');
				$msg='            <form method="post" action="'.$to.'">
                    <br /><br /><br />分卷数据成功导入数据库,您需要自动导入本次其它的备份吗?<br /><br /><br /><br />
                    <input type="hidden" name="FORMHASH" value="'.FORMHASH.'"> &nbsp;
                    <input class="button" type="submit" name="confirmed" value=" 确 定 "> &nbsp;
                    <input class="button" type="button" value=" 取 消 " onClick="history.go(-1);">
                  </form><br />';
				$this->Messager($msg,null);
			} elseif($autoimport) {
				$this->Messager("数据文件 #{$dumpinfo['volume']} 成功导入,程序将自动继续。", "admin.php?mod=db&code=doimport&from=server&datafile_server=".urlencode($datafile_next)."&autoimport=yes&importsubmit=yes".(!empty($delunzip) ? '&delunzip=yes' : ''));
			} else {
				clearcache();
				$this->Messager('数据成功导入数据库。',null);
			}
		} elseif($dumpinfo['method'] == 'shell') {
			require './config.inc.php';
			list($dbhost, $dbport) = explode(':', $dbhost);

			$query = $this->DatabaseHandler->Query("SHOW VARIABLES LIKE 'basedir'");
			list(, $mysql_base) = $db->fetch_array($query, MYSQL_NUM);

			$mysqlbin = $mysql_base == '/' ? '' : addslashes($mysql_base).'bin/';
			shell_exec($mysqlbin.'mysql -h"'.$dbhost.($dbport ? (is_numeric($dbport) ? ' -P'.$dbport : ' -S"'.$dbport.'"') : '').
			'" -u"'.$dbuser.'" -p"'.$dbpw.'" "'.$dbname.'" < '.$datafile);

			clearcache();
			$this->Messager('数据成功导入数据库。',null);
		} else {
			$this->Messager('数据文件非 天天团购 格式,无法导入。');
		}

	}
开发者ID:pf5512,项目名称:phpstudy,代码行数:98,代码来源:db.mod.php


示例8: DoImport

    function DoImport()
    {
        if (true !== JISHIGOU_FOUNDER) {
            $this->Messager("为安全起见,只有网站创始人才能执行数据恢复操作。", null);
        }
        $readerror = 0;
        $datafile = '';
        $from = get_param('from');
        $datafile_server = get_param('datafile_server');
        $datafile_server = dir_safe($datafile_server);
        if (false == preg_match('~^\\.\\/data\\/backup\\/db\\/([\\w\\d\\-\\_]+)\\/\\1(\\-\\d+)?\\.sql$~i', $datafile_server)) {
            $this->Messager("文件名参数传递有误,请返回重试", null);
        }
        $autoimport = get_param('autoimport');
        $supe = get_param('supe');
        $delunzip = get_param('delunzip');
        if ($from == 'server') {
            $datafile = RELATIVE_ROOT_PATH . './' . $datafile_server;
        }
        $dbcharset = $this->DatabaseHandler->Charset;
        if ($datafile && false != ($fp = @fopen($datafile, 'rb'))) {
            $sqldump = fgets($fp, 256);
            $identify = explode(',', base64_decode(preg_replace("/^# Identify:\\s*(\\w+).*/s", "\\1", $sqldump)));
            $dumpinfo = array('method' => $identify[3], 'volume' => intval($identify[4]));
            if ($dumpinfo['method'] == 'multivol') {
                $sqldump .= @fread($fp, filesize($datafile));
            }
            fclose($fp);
        } else {
            if ($autoimport) {
                cache_clear();
                $this->Messager('分卷数据成功导入数据库。', null);
            } else {
                $this->Messager('数据文件不存在: 可能服务器不允许上传文件或尺寸超过限制。', null);
            }
        }
        if ($dumpinfo['method'] == 'multivol') {
            $sqlquery = splitsql($sqldump);
            unset($sqldump);
            $supetablepredot = strpos($supe['tablepre'], '.');
            $supe['dbname'] = $supetablepredot !== FALSE ? substr($supe['tablepre'], 0, $supetablepredot) : '';
            foreach ($sqlquery as $sql) {
                $sql = syntablestruct(trim($sql), $this->DatabaseHandler->GetVersion() > '4.1', $dbcharset);
                if (substr($sql, 0, 11) == 'INSERT INTO') {
                    $sqldbname = substr($sql, 12, 20);
                    $dotpos = strpos($sqldbname, '.');
                    if ($dotpos !== FALSE) {
                        if (empty($supe['dbmode'])) {
                            $sql = 'INSERT INTO `' . $supe['dbname'] . '`.' . substr($sql, 13 + $dotpos);
                        } else {
                        }
                    } else {
                        $sql = 'REPLACE INTO ' . substr($sql, 11);
                    }
                }
                if ($sql != '') {
                    $this->DatabaseHandler->Query($sql, 'SKIP_ERROR');
                    if (($sqlerror = $this->DatabaseHandler->GetLastErrorString()) && $this->DatabaseHandler->GetLastErrorNo() != 1062) {
                        die('MySQL Query Error' . $sql);
                    }
                }
            }
            if ($delunzip) {
                @unlink($datafile_server);
            }
            $datafile_next = preg_replace("/\\-({$dumpinfo['volume']})(\\.sql)\$/i", "-" . ($dumpinfo['volume'] + 1) . "\\2", $datafile_server);
            if ($dumpinfo['volume'] == 1) {
                $to = "admin.php?mod=db&code=doimport&from=server&datafile_server=" . urlencode($datafile_next) . "&autoimport=yes&importsubmit=yes" . (!empty($delunzip) ? '&delunzip=yes' : '');
                $msg = '<form method="post" action="' . $to . '">
					<input type="hidden" name="FORMHASH" value="' . FORMHASH . '"  />
                    <br /><br /><br />分卷数据成功导入数据库,您需要自动导入本次其它的备份吗?<br /><br /><br /><br />
                    <input class="button" type="submit" name="confirmed" value=" 确 定 "> &nbsp;
                    <input class="button" type="button" value=" 取 消 " onClick="history.go(-1);">
                  </form><br />';
                $this->Messager($msg, null);
            } elseif ($autoimport) {
                $this->Messager("数据文件 #{$dumpinfo['volume']} 成功导入,程序将自动继续。", "admin.php?mod=db&code=doimport&from=server&datafile_server=" . urlencode($datafile_next) . "&autoimport=yes&importsubmit=yes" . (!empty($delunzip) ? '&delunzip=yes' : ''));
            } else {
                cache_clear();
                $this->Messager('数据成功导入数据库。', null);
            }
        } else {
            $this->Messager('数据文件非 JishiGou 格式,无法导入。');
        }
    }
开发者ID:YouthAndra,项目名称:huaitaoo2o,代码行数:85,代码来源:db.mod.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP sysMsg函数代码示例发布时间:2022-05-23
下一篇:
PHP sync_snort_package_config函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap