redirect(HOST . DIR . url('/database/admin_database.php?action=restore&error=unlink_success', '', '&')); } else { redirect(HOST . DIR . url('/database/admin_database.php?action=restore&error=unlink_failure', '', '&')); } } else { redirect(HOST . DIR . url('/database/admin_database.php?action=restore&error=file_does_not_exist', '', '&')); } } $post_file = isset($_FILES['file_sql']) ? $_FILES['file_sql'] : ''; if (!empty($_GET['file'])) { $Session->csrf_get_protect(); $file = strprotect($_GET['file']); $file_path = '../cache/backup/' . $file; if (preg_match('`[^/]+\\.sql$`', $file) && is_file($file_path)) { $Sql->parse($file_path); $tables_list = $backup->get_tables_list(); $Sql->optimize_tables($tables_list); $Sql->repair_tables($tables_list); $Cache->generate_all_files(); redirect(HOST . DIR . url('/database/admin_database.php?action=restore&error=success', '', '&')); } } elseif (!empty($post_file)) { if ($post_file['size'] < 10485760 && preg_match('`[^/]+\\.sql$`', $post_file['name'])) { $file_path = '../cache/backup/' . $post_file['name']; if (!is_file($file_path) && move_uploaded_file($post_file['tmp_name'], $file_path)) { $Sql->parse($file_path); $tables_list = $backup->get_tables_list(); $Sql->optimize_tables($tables_list); $Sql->repair_tables($tables_list); $Cache->generate_all_files(); redirect(HOST . DIR . url('/database/admin_database.php?action=restore&error=success', '', '&'));