コード例 #1
0
ファイル: annotation.php プロジェクト: sdgdsffdsfff/docs-1
function render_entities($dbc, $id)
{
    $keywords = get_keywords($dbc, $id);
    foreach ($keywords as $keyword) {
        echo '<a href="#" >' . $keyword . '</a><br>';
        echo '<p>' . get_def($dbc, $keyword) . '</p>';
        //echo '<br>';
    }
}
コード例 #2
0
ファイル: main.php プロジェクト: winddramon/dts
function get_att(&$pa, &$pd, $active)
{
    if (eval(__MAGIC__)) {
        return $___RET_VALUE;
    }
    eval(import_module('armor'));
    $var_407 = 0;
    if ($pa['hp'] < $pa['mhp'] / 2 && \skillbase\skill_query(407, $pa) && check_unlocked407($pa)) {
        $var_407 = get_def($pd, $pa, $active);
    }
    return $chprocess($pa, $pd, $active) + $var_407 / 2;
}
コード例 #3
0
ファイル: backup.php プロジェクト: stweil/glpi
/**  Backup a glpi DB
 *
 * @param $DB        DB object
 * @param $dumpFile  dump file
 * @param $duree     max delay before refresh
 * @param $rowlimit  rowlimit to backup in one time
**/
function backupMySql($DB, $dumpFile, $duree, $rowlimit)
{
    global $TPSCOUR, $offsettable, $offsetrow, $cpt;
    // $dumpFile, fichier source
    // $duree=timeout pour changement de page (-1 = aucun)
    if (function_exists('gzopen')) {
        $fileHandle = gzopen($dumpFile, "a");
    } else {
        $fileHandle = gzopen64($dumpFile, "a");
    }
    if (!$fileHandle) {
        //TRANS: %s is the name of the file
        echo sprintf(__('Unauthorized access to the file %s'), $dumpFile) . "<br>";
        return false;
    }
    if ($offsettable == 0 && $offsetrow == -1) {
        $time_file = date("Y-m-d-H-i");
        $cur_time = date("Y-m-d H:i");
        $todump = "#GLPI Dump database on {$cur_time}\n";
        gzwrite($fileHandle, $todump);
    }
    $result = $DB->list_tables();
    $numtab = 0;
    while ($t = $DB->fetch_row($result)) {
        $tables[$numtab] = $t[0];
        $numtab++;
    }
    for (; $offsettable < $numtab; $offsettable++) {
        // Dump de la structure table
        if ($offsetrow == -1) {
            $todump = "\n" . get_def($DB, $tables[$offsettable]);
            gzwrite($fileHandle, $todump);
            $offsetrow++;
            $cpt++;
        }
        current_time();
        if ($duree > 0 && $TPSCOUR >= $duree) {
            //on atteint la fin du temps imparti
            return true;
        }
        $fin = 0;
        while (!$fin) {
            $todump = get_content($DB, $tables[$offsettable], $offsetrow, $rowlimit);
            $rowtodump = substr_count($todump, "INSERT INTO");
            if ($rowtodump > 0) {
                gzwrite($fileHandle, $todump);
                $cpt += $rowtodump;
                $offsetrow += $rowlimit;
                if ($rowtodump < $rowlimit) {
                    $fin = 1;
                }
                current_time();
                if ($duree > 0 && $TPSCOUR >= $duree) {
                    //on atteint la fin du temps imparti
                    return true;
                }
            } else {
                $fin = 1;
                $offsetrow = -1;
            }
        }
        if ($fin) {
            $offsetrow = -1;
        }
        current_time();
        if ($duree > 0 && $TPSCOUR >= $duree) {
            //on atteint la fin du temps imparti
            return true;
        }
    }
    if ($DB->error()) {
        echo "<hr>";
        //TRANS: %s is the SQL query which generates the error
        printf(__("SQL error starting from %s"), "[{$formattedQuery}]");
        echo "<br>" . $DB->error() . "<hr>";
    }
    $offsettable = -1;
    gzclose($fileHandle);
    return true;
}
コード例 #4
0
ファイル: backup.php プロジェクト: kveldscholten/Ilch-1.1
          Copyright (c) 2000-2001 by Holger Mauermann, mauermann@nm-service.de
     phpMyBackup is distributed in the hope that it will be useful for you, but
          WITHOUT ANY WARRANTY. This programm may be used freely as long as all credit
          and copyright information are left intact.
    */
    if ($writer->countWriters()) {
        $version = "0.4 beta";
        $cur_time = date("Y-m-d H:i");
        $writer->write("-- Dump created with 'phpMyBackup v.{$version}' on {$cur_time}\r\n");
        mysql_select_db(DBDATE);
        $tables = array();
        $qry = mysql_query('SHOW TABLES');
        while ($row = mysql_fetch_array($qry)) {
            $tables[] = $row[0];
        }
        foreach ($tables as $table) {
            if (isset($_POST['prefix']) and strpos($table, DBPREF) === false) {
                continue;
            }
            get_def(DBDATE, $table, $writer);
            get_content(DBDATE, $table, $writer);
        }
        $writer->close();
    }
} else {
    $design = new design('Admins Area', 'Admins Area', 2);
    $design->header();
    $tpl = new tpl('backup', 1);
    $tpl->out(0);
    $design->footer();
}
コード例 #5
0
ファイル: dump.php プロジェクト: thaian2009/php
     if (isset($flipped[$adbname])) {
         $dump['dbindex'] = $flipped[$adbname];
     }
     $dump['part_offset'] = $dump['part'] - 1;
     $out .= '</div><br>';
     ExecuteCommand('b');
     new_file();
 }
 $aktuelle_tabelle = $dump['table_offset'];
 if ($dump['zeilen_offset'] == 0) {
     if ($config['minspeed'] > 0) {
         $dump['anzahl_zeilen'] = $config['minspeed'];
         $dump['restzeilen'] = $config['minspeed'];
     }
     $create_statement = '';
     $create_statement = get_def($adbname, $table);
     if (!($create_statement === false)) {
         $dump['data'] .= $create_statement;
     } else {
         WriteToDumpFile();
         // save data we have up to now
         // error reading table definition
         $read_create_error = sprintf($lang['L_FATAL_ERROR_DUMP'], $table, $adbname) . ': ' . mysql_error($config['dbconnection']);
         Errorlog("DUMP", $databases['db_actual'], '', $read_create_error, 0);
         WriteLog($read_create_error);
         if ($config['stop_with_error'] > 0) {
             die($read_create_error);
         }
         $dump['errors']++;
     }
 }
