コード例 #1
0
ファイル: Backup.php プロジェクト: 26746647/Belize-openSIS
                $Export_FileName = $mysql_database . '_' . $date_time;
                header('Content-type: text/plain');
                header('Content-Disposition: attachment; filename="' . $Export_FileName . '.sql"');
                //echo "/*mysqldump.php version $mysqldump_version \n";
                echo "-- Server version:" . mysql_get_server_info() . "\n";
                echo "-- PHP Version: " . phpversion() . "\n\n";
                echo 'SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";';
                echo "\n\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;\n";
                echo "/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;\n";
                echo "/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;\n";
                echo "/*!40101 SET NAMES utf8 */;\n\n";
                echo "--\n";
                echo "-- Database: `{$mysql_database}`\n";
                echo "--\n\n";
                echo "-- --------------------------------------------------------\n\n";
                _mysqldump($mysql_database);
                //header("Content-Length: ".ob_get_length());
                //ob_end_flush();
            }
        }
    }
}
function _mysqldump($mysql_database)
{
    $sql = "show tables where tables_in_{$mysql_database} not like 'COURSE_DETAILS%' and tables_in_{$mysql_database} not like 'ENROLL_GRADE%'\r\n               and tables_in_{$mysql_database} not like 'MARKING_PERIODS%' and tables_in_{$mysql_database} not like 'TRANSCRIPT_GRADES%' ;";
    $result = mysql_query($sql);
    if ($result) {
        while ($row = mysql_fetch_row($result)) {
            _mysqldump_table_structure($row[0]);
            _mysqldump_table_data($row[0]);
        }
コード例 #2
0
    fclose($myfile);
    //                        chmod($Export_FileName.".txt",077);
    unset($myfile);
    //echo "/*mysqldump.php version $mysqldump_version \n";
    $f_content = "-- Server version:" . mysql_get_server_info() . "\n";
    $f_content .= "-- PHP Version: " . phpversion() . "\n\n";
    $f_content .= 'SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";';
    $f_content .= "\n\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;\n";
    $f_content .= "/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;\n";
    $f_content .= "/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;\n";
    $f_content .= "/*!40101 SET NAMES utf8 */;\n\n";
    $f_content .= "--\n";
    $f_content .= "-- Database: `{$mysql_database}`\n";
    $f_content .= "--\n\n";
    $f_content .= "-- --------------------------------------------------------\n\n";
    $f_content .= _mysqldump($mysql_database) or die('not working');
    $myfile = fopen($Export_FileName . ".sql", "w") or die('not working');
    fwrite($myfile, $f_content);
    fclose($myfile);
    echo 'File Saved';
    //header("Content-Length: ".ob_get_length());
    //ob_end_flush();
}
function _mysqldump($mysql_database)
{
    $sql = 'show tables where tables_in_' . $mysql_database . ' not like \'course_details%\' and tables_in_' . $mysql_database . ' not like \'enroll_grade%\'
               and tables_in_' . $mysql_database . ' not like \'marking_periods%\' and tables_in_' . $mysql_database . ' not like \'student_contacts%\' and tables_in_' . $mysql_database . ' not like \'transcript_grades%\' ;';
    $result = mysql_query($sql);
    if ($result) {
        while ($row = mysql_fetch_row($result)) {
            $f_content_n .= _mysqldump_table_structure($row[0]);
コード例 #3
0
ファイル: upgrade.php プロジェクト: 26746647/OpenSIS-SI
function backup_db($mysql_database, $Export_FileName)
{
    $print_form = 0;
    //ob_start("ob_gzhandler");\
    #header('Content-type: text/plain');
    #header('Content-Disposition: ; filename="'.$Export_FileName.'.sql"');
    $writeString = _mysqldump($mysql_database);
    //header("Content-Length: ".ob_get_length());
    //ob_end_flush();
    file_put_contents("{$Export_FileName}", $writeString);
}
コード例 #4
0
ファイル: siteSettings2.php プロジェクト: ergun805/eOgr
$_SESSION['ready'] = TRUE;
require "conf.php";
$time = getmicrotime();
checkLoginLang(true, true, "siteSettings2.php");
$seciliTema = temaBilgisi();
require "lib/SQL_Export.php";
if (isset($_GET["dump"]) && $_GET["dump"] == "1") {
    $mysql_host = $_host;
    $mysql_database = $_db;
    $mysql_username = $_username;
    $mysql_password = $_password;
    $print_form = 0;
    ob_start();
    /* start buffering */
    echo "your cvs or sql output!";
    $content = _mysqldump($mysql_database);
    /* get the buffer */
    ob_end_clean();
    $content = gzencode($content, 9);
    header("Content-Type: application/force-download");
    header("Content-Type: application/octet-stream");
    header("Content-Type: application/download");
    header("Content-Description: Download SQL Export");
    header('Content-Disposition: attachment; filename="' . $mysql_host . "_" . $mysql_database . "_" . date('YmdHis') . '.txt.zip"');
    echo $content;
    trackUser($currentFile, "success,SQLDump", $adi);
    die('');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">