php kullanarak belirli bir klasöre erişimi reddetmek

4 Cevap

Bu php kullanarak apache htaccess tarzı "tüm inkar" mümkündür.

Im farklı web sunucusu kullanıyorsanız, çünkü ben htaccess kullanamıyorum, bu yüzden geçici çözüm php kullanmak için wan't.

Yani kullanıcı klasör adı 'david' erişmeye çalışıyorsunuz diyelim, tüm içerik ve alt inceleyen reddedilir.

4 Cevap

Without cooperation from the webserver dosyalarınızı korumak için tek yoldur

  • için encrypt them, bir arşiv, belki de, hangi your script would know the password and tell no one - O sunucusu bu her zaman şifresini olacak gibi cpu israf sona, ya da olacak

  • bir incredibly deranged file naming scheme kullanmak için, bir dosya adlandırma şeması Hiç kimseye açıklamak, ve sadece php script yalak sıralayabilir olmaz.

Yine veri bant genişliği boşa gitmesine ve şifrelenmiş dosyaları şifresi, indirilebilir olabilir.

Her ne kadar veri konularda o bağlıdır. Ve ne kadar zaman maliyetleri, as these convoluted layers of somewhat penetrable obfuscation will likely eat huge chunks of developer time.

Dediğim gibi, şimdi ... olacağını without cooperation from the webserver ... ama ne olursa the webserver is cooperating and doesn't know?

I've seen some apache webservers, (can anyone confirm it's in the standard distribution?) for instance, come preloaded with a rule denying access to files starting with .ht, not only .htaccess but everything similar: .htproxy, .htcache, .htwhatever_comes_to_mind, .htyourmama...
Chances are your server could be one of those.

Bu durum buysa ... gizli dosyaları .hthidden-<filename1>,.hthidden-<filename2>... yeniden adlandırın ve readfile() gibi, sadece php dosya fonksiyonları ile onlara erişebilirsiniz

No
PHP cannot be used to protect folders.
Because it is not PHP who serves requests, but a web server

Bunu web erişimi engellemek için Belge Kökü yukarıda bu kataloğu taşıyabilirsiniz.

Ama premissions Sana hiçbir şey yardımcı olacaktır

Sadece klasörü dizine önlemek istiyorsanız, basit bir yeniden yönlendirme yapan bir index.php dosyası oluşturabilirsiniz. Geçerli bir dosya adı Note: İstekler hala üzerinden izin verilecektir.

<?php
   header("Location: /"); // redirect user to root directory