コード例 #6
0
ファイル: db_query_functions.php プロジェクト: kimjer/hms
function get_four_defs($connection, $correct_word, $num_headwords, $max_def_length = 256, $min_def_length = 0)
{
    $correct_def = get_def($connection, $correct_word);
    $correct_headword_id = $correct_word['headword_id'];
    $def1;
    $def2;
    $def3;
    //	$def_arr = array($correct_def);
    $pos = $correct_word['pos'];
    $regex_pos;
    if ($pos == 'sm' || $pos == 'sf' || $pos == 'smf') {
        $regex_pos = " AND pos REGEXP 'sm|sf'";
    } else {
        if ($pos == 'vt' || $pos == 'vi' || $pos == 'vp' || $pos == 'vti') {
            $regex_pos = " AND pos REGEXP 'v'";
        } else {
            if ($pos == 'adj') {
                $regex_pos = " AND pos REGEXP 'adj'";
            } else {
                $regex_pos = "";
            }
        }
    }
    $defs_query = "SELECT * FROM hms_defs \n" . "LEFT JOIN hms_headword ON headword_id=fk_defs_headword_id\n" . "WHERE CHAR_LENGTH(def) < {$max_def_length} AND CHAR_LENGTH(def) > {$min_def_length} {$regex_pos}";
    $defs_results = query_mysql($connection, $defs_query);
    $num_rows = mysqli_num_rows($defs_results);
    //$num_headwords in argument may not be necessary
    $random1 = unique_random($num_rows);
    $random2 = unique_random($num_rows, $random1);
    $random3 = unique_random($num_rows, $random1, $random2);
    mysqli_data_seek($defs_results, $random1);
    $row = mysqli_fetch_row($defs_results);
    $def1 = $row[2];
    //index 2 gets the definition
    $def1_headword_id = $row[1];
    //index 1 gets the headword_id
    mysqli_data_seek($defs_results, $random2);
    $row = mysqli_fetch_row($defs_results);
    $def2 = $row[2];
    $def2_headword_id = $row[1];
    mysqli_data_seek($defs_results, $random3);
    $row = mysqli_fetch_row($defs_results);
    $def3 = $row[2];
    $def3_headword_id = $row[1];
    $correct_def_str = $correct_def['def'];
    $headword = $correct_word['headword'];
    $pos = $correct_word['pos'];
    //	$def_arr = array("correct" => "$correct_def_str", "headword"=> $headword, "pos"=> $pos, "def1" => $def1, "def2" => $def2, "def3" => $def3);
    $def_arr = array("correct" => "{$correct_def_str}", "headword" => $headword, "pos" => $pos, "correct_headword_id" => $correct_headword_id, "def1" => $def1, "def2" => $def2, "def3" => $def3, "def1_headword_id" => "{$def1_headword_id}", "def2_headword_id" => "{$def2_headword_id}", "def3_headword_id" => "{$def3_headword_id}");
    //	print_r($def_arr);
    return $def_arr;
}
コード例 #7
0
ファイル: book.php プロジェクト: sdgdsffdsfff/docs-1
function render_paragraphs($dbc, $db_name, $title)
{
    $keywords = mysql_escape_string($title);
    $query = "select * from resource where title = '{$keywords}'";
    //echo $title;
    $result = mysqli_query($dbc, $query) or die('Error querying database:' . $query);
    while ($row = mysqli_fetch_array($result)) {
        $id = trim($row["id"]);
        $description = trim($row["description"]);
        echo "<div class='row'>";
        echo "<div class='col-sm-8'>";
        $keywords = get_keywords($dbc, $id);
        $predicates = get_predicates($dbc, $id);
        $description = preprocess_description($db_name, $description, $keywords, $predicates);
        echo $description;
        echo "</div>";
        echo "<div class='col-sm-4'>";
        if (count($keywords) != 0) {
            echo '<small>相关概念:</small>';
            foreach ($keywords as $keyword) {
                //echo '<p>' . $keyword . ": " . $def . '</p>';
                echo '<button type="button" class="btn btn-xs btn-default" data-container="body" data-toggle="popover" data-placement="bottom" data-content="' . get_def($dbc, $keyword) . '">';
                echo $keyword;
                echo '</button>&nbsp;&nbsp;';
            }
            echo '<small> ';
            render_relations($dbc, $id);
            echo '</small>';
        }
        echo "</div>";
        echo "</div>";
    }
}
コード例 #8
0
ファイル: backup2.php プロジェクト: rhempen/cms
}
$newfile = '';
$cur_time = date('d.m.Y H:i');
$newfile .= "#----------------------------------------------\n";
$newfile .= "# Backup der Datenbank " . $db . "\n";
$newfile .= "# Erstellt am " . $cur_time . "\n";
$newfile .= "#----------------------------------------------\n\n\n";
$tables = mysql_list_tables($db, $verbindung);
$num_tables = @mysql_num_rows($tables);
$i = 0;
while ($i < $num_tables) {
    $table = mysql_tablename($tables, $i);
    echo "<p style='background-color:#dedede'>Sicherung der Tabelle: " . $table . "</p>\n";
    $newfile .= "\n# ----------------------------------------------------------\n#\n";
    $newfile .= "# Struktur von Tabelle '{$table}'\n#\n";
    $newfile .= get_def($db, $table);
    $newfile .= "\n\n";
    $newfile .= "#\n# Daten von Tabelle '{$table}'\n#\n";
    $newfile .= get_content($db, $table);
    $newfile .= "\n\n";
    $i++;
}
$datei = $path . date('Ymd') . 'backup_' . WEBSITE . '.' . $filetype;
$datei_neu = $path . date('Ymd') . 'backup_' . WEBSITE . '.' . $filetype2;
$fp = fopen($datei, 'w');
fwrite($fp, $newfile);
fclose($fp);
@rename($datei, $datei_neu);
clearstatcache();
chmod($datei_neu, 0777);
clearstatcache();
コード例 #9
0
ファイル: main.php プロジェクト: nahakyuu/dts
function get_primary_dmg(&$pa, &$pd, $active)
{
    if (eval(__MAGIC__)) {
        return $___RET_VALUE;
    }
    eval(import_module('weapon'));
    $pa['fin_att'] = get_att($pa, $pd, $active) * get_att_multiplier($pa, $pd, $active);
    $pd['fin_def'] = get_def($pa, $pd, $active) * get_def_multiplier($pa, $pd, $active);
    $att_pow = $pa['fin_att'];
    $def_pow = $pd['fin_def'];
    $ws = $pa['fin_skill'];
    $wp_kind = $pa['wep_kind'];
    $damage = $att_pow / $def_pow * $ws * $skill_dmg[$wp_kind];
    $fluc = get_weapon_fluc_percentage($pa, $pd, $active);
    $dmg_factor = (100 + $fluc) / 100;
    $damage = round($damage * $dmg_factor * rand(4, 10) / 10);
    if ($damage < 1) {
        $damage = 1;
    }
    return $damage;
}
コード例 #10
0
ファイル: accueil_sauve.php プロジェクト: alhousseyni/gepi
function backupMySql($db, $dumpFile, $duree, $rowlimit)
{
    global $TPSCOUR, $offsettable, $offsetrow, $cpt, $debug;
    $fileHandle = fopen($dumpFile, "a");
    if (!$fileHandle) {
        echo "Ouverture de {$dumpFile} impossible<br />\n";
        return FALSE;
    }
    if ($offsettable == 0 && $offsetrow == -1) {
        $todump = "#**************** BASE DE DONNEES " . $db . " ****************" . "\n" . date("\\#\\ \\L\\ \\:\\ d\\ m\\ Y\\ \\a\\ H\\h\\ i") . "\n";
        $todump .= "# Serveur : " . $_SERVER['SERVER_NAME'] . "\n";
        $todump .= "# Version PHP : " . phpversion() . "\n";
        $todump .= "# Version mySQL : " . mysql_version2() . "\n";
        $todump .= "# IP Client : " . $_SERVER['REMOTE_ADDR'] . "\n";
        $todump .= "# Fichier SQL compatible PHPMyadmin\n#\n";
        $todump .= "# ******* debut du fichier ********\n";
        fwrite($fileHandle, $todump);
    }
    $sql = "SHOW TABLES;";
    $result = mysqli_query($GLOBALS["mysqli"], $sql);
    $numtab = 0;
    while ($t = mysqli_fetch_array($result)) {
        $tables[$numtab] = $t[0];
        $numtab++;
    }
    if (mysqli_error($GLOBALS["mysqli"])) {
        echo "<hr />\n<font color='red'>ERREUR lors de la sauvegarde du à un problème dans la la base.</font><br />" . mysqli_error($GLOBALS["mysqli"]) . "<hr/>\n";
        return false;
        die;
    }
    for (; $offsettable < $numtab; $offsettable++) {
        // Dump de la strucutre table
        if ($offsetrow == -1) {
            $todump = get_def($db, $tables[$offsettable]);
            if (isset($debug) && $debug != '') {
                echo "<b><br />Dump de la structure de la table " . $tables[$offsettable] . "</b><br />\n";
            }
            fwrite($fileHandle, $todump);
            $offsetrow++;
            $cpt++;
        }
        current_time();
        if ($duree > 0 and $TPSCOUR >= $duree) {
            //on atteint la fin du temps imparti
            return TRUE;
        }
        if (isset($debug) && $debug != '') {
            echo "<b><br />Dump des données de la table " . $tables[$offsettable] . "<br /></b>\n";
        }
        $fin = 0;
        while (!$fin) {
            $todump = get_content($db, $tables[$offsettable], $offsetrow, $rowlimit);
            $rowtodump = substr_count($todump, "INSERT INTO");
            if ($rowtodump > 0) {
                fwrite($fileHandle, $todump);
                $cpt += $rowtodump;
                $offsetrow += $rowlimit;
                if ($rowtodump < $rowlimit) {
                    $fin = 1;
                }
                current_time();
                if ($duree > 0 and $TPSCOUR >= $duree) {
                    //on atteint la fin du temps imparti
                    if (isset($debug) && $debug != '') {
                        echo "<br /><br /><b>Nombre de lignes actuellement dans le fichier : " . $cpt . "</b><br />\n";
                    }
                    return TRUE;
                }
            } else {
                $fin = 1;
                $offsetrow = -1;
            }
        }
        if (isset($debug) && $debug != '') {
            echo "Pour cette table, nombre de lignes sauvegardées : " . $offsetrow . "<br />\n";
        }
        if ($fin) {
            $offsetrow = -1;
        }
        current_time();
        if ($duree > 0 and $TPSCOUR >= $duree) {
            //on atteint la fin du temps imparti
            return TRUE;
        }
    }
    $offsettable = -1;
    $todump = "#\n";
    $todump .= "# ******* Fin du fichier - La sauvegarde s'est terminée normalement ********\n";
    fwrite($fileHandle, $todump);
    fclose($fileHandle);
    return TRUE;
}
コード例 #11
0
ファイル: db_backup.php プロジェクト: ksb1712/pragyan
    if (!is_dir($backup_path)) {
        mkdir($backup_path, 0766);
    }
    chmod($backup_path, 0777);
    $fp = gzopen($backup_path . $filename, "w");
    $copyr = "# Table backup from Sphider\n" . "# Creation date: " . date("d-M-Y H:s", time()) . "\n" . "# Database: " . $database . "\n" . "# MySQL Server version: " . mysql_get_server_info() . "\n\n";
    gzwrite($fp, $copyr);
    gzclose($fp);
    chmod($backup_path . $filename, 0777);
    if (!eregi("/restore\\.", $_SERVER['PHP_SELF'])) {
        $cur_time = date("Y-m-d H:i");
        $i = 0;
        $fp = gzopen($backup_path . $filename, "a");
        while ($i < $numtables) {
            if (isset($tables[$i])) {
                get_def($database, $tables[$i], $fp);
                if (!isset($structonly) || $structonly != "Yes") {
                    get_content($database, $tables[$i], $fp);
                }
            }
            $i++;
        }
        gzwrite($fp, "# Valid end of backup from Sphider backup\n");
        gzclose($fp);
    }
}
function get_def($database, $table, $fp)
{
    $def = "";
    $def .= "DROP TABLE IF EXISTS {$table};#%%\n";
    $def .= "CREATE TABLE {$table} (\n";
コード例 #12
0
ファイル: dump.php プロジェクト: BackupTheBerlios/oos-svn
             }
             if (isset($flipped[$adbname])) {
                 $dump['dbindex'] = $flipped[$adbname];
             }
             $dump['part_offset'] = $dump['part'] - 1;
             $out .= '</div><br>';
             new_file();
         }
         $aktuelle_tabelle = $dump['table_offset'];
         if ($dump['zeilen_offset'] == 0) {
             if ($config['minspeed'] > 0) {
                 $dump['anzahl_zeilen'] = $config['minspeed'];
                 $dump['restzeilen'] = $config['minspeed'];
             }
             $dump['data'] .= get_def($adbname, $table);
             $dump['structure'] .= get_def($adbname, $table, 0);
         }
         WriteToDumpFile();
         get_content($adbname, $table);
         $dump['restzeilen']--;
         if ($config['memory_limit'] > 0 && strlen($dump['data']) > $config['memory_limit']) {
             WriteToDumpFile();
         }
     }
 }
 /////////////////////////////////
 // Anzeige - Fortschritt
 /////////////////////////////////
 if ($config['multi_dump'] == 1) {
     $mudbs = '';
     for ($i = 0; $i < count($databases['multi']); $i++) {
コード例 #13
0
    if (!is_dir($backup_path)) {
        mkdir($backup_path, 0766);
    }
    chmod($backup_path, 0777);
    $fp = gzopen($backup_path . $filename, "w");
    $copyr = "# Table backup from Sphider\n" . "# Creation date: " . date("d-M-Y H:s", time()) . "\n" . "# Database: " . DATABASE_NAME . "\n" . "# MySQL Server version: " . mysql_get_server_info() . "\n\n";
    gzwrite($fp, $copyr);
    gzclose($fp);
    chmod($backup_path . $filename, 0777);
    if (!eregi("/restore\\.", $_SERVER['PHP_SELF'])) {
        $cur_time = date("Y-m-d H:i");
        $i = 0;
        $fp = gzopen($backup_path . $filename, "a");
        while ($i < $numtables) {
            if (isset($tables[$i])) {
                get_def(DATABASE_NAME, $tables[$i], $fp);
                if (!isset($structonly) || $structonly != "Yes") {
                    get_content(DATABASE_NAME, $tables[$i], $fp);
                }
            }
            $i++;
        }
        gzwrite($fp, "# Valid end of backup from Sphider backup\n");
        gzclose($fp);
    }
}
function get_def($database, $table, $fp)
{
    $def = "";
    $def .= "DROP TABLE IF EXISTS {$table};#%%\n";
    $def .= "CREATE TABLE {$table} (\n";
コード例 #14
0
ファイル: dtbBackup.php プロジェクト: xfifix/Tools
// this is the subject of the email being sent to you
/**
 * Sauvegarde databases
 */
$path = make_dir();
print "MySQL Database Backup...\n\r";
foreach ($dbnames as $dbname) {
    print "Starting Process with {$dbname} ...\n\r";
    //Connexion à la dtb
    $db = mysql_connect("{$dbhost}", "{$dbuser}", "{$dbpass}");
    mysql_select_db("{$dbname}", $db);
    $result = false;
    $result = mysql_query("show tables from {$dbname}");
    $newfile = '';
    while (list($table) = mysql_fetch_row($result)) {
        $newfile .= get_def($table);
        $newfile .= "\n\n";
        $newfile .= get_content($table);
        $newfile .= "\n\n";
        $i++;
        if ($echo_status == 'yes') {
            print "Dumped table {$table}...\n\r";
        }
    }
    //Création du fichier sql
    $file_name = $archiveDtbName . $dbname . ".sql";
    $file_path = $path . $file_name;
    //Compression
    $file_name .= ".gz";
    $file_path .= ".gz";
    $zp = gzopen($file_path, "wb9");
コード例 #15
0
ファイル: backup.php プロジェクト: ryukansent/Thesis-SideB
/**  Backup a glpi DB
 *
 * @param $DB DB object
 * @param $dumpFile dump file
 * @param $duree max delay before refresh
 * @param $rowlimit rowlimit to backup in one time
**/
function backupMySql($DB, $dumpFile, $duree, $rowlimit)
{
    global $TPSCOUR, $offsettable, $offsetrow, $cpt, $LANG;
    // $dumpFile, fichier source
    // $duree=timeout pour changement de page (-1 = aucun)
    $fileHandle = fopen($dumpFile, "a");
    if (!$fileHandle) {
        echo $LANG['document'][45] . "&nbsp;: {$dumpFile}<br>";
        return false;
    }
    if ($offsettable == 0 && $offsetrow == -1) {
        $time_file = date("Y-m-d-H-i");
        $cur_time = date("Y-m-d H:i");
        $todump = "#GLPI Dump database on {$cur_time}\n";
        fwrite($fileHandle, $todump);
    }
    $result = $DB->list_tables();
    $numtab = 0;
    while ($t = $DB->fetch_array($result)) {
        // on se  limite aux tables prefixees _glpi
        if (strstr($t[0], "glpi_")) {
            $tables[$numtab] = $t[0];
            $numtab++;
        }
    }
    for (; $offsettable < $numtab; $offsettable++) {
        // Dump de la structure table
        if ($offsetrow == -1) {
            $todump = "\n" . get_def($DB, $tables[$offsettable]);
            fwrite($fileHandle, $todump);
            $offsetrow++;
            $cpt++;
        }
        current_time();
        if ($duree > 0 && $TPSCOUR >= $duree) {
            //on atteint la fin du temps imparti
            return true;
        }
        $fin = 0;
        while (!$fin) {
            $todump = get_content($DB, $tables[$offsettable], $offsetrow, $rowlimit);
            $rowtodump = substr_count($todump, "INSERT INTO");
            if ($rowtodump > 0) {
                fwrite($fileHandle, $todump);
                $cpt += $rowtodump;
                $offsetrow += $rowlimit;
                if ($rowtodump < $rowlimit) {
                    $fin = 1;
                }
                current_time();
                if ($duree > 0 && $TPSCOUR >= $duree) {
                    //on atteint la fin du temps imparti
                    return true;
                }
            } else {
                $fin = 1;
                $offsetrow = -1;
            }
        }
        if ($fin) {
            $offsetrow = -1;
        }
        current_time();
        if ($duree > 0 && $TPSCOUR >= $duree) {
            //on atteint la fin du temps imparti
            return true;
        }
    }
    if ($DB->error()) {
        echo "<hr>" . $LANG['backup'][23] . " [{$formattedQuery}]<br>" . $DB->error() . "<hr>";
    }
    $offsettable = -1;
    fclose($fileHandle);
    return true;
}
コード例 #16
0
ファイル: db_main.php プロジェクト: sean-tan/sphiderplus
     mkdir("{$path}", 0777);
 }
 //create individual sub-folder for backup-files
 optimize($database);
 //      before backup, preventively repair and optimize current database
 $header = "-- ------------------------------------------------------------ \n" . "-- \n" . "-- Backup from Sphider database\n" . "-- Creation date: " . date("d-M-Y H:i", time()) . "\n" . "-- Database: " . $database . "\n" . "-- MySQL Server version: " . mysql_get_server_info() . "\n" . "-- \n" . "-- ------------------------------------------------------------ \n\n";
 $result = mysql_db_query($database, "SHOW TABLES FROM {$database}") or die("Database {$database} not existing.");
 while ($row = mysql_fetch_array($result)) {
     $tab = "{$row['0']}";
     //name of actual table
     $back = "{$path}/{$tab}.sql.gz";
     //create path, filename and suffix for this backup-file
     $fp = gzopen("{$back}", "w");
     gzwrite($fp, $header);
     //write header into backup-file
     get_def($database, $tab, $fp);
     //get structure of this table
     if (!isset($structonly) || $structonly != "Yes") {
         get_content($database, $tab, $fp);
         //get content of this table
     }
     if ($structonly == "Yes") {
         //print warning into backup file
         $struct_warn = "\n\n-- During backup 'structure only' was selected.\n\n";
         gzwrite($fp, $struct_warn);
     }
     gzwrite($fp, "--  Valid end of table: '{$tab}'\n");
     gzclose($fp);
 }
 mysql_free_result($result);
 $endtime = time();
コード例 #17
0
ファイル: db_main.php プロジェクト: pwh/scrutiny
     mkdir("{$path}", 0777);
 }
 //create individual sub-folder for backup-files
 optimize($db->default['database']);
 //      before backup, preventively repair and optimize current database
 $header = "-- ------------------------------------------------------------ \n" . "-- \n" . "-- Backup from Sphider database\n" . "-- Creation date: " . date("d-M-Y H:i", time()) . "\n" . "-- Database: " . $db->default['database'] . "\n" . "-- MySQL Server version: " . mysql_get_server_info() . "\n" . "-- \n" . "-- ------------------------------------------------------------ \n\n";
 $result = mysql_db_query($db->default['database'], "SHOW TABLES FROM " . $db->default['database']) or die("Database " . $db->default['database'] . " not existing.");
 while ($row = mysql_fetch_array($result)) {
     $tab = "{$row['0']}";
     //name of actual table
     $back = "{$path}/{$tab}.sql.gz";
     //create path, filename and suffix for this backup-file
     $fp = gzopen("{$back}", "w");
     gzwrite($fp, $header);
     //write header into backup-file
     get_def($db->default['database'], $tab, $fp);
     //get structure of this table
     if (!isset($structonly) || $structonly != "Yes") {
         get_content($db->default['database'], $tab, $fp);
         //get content of this table
     }
     if ($structonly == "Yes") {
         //print warning into backup file
         $struct_warn = "\n\n-- During backup 'structure only' was selected.\n\n";
         gzwrite($fp, $struct_warn);
     }
     gzwrite($fp, "--  Valid end of table: '{$tab}'\n");
     gzclose($fp);
 }
 mysql_free_result($result);
 $endtime = time();