Misafir adlı üyeden alıntı: mesajı görüntüle
tabi buyrun aşağıda iletiyorum
<?php
    if($serverinfo["ServerPluginCon"] == 1)  {

    $plugin_info = GetPluginList();
    $pluginsnames = array();

    if($plugin_info != false):
        foreach($plugin_info as $plugin) {
            $pluginsnames[] = $plugin["PluginFileName"];
        }
        $ssh2 = new ogcp_ssh2();
        if($ssh2->ConnectwAuth($serverinfo["MachIP"],(int)$serverinfo["MachPort"],$serverinfo["MachUser"],$serverinfo["MachPass"])) {
            $plugin_status = Plugin_GetStatus($ssh2->SFTP_FileLink($serverinfo["ServerPath"]."/cstrike/addons/amxmodx/configs/plugins.ini"),$pluginsnames);
        } else {
            foreach($pluginsnames as $plugname) {
                $plugin_status[$plugname] = 2;
            }
        }
        if((int)@$_GET["Kur"] != 0 && isset($plugin_info[(int)@$_GET["Kur"]]) ) {
            $pluginf = $plugin_info[(int)@$_GET["Kur"]];
            if($plugin_status[$pluginf["PluginFileName"]] == 0) {
                if($ssh2->SFTP_DownloadFile($serverinfo["ServerPath"]."/cstrike/addons/amxmodx/configs/plugins.ini","tmp/tmp_".$serverinfo["ServerIP"]."_".$serverinfo["ServerPort"]."_plugins.ini")) {
                    $durum = Plugin_CopyDir("sistem/plugins/".pathinfo($pluginf["PluginFileName"],PATHINFO_FILENAME),$ssh2->SFTP_FileLink($serverinfo["ServerPath"]."/cstrike"));
                    $dosya_ac = fopen("tmp/tmp_".$serverinfo["ServerIP"]."_".$serverinfo["ServerPort"]."_plugins.ini","a");
                    if( $durum != false && fwrite($dosya_ac,"\r\n".$pluginf["PluginFileName"]."    ; ".$pluginf["PluginName"]) && $ssh2->SFTP_UploadFile("tmp/tmp_".$serverinfo["ServerIP"]."_".$serverinfo["ServerPort"]."_plugins.ini",$serverinfo["ServerPath"]."/cstrike/addons/amxmodx/configs/plugins.ini")) {
                        print('<div class="alert alert-success"><button type="button" class="close" data-dismiss="alert">×</button><strong>Başarılı!</strong> Eklenti Kuruldu!</div>');
                        $plugin_status[$pluginf["PluginFileName"]] = 1;
                    } else {
                        print('<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">×</button><strong>Başarısız!</strong> Eklenti Kurulamadı!</div>');

                    }
                    @fclose($dosya_ac);
                } else {
                    print('<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">×</button><strong>Başarısız!</strong> Eklenti Kurulamadı!</div>');
                }
            }        
        } else if((int)@$_GET["Kaldir"] != 0 && isset($plugin_info[(int)@$_GET["Kaldir"]])) {
            $pluginf = $plugin_info[(int)@$_GET["Kaldir"]];
            if($plugin_status[$pluginf["PluginFileName"]] == 1) {
                if($ssh2->SFTP_DownloadFile($serverinfo["ServerPath"]."/cstrike/addons/amxmodx/configs/plugins.ini","tmp/tmp_".$serverinfo["ServerIP"]."_".$serverinfo["ServerPort"]."_plugins.ini")) {
                    $dosya_ac = fopen("tmp/tmp_".$serverinfo["ServerIP"]."_".$serverinfo["ServerPort"]."_plugins.ini","r");
                    $icerik = "";
                    while(!feof($dosya_ac)) $icerik .= fgets($dosya_ac,8192);
                    @fclose($dosya_ac);
                    $icerik = str_replace("\r\n".$pluginf["PluginFileName"]."    ; ".$pluginf["PluginName"],"",$icerik);
                    $icerik = str_replace($pluginf["PluginFileName"]."    ; ".$pluginf["PluginName"]."\r\n","",$icerik);
                    $icerik = str_replace("\r\n".$pluginf["PluginFileName"],"",$icerik);
                    $icerik = str_replace($pluginf["PluginFileName"]."\r\n","",$icerik);
                    $icerik = str_replace($pluginf["PluginFileName"],"",$icerik);
                    $dosya_ac = fopen("tmp/tmp_".$serverinfo["ServerIP"]."_".$serverinfo["ServerPort"]."_plugins.ini","w");
                    if(fwrite($dosya_ac,$icerik) && $ssh2->SFTP_UploadFile("tmp/tmp_".$serverinfo["ServerIP"]."_".$serverinfo["ServerPort"]."_plugins.ini",$serverinfo["ServerPath"]."/cstrike/addons/amxmodx/configs/plugins.ini")) {
                        print('<div class="alert alert-success"><button type="button" class="close" data-dismiss="alert">×</button><strong>Başarılı!</strong> Eklenti Kaldırıldı!</div>');
                        $plugin_status[$pluginf["PluginFileName"]] = 0;
                    } else {
                        print('<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">×</button><strong>Başarısız!</strong> Eklenti Kaldırılamadı!</div>');
                    }
                    @fclose($dosya_ac);
                } else {
                    print('<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">×</button><strong>Başarısız!</strong> Eklenti Kaldırılamadı!</div>');

                }

            }    
        }
    endif;
    } else {
        print('<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">×</button><strong>Başarısız!</strong> Eklenti Kur/Kaldır\'a girmek için izniniz bulunmamaktadır!</div>');
    }
