function import_server_config() { if (!file_exists('config')) { die('Thiếu file config hệ thống! Vui lòng liên hệ nhà cung cấp'); } $config_str = file_get_contents('config'); $config_array = explode("\n", $config_str); $domain_server_url = trim($config_array[3]); $synchronize_url = trim($config_array[4]); $version_check_url = trim($config_array[5]); //lưu 1 vài thông tin config vào database $db = new db_execute('TRUNCATE TABLE server_config', 1, 0); $db = new db_execute('INSERT INTO server_config(server_domain,synchronize_url,version_check_url) VALUES("' . encode_combine($domain_server_url) . '", "' . encode_combine($synchronize_url) . '", "' . encode_combine($version_check_url) . '")', 1, 0); unset($db); }
function log_execute_query($query) { $query = encode_combine($query); $time_execute = time(); $time_string = getdate($time_execute); $str = $time_execute . '|' . $query; //log lại query string để update về server $path = $_SERVER['DOCUMENT_ROOT'] . "/log/sync/"; $path_dir = $path . $time_string['year'] . '/' . $time_string['mon'] . '/' . $time_string['mday'] . '/'; if (!file_exists($path_dir)) { mkdir($path_dir, 0777, 1); } $filename = $time_string['hours'] . '.log'; if (file_exists($path_dir . $filename)) { $str = file_get_contents($path_dir . $filename) . PHP_EOL . $str; } file_put_contents($path_dir . $filename, $str); }