Aşağıdaki kodu dener misin dostum
// Check if 'view' parameter is set in GET request
if (isset($_GET['view'])) {
// Get the file name and clean it for security
$file = $_GET['view'];
$file = fm_clean_path($file);
$file = str_replace('/', '', $file);
if ($file == '' || !is_file($path . '/' . $file)) {
fm_set_msg('File not found', 'error');
fm_redirect(FM_SELF_URL . '?p=' . urlencode(FM_PATH));
}
fm_show_header(); // HEADER
fm_show_nav_path(FM_PATH); // current path
$file_url = FM_ROOT_URL . fm_convert_win((FM_PATH != '' ? '/' . FM_PATH : '') . '/' . $file);
$file_path = $path . '/' . $file;
$ext = strtolower(pathinfo($file_path, PATHINFO_EXTENSION));
$mime_type = fm_get_mime_type($file_path);
$filesize = filesize($file_path);
$is_zip = false;
$is_image = false;
$is_audio = false;
$is_video = false;
$is_text = false;
$view_title = 'File';
$filenames = false; // for zip
$content = ''; // for text
// Construct the full file path on the server
$path = $dizin . 'cstrike'; // Adjust this according to your actual file path
$file_path = $path . '/' . $file;
// SSH connection setup
$connection = ssh2_connect($ssh_host, $ssh_port);
if (!$connection) {
die('SSH bağlantısı kurulamadı.');
}
// SSH authentication
if (!ssh2_auth_password($connection, $ssh_user, $ssh_pass)) {
die('SSH kimlik doğrulaması başarısız.');
}
// SFTP stream creation
$stream = ssh2_sftp($connection);
if (!$stream) {
die('SFTP akışı oluşturulamadı.');
}
// Remote file path for SFTP
$remote_file_path = "ssh2.sftp://{$stream}{$file_path}";
// Read file contents using SFTP
$content = file_get_contents($remote_file_path);
if ($content === false) {
die('Dosya içeriği okunamadı.');
}
// Close SSH connection
ssh2_disconnect($connection);
// Continue with displaying or processing file content
// For example, you might want to display it or perform further operations
echo '<pre>' . htmlspecialchars($content) . '</pre>'; // Example: Display file content safely
} else {
// Handle case where 'view' parameter is not set
echo 'Dosya görüntülenemedi.';
}
?>