Merhaba geliştirmekte olduğum bir script var bay yol kat ettim fakat bir noktada takılı kaldım. bir kod kümesini güncelleyemiyorum yardımınız için teşekkürler.

Bu kodu;
if ($kullanici['kredi'] >= $uruncek['urun_fiyat']) {

        if ($yeniekle) {
            $komut=$uruncek['urun_komut'];
            $komut2=$uruncek['urun_komut2'];
            $komut3=$uruncek['urun_komut3'];

            $ws = new Websend("".$oku['ip']."");
            $ws->password = "".$oku['sunucu_sifre']."";
            $ws->port = "".$oku['port']."";

            if($ws->connect()) {
                $ws->doCommandAsConsole(str_ireplace("%player%","".$_SESSION['user_nick']."","".$komut.""));
                if (!empty($komut2)) {
                    $ws->doCommandAsConsole(str_ireplace("%player%","".$_SESSION['user_nick']."","".$komut2.""));
                }
                if (!empty($komut3)) {
                    $ws->doCommandAsConsole(str_ireplace("%player%","".$_SESSION['user_nick']."","".$komut3.""));
                }
                    

                    $duzenle=$db->prepare("UPDATE authme SET kredi=:kredi WHERE id=:id");
                    $azalt=$duzenle->execute(array('kredi' => $ykredi, 'id' => $kullanici['id']));

                    
                    echo "<script>alert('Ürün Başarılı Şekilde Teslim Edildi.')</script>";
                    echo '<meta http-equiv="refresh" content="0;URL=market.php">';

          $ekle=$db->prepare("INSERT INTO alinanurun SET urun_isim=:urun_isim, username=:username, urun_fiyat=:urun_fiyat");
                    $yeniekle=$ekle->execute(array('urun_isim' => $uruncek['urun_isim'], 'username' => $kullanici['username'], 'urun_fiyat' => $uruncek['urun_fiyat']));
          
                    //
                    // Ürün Teslim Edilirse Krediyi Çek
                    //
                    $ykredi= $kullanici['kredi'] - $uruncek['urun_fiyat'];
                
            }else{
               
                echo "<script>alert('Ürünü Satın Alırken Bir Sorun Oluştu.')</script>";
                echo '<meta http-equiv="refresh" content="0;URL=market.php">';
            
            }
            $ws->disconnect();
        } else {
            
            echo "<script>alert('Ürünü Satın Alırken Bir Sorun Oluştu.')</script>";
            echo '<meta http-equiv="refresh" content="0;URL=market.php">';
            
        }
    }
    else
    {
        
        echo "<script>alert('Ürünü Satın Alırken Bir Sorun Oluştu.')</script>";
        echo '<meta http-equiv="refresh" content="0;URL=market.php">';
            
    }
}
buna güncellemek istiyorum;

<?php

     // Load Library
    
    $wsr = new WebsenderAPI("127.0.0.1","123qwe","9876"); // HOST , PASSWORD , PORT
    
    if($wsr->connect()){ //Open Connect
        
        $wsr->sendCommand("gamemode 0 CraftRise");
        $wsr->sendCommand("say test");
        $wsr->sendCommand("perms");
        
        $wsr->sendMessage("hello server!");
        
    }else{
        echo "Connection error! Check ip, pass and port.";
    }
    
    $wsr->disconnect(); //Close connection.
    
?>