?>
Sanırım şimdi olur.

<?php
use phpseclib3\Net\SFTP;
  
class ogcp_ssh2 {
    private $sftp;
    private $error;
    private $host;
    private $port;
    private $username;
    private $password;
    private $debug = true;
    
    private function logError($message, $function = '') {
        $timestamp = date('Y-m-d H:i:s');
        $logMessage = "[{$timestamp}] {$function}: {$message}\n";
        
        if($this->debug) {
            error_log($logMessage, 3, 'sftp_errors.log');
            $this->error = $message;
        }
    }
  
    public function __construct() {
        $this->sftp = null;
        $this->error = "";
    }

    public function ConnectwAuth($host, $port = 22, $user, $pass) {
        if ($host == "" || $user == "" || $pass == "") {
            $this->logError("Eksik parametreler", __FUNCTION__);
            return false;
        }
  
        try {
            $this->host = gethostbyname($host);
            $this->port = $port;
            $this->username = $user;
            $this->password = $pass;

            $this->sftp = new SFTP($this->host, $this->port);
            
            if ($this->sftp->login($user, $pass)) {
                $this->logError("Bağlantı başarılı", __FUNCTION__);
                return true;
            } else {
                $this->logError("Bağlantı başarısız", __FUNCTION__);
                return false;
            }
        } catch (\Exception $e) {
            $this->logError("Bağlantı hatası: " . $e->getMessage(), __FUNCTION__);
            return false;
        }
    }

    public function SFTP_FileLink($filepath) {
        try {
            if (!$this->sftp) {
                $this->logError("SFTP bağlantısı yok", __FUNCTION__);
                return false;
            }
            
            if (!$this->sftp->file_exists($filepath)) {
                $this->logError("Dosya bulunamadı: " . $filepath, __FUNCTION__);
                return false;
            }
            
            return $filepath;
        } catch (\Exception $e) {
            $this->logError("FileLink hatası: " . $e->getMessage(), __FUNCTION__);
            return false;
        }
    }

    public function SFTP_DownloadFile($remote, $local) {
        try {
            if (!$this->sftp) {
                $this->logError("SFTP bağlantısı yok", __FUNCTION__);
                return false;
            }

            if (!$this->sftp->file_exists($remote)) {
                $this->logError("Uzak dosya bulunamadı: " . $remote, __FUNCTION__);
                return false;
            }

            if ($this->sftp->get($remote, $local)) {
                $this->logError("Dosya indirildi: " . $remote, __FUNCTION__);
                return true;
            } else {
                $this->logError("Dosya indirilemedi: " . $remote, __FUNCTION__);
                return false;
            }
        } catch (\Exception $e) {
            $this->logError("Download hatası: " . $e->getMessage(), __FUNCTION__);
            return false;
        }
    }

    public function SFTP_UploadFile($local, $remote) {
        try {
            if (!$this->sftp) {
                $this->logError("SFTP bağlantısı yok", __FUNCTION__);
                return false;
            }

            if (!file_exists($local)) {
                $this->logError("Yerel dosya bulunamadı: " . $local, __FUNCTION__);
                return false;
            }

            if ($this->sftp->put($remote, $local, SFTP::SOURCE_LOCAL_FILE)) {
                $this->logError("Dosya yüklendi: " . $remote, __FUNCTION__);
                return true;
            } else {
                $this->logError("Dosya yüklenemedi: " . $remote, __FUNCTION__);
                return false;
            }
        } catch (\Exception $e) {
            $this->logError("Upload hatası: " . $e->getMessage(), __FUNCTION__);
            return false;
        }
    }

    public function Disconnect() {
        if ($this->sftp) {
            $this->sftp = null;
        }
        return true;
    }

    public function getLastError() {
        return $this->error;
    }
}
?>