foreach ($backupFolderList as $key => $value) { $returnStatus = performUpdate($key, $value); if ($returnStatus == false) { break; } } } else { $returnStatus = performUpdate($lab_config_id, $backup_folder); } function performUpdate($lab_config_id, $backup_folder) { global $DB_HOST, $DB_USER, $DB_PASS; $currentDir = getcwd(); $mainBlisDir = substr($currentDir, $length, strpos($currentDir, "htdocs")); $blisLabBackupFilePath = "\"" . $mainBlisDir . $backup_folder . "\\blis_" . $lab_config_id . "\\blis_" . $lab_config_id . "_backup.sql\""; $mysqlExePath = "\"" . $mainBlisDir . "server\\mysql\\bin\\mysql.exe\""; $dbname = "blis_" . $lab_config_id; $command = $mysqlExePath . " -h {$DB_HOST} -P 7188 -u {$DB_USER} -p{$DB_PASS} {$dbname} < {$blisLabBackupFilePath}"; $command = "C: &" . $command; //the C: is a useless command to prevent the original command from failing because of having more than 2 double quotes system($command, $return_var); if ($return_var == 0) { return true; } else { return false; } } # All done SessionUtil::restore($saved_session); page_redirect($returnStatus, $_REQUEST['lid']);
<?php include "conn/ws-conn.php"; include "page-util.php"; session_start(); $username = trim($_POST["username"]); $password = trim($_POST["password"]); if ($username == "" or $password == "") { $_SESSION["error"] = "用户名或密码不能为空"; page_rollback(); } else { $data = array(); $data["username"] = $username; $data["password"] = $password; $result = http_post("user/login", $data); if ($result["error"] != "") { $_SESSION["error"] = "用户名或密码不正确"; page_rollback(); } else { $_SESSION["id"] = $result["id"]; $_SESSION["username"] = $result["username"]; page_redirect("index.php"); } }
<?php session_start(); include "../conn/ws-conn.php"; include "../page-util.php"; $id = $_GET[id]; if ($id != "") { http_delete("user/" . $id); } page_redirect("../index.php?action=user");
if ($do_currbackup === true) { if (!BackupLib::performBackup($lab_config_id, getcwd()) === true) { # Backup of current version failed. page_redirect(false); } } $currentDir = getcwd(); $mainBlisDir = substr($currentDir, $length, strpos($currentDir, "htdocs")); $blisLabBackupFilePath = "\"" . $mainBlisDir . $backup_folder . "\\blis_" . $lab_config_id . "\\blis_" . $lab_config_id . "_backup.sql\""; $mysqlExePath = "\"" . $mainBlisDir . "server\\mysql\\bin\\mysql.exe\""; $dbname = "blis_" . $lab_config_id; $command = $mysqlExePath . " -h {$DB_HOST} -P 7188 -u {$DB_USER} -p{$DB_PASS} {$dbname} < {$blisLabBackupFilePath}"; $command = "C: &" . $command; //the C: is a useless command to prevent the original command from failing because of having more than 2 double quotes system($command, $return); echo $return; $dbName = "blis_revamp"; $blisBackUpFilePath = "\"" . $mainBlisDir . $backup_folder . "\\blis_revamp\\blis_revamp_backup.sql\""; $command = $mysqlExePath . " -h {$DB_HOST} -P 7188 -u {$DB_USER} -p{$DB_PASS} {$dbname} < {$blisBackUpFilePath}"; $command = "C: &" . $command; system($command, $return); echo $return; $langdata_dir = "../../" . $backup_folder . "/langdata_" . $lab_config_id; chmod("../../dbdir/", 777); if ($do_langdata === true) { dir_copy($langdata_dir, "../../local/langdata_" . $lab_config_id); } # All done SessionUtil::restore($saved_session); page_redirect(true);