PHP konusunda küçük bir yardıma ihtiyacım var arkadaşlar
4
●165
- 10-02-2021, 20:52:05sorunuzu burdan yazarsanız daha güzel bir şekilde çözüm bulabiliriz
- 10-02-2021, 23:46:21Geçen yıl bir arkadaşla bir çalışma yaptıştık. Arkadaşa ulaşamıyorum. Wordpress sitede bir eklentiye özelleştirme yaptı. Fast External Link isminde bir eklenti. Bu eklentiye dokunmadı aslında. Htaccess dosyasında bir değişiklik yaptı ve tüm wp-content-upload yolunda bulunan dosyaları bir indirme sayfasına yönlendirdi. Sitede bulunan PDF,WORD vs herhangi bir dosyaya tıklayınca doğrudan inmeyip, indirme sayfasına geliyor ve orada belirlediğim bir süre kadar bekleyip öyle iniyordu dosya. Şuan herşey çalışıyor. Sıkıntı şu. Sıkıntı şu ki Embed Any Document eklentisi ile bir dosya yüklediğimizde sadece kodlar görünüyor. Dosyayı göremiyor embed bağlantısı. Bunun sebebi ise yaptığımız yönlendirme işlemi. Bunu basit bir şekilde çözmüştü bu yazılımı yapan arkadaş. Yani embed sayfanın içinde sadece kodların görünmesi olayını hemen çözmüştü. Ne yapmıştı da çözülmüştü bulamıyorum. Htaccess içinden mesela PDF yönlendirmesini silince embed bağlantısı düzeliyor. Ama bu defada indirme sayfasına yani köprü sayfasına uğramadan doğrudan iniyor. Hata nerede aceba?
# BEGIN WpFastestCache <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTPS} =on RewriteCond %{HTTP_HOST} ^1siteadi.com # Start WPFC Exclude # End WPFC Exclude RewriteRule \.(pdf|docx|doc|ppt|pptx|xlsx|xls|rtf|pps|csv|wav|3gp|webp|ppsx|txt|odt|xlsm|mp4|mp3|m4a|avi|xps|dot|docm|wma|one|pptm|xlsb|ppsm|zip|rar|wbk|pub|ods|pot|xltx|dotx|potx)$ encode.php?url=https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] # Start_WPFC_Exclude_Admin_Cookie RewriteCond %{HTTP:Cookie} !wordpress_logged_in_[^\=]+\=admin # End_WPFC_Exclude_Admin_Cookie RewriteCond %{HTTP_HOST} ^1siteadi.com RewriteCond %{HTTP_USER_AGENT} !(facebookexternalhit|Twitterbot|LinkedInBot|WhatsApp|Mediatoolkitbot) RewriteCond %{HTTP_USER_AGENT} !(WP\sFastest\sCache\sPreload(\siPhone\sMobile)?\s*Bot) RewriteCond %{REQUEST_METHOD} !POST RewriteCond %{REQUEST_URI} !(\/){2}$ RewriteCond %{REQUEST_URI} \/$ RewriteCond %{QUERY_STRING} !.+ RewriteCond %{HTTP:Cookie} !comment_author_ RewriteCond %{HTTP:Cookie} !safirmobilswitcher=mobil RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC] RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/all/$1/index.html -f [or] RewriteCond /var/www/vhosts/1siteadi.com/httpdocs/wp-content/cache/all/$1/index.html -f RewriteRule ^(.*) "/wp-content/cache/all/$1/index.html" [L] ##### mobile ##### RewriteEngine On RewriteBase / RewriteCond %{HTTPS} =on RewriteCond %{HTTP_HOST} ^1siteadi.com # Start WPFC Exclude # End WPFC Exclude # Start_WPFC_Exclude_Admin_Cookie RewriteCond %{HTTP:Cookie} !wordpress_logged_in_[^\=]+\=admin # End_WPFC_Exclude_Admin_Cookie RewriteCond %{HTTP_HOST} ^1siteadi.com RewriteCond %{HTTP_USER_AGENT} !(facebookexternalhit|Twitterbot|LinkedInBot|WhatsApp|Mediatoolkitbot) RewriteCond %{HTTP_USER_AGENT} !(WP\sFastest\sCache\sPreload(\siPhone\sMobile)?\s*Bot) RewriteCond %{REQUEST_METHOD} !POST RewriteCond %{REQUEST_URI} !(\/){2}$ RewriteCond %{REQUEST_URI} \/$ RewriteCond %{QUERY_STRING} !.+ RewriteCond %{HTTP:Cookie} !comment_author_ RewriteCond %{HTTP:Cookie} !safirmobilswitcher=masaustu RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC] RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/wpfc-mobile-cache/$1/index.html -f [or] RewriteCond /var/www/vhosts/1siteadi.com/httpdocs/wp-content/cache/wpfc-mobile-cache/$1/index.html -f RewriteRule ^(.*) "/wp-content/cache/wpfc-mobile-cache/$1/index.html" [L] ##### mobile ##### </IfModule> <FilesMatch "index\.(html|htm)$"> AddDefaultCharset UTF-8 <ifModule mod_headers.c> FileETag None Header unset ETag Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" Header set Pragma "no-cache" Header set Expires "Mon, 29 Oct 1923 20:30:00 GMT" </ifModule> </FilesMatch> # END WpFastestCache # BEGIN GzipWpFastestCache <IfModule mod_deflate.c> AddType x-font/woff .woff AddType x-font/ttf .ttf AddOutputFilterByType DEFLATE image/svg+xml AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE text/javascript AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE application/x-font-ttf AddOutputFilterByType DEFLATE x-font/ttf AddOutputFilterByType DEFLATE application/vnd.ms-fontobject AddOutputFilterByType DEFLATE font/opentype font/ttf font/eot font/otf </IfModule> # END GzipWpFastestCache # BEGIN WEBPWpFastestCache <IfModule mod_rewrite.c> # END WEBPWpFastestCache # BEGIN LBCWpFastestCache <FilesMatch "\.(webm|ogg|mp4|ico|pdf|flv|jpg|jpeg|png|gif|webp|js|css|swf|x-html|css|xml|js|woff|woff2|ttf|svg|eot)(\.gz)?$"> <IfModule mod_expires.c> AddType application/font-woff2 .woff2 ExpiresActive On ExpiresDefault A0 ExpiresByType video/webm A10368000 ExpiresByType video/ogg A10368000 ExpiresByType video/mp4 A10368000 ExpiresByType image/webp A10368000 ExpiresByType image/gif A10368000 ExpiresByType image/png A10368000 ExpiresByType image/jpg A10368000 ExpiresByType image/jpeg A10368000 ExpiresByType image/ico A10368000 ExpiresByType image/svg+xml A10368000 ExpiresByType text/css A10368000 ExpiresByType text/javascript A10368000 ExpiresByType application/javascript A10368000 ExpiresByType application/x-javascript A10368000 ExpiresByType application/font-woff2 A10368000 </IfModule> <IfModule mod_headers.c> Header set Expires "max-age=A10368000, public" Header unset ETag Header set Connection keep-alive FileETag None </IfModule> </FilesMatch> # END LBCWpFastestCache # BEGIN WordPress # The directives (lines) between "BEGIN WordPress" and "END WordPress" are # dynamically generated, and should only be modified via WordPress filters. # Any changes to the directives between these markers will be overwritten. <IfModule mod_rewrite.c> RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress - 10-02-2021, 23:50:37Ayrıca 3 adet dosya oluşturmuştu. Onlarda aşağıda.
1. Download.php
<?php $file = explode('https://1siteadi.com/',base64_decode(base64_decode($_GET["url"])))[1]; if (file_exists($file)) { header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="'.basename($file).'"'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . filesize($file)); readfile($file); exit; } ?>2.encode.php
<?php function _bot_detected() { return ( isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/bot|crawl|slurp|spider|mediapartners/i', $_SERVER['HTTP_USER_AGENT']) ); } $url = base64_encode(base64_encode($_GET['url'])); if(_bot_detected()) { header("Location: https://1siteadi.com/download.php?url=".$url."&format=cryptic&t=MTU="); }else{ header("Location: https://1siteadi.com/downloads?url=".$url."&format=cryptic&t=MTU="); }3.Test PHP
<?php $extem = []; function listFolderFiles($dir){ $ffs = scandir($dir); unset($ffs[array_search('.', $ffs, true)]); unset($ffs[array_search('..', $ffs, true)]); // prevent empty ordered elements if (count($ffs) < 1) return; foreach($ffs as $ff){ $ext = pathinfo($ff, PATHINFO_EXTENSION); @$GLOBALS['extem'][$ext] = $GLOBALS['extem'][$ext] ? $GLOBALS['extem'][$ext]+1:1; if(is_dir($dir.'/'.$ff)) listFolderFiles($dir.'/'.$ff); } } listFolderFiles('./wp-content/uploads'); arsort($GLOBALS['extem']); print_r($GLOBALS['extem']); ?>Bütün bu kodlar sebebiyle embed dosya bu şekilde görünüyor.

