• 16-02-2022, 23:19:21
    #1
    arkadaşlar bu paneldeki webftp nin her dosyanın yanına x işareti koyup silme işlemini nasıl yapabilirim ?
    <div class="container" style="width:90%" class="w3-col m1 l" >
    <br>
    <br>
    <br>
    <br>
    <br>
                
                
    
                                            <div class="row">
                            <div class="col-lg-12">
                                <div class="card">
                                    <div class="card-title">
                                    <button type="button" class="btn btn-info btn-flat btn-addon btn-lg m-b-10 m-l-5"><i class="fa fa-folder"></i>Web FTP [Dosya Yöneticisi]</button>
                                    </div>
                                           <table id="row-select" class="display table table-borderd table-hover dataTable" role="grid" aria-describedby="row-select_info">
                                                <tbody>
    <div class="col-lg-12">
    
    <br/><br/><?php if($serverinfo["ServerFTPCon"] == 1): if(@$dosya != false): ?>
            <div class="row">
                    <div class="col-md-12 col-sm-12 col-xs-12">
                    <div class="nest nest-danger">
                        <div class="title-alt">
                            <h6>WEB FTP - DOSYA: <strong><?=$dosya["name"]?></strong></h6>
                        </div>
                           <div class="body-nest text-center">
                        <form method="POST" action="<?=$page->CreatePageLink($cur_page,"Duzenle=".$dosya["name"]);?>">
                            <table style="width:100%;">
                                <tr>
                                    <td colspan="3"><textarea name="icerikD" style="width: 100%;height: 350px; resize:none;"><?=$dosya["content"]?></textarea></td>
                                </tr>
                                <tr>
                                    <td align="left"><a href="<?=$page->CreatePageLink($cur_page)?>" class="btn btn-warning">Geri</a></td><td colspan="2" align="right"><button class="btn btn-success" name="yardir">Kaydet!</button></td>
                                </tr>
                            </table>
                        </form>
                        </div>
                    </div>
                </div>
            </div>
    <?php else: ?>
                <div class="row">
                    <div class="col-md-12 col-sm-12 col-xs-12">
                        <div class="nest nest-warning">
                        <div class="title-alt">
                        </div>
                <div class="body-nest no-padding">
                        <table class="table table-striped table-highlight">
                            <thead>
                            <tr>
                            <button class="btn btn-primary btn-flat btn-addon btn-lg m-b-10 m-l-5">Konum:    <?=$_SESSION["OGCP_WebFTP_Path"]?></button>
                            </tr>
                            <tr>
                            <form method="POST" action="<?=$page->CreatePageLink($cur_page);?>">
                            <th style="text-align:center;line-height:43px; width:120px;">Yeni Klasör:</th><th><input type='text' class="form-control" name='klasor' placeholder="Buraya Oluşturmak İstediğiniz Klasör İsmini Girin!" /></th><th style="text-align:center;"><button class="btn btn-dark m-b-10 m-l-5" name="klasor_olustur" >Oluştur!</button></th>
                            </form>
                            </tr>
                                                    <tr>
                            <form method="POST" action="<?=$page->CreatePageLink($cur_page);?>">
                            <th style="text-align:center;line-height:43px; width:120px;">Sil:</th><th><input type='text' class="form-control"  name='sil' placeholder="Buraya Silmek İstediğiniz Klasör Config Veya Dosya Adını Girin!" /></th><th style="text-align:center;"><button class="btn btn-dark m-b-10 m-l-5" name="dosya_sil">Sil!</button></th>
                            </form>
                            
                            </tr>
    
                            <tr>
                                <form method="POST" action="<?=$page->CreatePageLink($cur_page)?>" enctype="multipart/form-data">
                                    <td style="text-align:center;line-height:35px;" >Dosya Yükle:</td>
                                    <td style="text-align:center;line-height:35px;"><input name="dosya1" type="file" /></td>
                                    <td style="text-align:center;line-height:35px;"><input class="btn btn-success" type="submit" name="yukle" /></td>
                                </form>
                            </tr>
                            <tr>
                            <th style="text-align:center" colspan="2">İsim</th>
                            <th style="text-align:center; width:100px;">Boyut</th></tr>
                            </thead>
                            <tbody>
                                                <td colspan=4><a href="<?=$page->CreatePageLink($cur_page,"Klasor=Sifirla")?>">Ana Dizine Dön!</a></td>
                            <?php if($files != false && @count($files) > 0): foreach($files as $file_key => $file_val): ?>
                            <tr<?=($file_val["type"] == $exts["dir"] || $file_val["type"] == $exts[".."]) ? ( $file_val["type"] == $exts[".."] ? " style='color:#2dbc61'": " style='color:blue'" ) : ""?>>
                            <td colspan="2">
                                
                                <?=$file_val["link"] != "#" ? ('<a href="'.$page->CreatePageLink($cur_page,$file_val["link"]).'"><b>'.( ($file_val["type"] != $exts["dir"] && $file_val["type"] != $exts[".."]) ? ('<span class="btn btn-xs btn-warning"><i class="fa fa-file-o"></i> '.$file_key.'</span>') : ( substr($file_key,0,-1) == '..' ? '' : ('<span class="btn btn-xs btn-primary"><i class="fa fa-folder-open"></i> '.substr($file_key,0,-1).'</span>') ) ) .'</b></a>') : ($file_val["type"] != $exts["dir"] ? $file_key : substr($file_key,0,-1)) ?></td>
                            <td style="text-align:center"><?=$file_val["type"] == "dir" ? "" : $file_val["size"]?></td>
                            </tr>
                            <?php endforeach; else: ?>
                            <tr>
                            <td colspan=4>Dizin okunamadı yada dosya bulunamadı!</td>
                            </tr>
                            <tr>
                            <td colspan=4><a href="<?=$page->CreatePageLink($cur_page,"Klasor=Sifirla")?>">Ana Dizine Dön!</a></td>
                            </tr>
                            <?php endif; ?> 
                        </table>
                        </div>
                    </div>
                </div>
            </div>
    <?php endif; endif;?>
    <?php
        $files = array();
        if($serverinfo["ServerFTPCon"] == 1) {
                if(@$_SESSION["OGCP_WebFTP_Path"] == "") $_SESSION["OGCP_WebFTP_Path"] = "/";
                if(@$_GET["Klasor"] == "Sifirla") $_SESSION["OGCP_WebFTP_Path"] = "/";
                $path = $serverinfo["ServerPath"]."/cstrike".$_SESSION["OGCP_WebFTP_Path"];
                $ssh2 = new ogcp_ssh2();
                if($ssh2->ConnectwAuth($serverinfo["MachIP"],(int)$serverinfo["MachPort"],$serverinfo["MachUser"],$serverinfo["MachPass"])) {
                    //echo "Dizin: ".$path;
                    $files = ListADirectory($ssh2->SFTP_FileLink($path));
                    if(isset($_GET["Klasore_Git"])) {
                        if( isset($files[@$_GET["Klasore_Git"]."/"]) ) {
                            if(@$_GET["Klasore_Git"] == "..") {
                                $tmp = explode("/",$_SESSION["OGCP_WebFTP_Path"]);
                                $status = substr($_SESSION["OGCP_WebFTP_Path"],$_SESSION["OGCP_WebFTP_Path"] - 1,1) == "/" ? 2 : 1;
                                $count = count($tmp);
                                for($i=0; $i < $status; $i++) { $count--; unset($tmp[$count]); }
                                $new_path = implode("/",$tmp)."/";
                                $_SESSION["OGCP_WebFTP_Path"] = $new_path;
                            } else {
                                $_SESSION["OGCP_WebFTP_Path"] = $_SESSION["OGCP_WebFTP_Path"].$_GET["Klasore_Git"]."/";
                            }
                            $path = $serverinfo["ServerPath"]."/cstrike".$_SESSION["OGCP_WebFTP_Path"];
                            $files = ListADirectory($ssh2->SFTP_FileLink($path));
                        }
                    }
                    if(isset($_GET["Duzenle"])) {
                        if( isset($files[@$_GET["Duzenle"]]) && file_exists( $ssh2->SFTP_FileLink($path.$_GET["Duzenle"]) ) ) {
                            if(isset($_POST["yardir"]) && $_SESSION["OGCP_WebFTP_Path"] != "/addons/amxmodx/logs/") {
                                $tmp_file = "tmp/tmp_".$serverinfo["ServerIP"]."_".$serverinfo["ServerPort"]."_".basename($path.$_GET["Duzenle"]);
                                $ssh2->SFTP_DownloadFile($path.$_GET["Duzenle"],$tmp_file);
                                $dosya = fopen($tmp_file,"w");
                                fwrite($dosya,$_POST["icerikD"]);
                                @fclose($dosya);
                                if( $ssh2->SFTP_UploadFile($tmp_file,$path.$_GET["Duzenle"]) ) {
                                    unlink($tmp_file);
                                    $page->GoLocation($page->CreatePageLink($cur_page,"Duzenle=".@$_GET["Duzenle"]."&Durum=Duzenlendi"));
                                } else {
                                    unlink($tmp_file);
                                    $page->GoLocation($page->CreatePageLink($cur_page,"Duzenle=".@$_GET["Duzenle"]."&Durum=Duzenlenemedi"));
                                }
                            }
                            $dosya = $files[$_GET["Duzenle"]];
                            $dosya["name"] = $_GET["Duzenle"];
                            $dosyaac = fopen($ssh2->SFTP_FileLink($path.$_GET["Duzenle"]),'r');
                            $dosya["content"] = "";
                            while(!feof($dosyaac)) { $dosya["content"] .= fgets($dosyaac,8192); }
                        } else {
                            $dosya = false;
                        }
                        if( @$_GET["Durum"] == "Duzenlendi" ) {
                            print('<div class="alert success"><span class="hide"></span><strong>Başarılı!</strong> Dosya kaydedildi!</div>');
                        } else if(@$_GET["Durum"] == "Duzenlenemedi") {
                            print('<div class="alert error"><span class="hide"></span><strong>Başarısız!</strong> Dosya kaydedilemedi!</div>');
                        }
                    }
                    if(isset($_POST["klasor_olustur"])) {
                        if(@$_POST["klasor"] != "") {
                            if( mkdir($ssh2->SFTP_FileLink($path.$_POST["klasor"])) ) {
                                print('<div class="alert success"><span class="hide"></span><strong>Başarılı!</strong> Klasor oluşturuldu!</div>');
                                $files = ListADirectory($ssh2->SFTP_FileLink($path));
                            } else {
                                print('<div class="alert error"><span class="hide"></span><strong>Başarısız!</strong> Klasor oluşturulamadı!</div>');
                            }
                        }
                    }
                    
                    if(isset($_POST["dosya_sil"])) {
                        if(@$_POST["sil"] != "") {
                            if( rmdir($ssh2->SFTP_FileLink($path.$_POST["sil"])) ) {
                                print('<div class="alert success"><span class="hide"></span><strong>Başarılı!</strong> Başarılı Dosya Veya Klasör Silindi!</div>');
                                $files = ListADirectory($ssh2->SFTP_FileLink($path));
                            } else {
                            }
                            if( unlink($ssh2->SFTP_FileLink($path.$_POST["sil"])) ) {
                                print('<div class="alert success"><span class="hide"></span><strong>Başarılı!</strong> Başarılı Dosya Veya Klasör Silindi!</div>');
                                $files = ListADirectory($ssh2->SFTP_FileLink($path));
                            } else {
                            }
                        }
                    }
    
                                
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    
                    if(isset($_POST["yukle"]) && isset($_FILES['dosya1'])) {
                        if($_FILES['dosya1']['error'] == 0) {
                            $finfo = finfo_open(FILEINFO_MIME_TYPE);
                            $ext = pathinfo($_FILES['dosya1']['name'], PATHINFO_EXTENSION);
                            $mime_type = finfo_file($finfo, $_FILES['dosya1']['tmp_name']);
                            if( ($mime_type != "image/gif" && $mime_type != "image/jpg" && strpos($mime_type, 'php') === FALSE && strpos($mime_type, 'cgi') === FALSE)&& !file_exists($ssh2->SFTP_FileLink($serverinfo["ServerPath"]."/cstrike".$_SESSION["OGCP_WebFTP_Path"].$_FILES['dosya1']['name'])) && array_key_exists($ext,$access_ext)) {
                                //@mkdir('../fastdl/cstrike/'.$file_path.'ho'.$upload_types[$cr_uploadtype][4].$rndname.'/');
                            if( !file_exists('../fast'.$_SESSION["OGCP_WebFTP_Path"].$_FILES['dosya1']['name']) ) {
                                $klasorler = explode("/", "../fast".$_SESSION["OGCP_WebFTP_Path"]);
                                $cnt_klasorler = count($klasorler);
                                $crt_dir = "";
                                for( $i=0; $i<$cnt_klasorler; $i++ ) {
                                    $crt_dir .= $klasorler[$i].'/';
                                    if( !file_exists($crt_dir) || !is_dir($crt_dir) ) 
                                        @mkdir($crt_dir);
                                }
    
                                @copy($_FILES['dosya1']['tmp_name'], '../fast'.$_SESSION["OGCP_WebFTP_Path"].$_FILES['dosya1']['name']);
                            }
    
    
                            $durum = $ssh2->SFTP_UploadFile($_FILES['dosya1']['tmp_name'],$serverinfo["ServerPath"]."/cstrike".$_SESSION["OGCP_WebFTP_Path"].$_FILES['dosya1']['name']);
                                if($durum) {
                                    print('<div class="alert success"><span class="hide"></span><strong>Başarılı!</strong> Dosya sunucuya yüklendi!</div>');
                                    $files = ListADirectory($ssh2->SFTP_FileLink($path));
                                } else {
                                    print('<div class="alert error"><span class="hide"></span><strong>Hata!</strong> Yukleme başarısız! </div>');
                                }
                            } else {
                                print('<div class="alert error"><span class="hide"></span><strong>Hata!</strong> Dosya sunucuda bulunuyor yada dosya uzantısına izin verilmiyor! </div>');
                            }
                        } else {
                            print('<div class="alert error"><span class="hide"></span><strong>Hata!</strong> Yukleme başarısız! </div>');
                        }
                    }
                } else {
                    print('<div class="alert error"><span class="hide"></span><strong>Hata!</strong> Web FTP\'ye bağlanılamadı! </div>');
                }
        } else {
            print('<div class="alert error"><span class="hide"></span><strong>Hata!</strong> Web FTP\'ye erişim izniniz bulunmamaktadır! </div>');
        }
    ?>
  • 17-02-2022, 00:27:12
    #2
    <?php
    
    $dosya = "dosyayolu/dosyaadi.zip; // Silmek istediğiniz dosyanın uzantsısı
    
      if(file_exists($dosya)){
              unlink($dosya);
              echo "Belirlenen dosya silindi.";
      }else{
              echo "Belirlenen dosya bu dizinde değildir.";
      }
     ?>
    Tam olarak ne istediğinizi anlayamadım sanırım yukarıda yazdığım kod silmek istediğiniz bir dosyayı veya resimi sunucudan silmenize yarar
  • 17-02-2022, 00:32:24
    #3
    QRan7 adlı üyeden alıntı: mesajı görüntüle
    <?php
    
    $dosya = "dosyayolu/dosyaadi.zip; // Silmek istediğiniz dosyanın uzantsısı
    
      if(file_exists($dosya)){
              unlink($dosya);
              echo "Belirlenen dosya silindi.";
      }else{
              echo "Belirlenen dosya bu dizinde değildir.";
      }
     ?>
    Tam olarak ne istediğinizi anlayamadım sanırım yukarıda yazdığım kod silmek istediğiniz bir dosyayı veya resimi sunucudan silmenize yarar
    hocam yukarda paylastıgım kodlarda dosya ve klasor verısı cekıyor hepsını sftp olarak bunların yanına x butonu koyup hepsıne x butonu gelsın ustune tıklayınca sılsın
  • 17-02-2022, 00:43:16
    #4
    Hocam aciliyet durumu ne bilmiyorumda az bi rahatsızlığım var özelden bana bi ekran resmi atarsanız detaylı incelemiş olurum.