IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası
  sohbet odaları

>
+
Etiketlenen Kullanıcılar

 
 
LinkBack Seçenekler Arama Stil
Prev önceki Mesaj   sonraki Mesaj Next
Alt 15 Ocak 2015, 06:46   #1
Çevrimdışı
Kullanıcıların profil bilgileri misafirlere kapatılmıştır.
IF Ticaret Sayısı: (0)
IF Ticaret Yüzdesi:(%)
Hotlink koruması class




<?
class D_Security {

var $lista;
var $path;

function Dow_Security() {
$this->lista = array(); // Create empty host list
$this->path = "./"; // set default path do current folder
}

function SetPath($path) {
$this->path = $path;
}

function AddHost($host) {
if (empty($host)) {
return false;
}
$this->lista[] = $host;
return true;
}

function RemoveHost($host) {
for ($i=0;$i<count($this->lista);$i++) {
if ($this->lista[$i]==$host) {
$this->RemoveArrayItem($this->lista,$i);
}
}
}

function ListHosts() {
return $this->lista;
}

function RemoveArrayItem(&$ar,$item)
{
$ar = array_merge(array_splice($ar,0,$item),array_splice ($ar,1));
}

function DownloadFile($filename) {
if ($this->ChecaReferer() == true) {
$fil = $this->$path.$filename;
header("Content-type: application/octet-stream");
header("Content-disposition: attachment; filename=".basename($fil));
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize("$fil"));
readfile($fil);
return true;
} else {
return false;
}

}

function ChecaReferer() {
$cont = count($this->lista);

for ($x=0;$x<$cont;$x++) {
if (eregi($this->lista[$x],$_SERVER["HTTP_REFERER"])) {
return true;
break;
}

}

}

}
// Example
$dow = new D_Security(); // Create new object
$dow->SetPath("./"); // set the folrder where the files are stored

$dow->AddHost("
Bu forumdaki linkleri ve resimleri görebilmek için en az 25 mesajınız olması gerekir.
Add host to list
$dow->AddHost($_SERVER["HTTP_REFERER"]); // Add host to list

if (!$dow->DownloadFile("example.exe")) { // Download the file
echo "<br>Error: you are trying to download this file from unauthorized site<br>";
echo "Try again from authorized host now: <a href=downloader.php>link</a>";
} ?>

__________________
Bu kez pek bir afili yalnızlık, ağlatan bir kadın kadar düşman. Ağzı bozuk üstelik bırakmıyor acıtmadan.
 
Alıntı ile Cevapla

 

Etiketler
class, hotlink, koruması


Konuyu Toplam 1 Üye okuyor. (0 Kayıtlı üye ve 1 Misafir)
 

Yetkileriniz
Konu Acma Yetkiniz Yok
Cevap Yazma Yetkiniz Yok
Eklenti Yükleme Yetkiniz Yok
Mesajınızı Değiştirme Yetkiniz Yok

BB code is Açık
Smileler Açık
[IMG] Kodları Açık
HTML-Kodu Kapalı
Trackbacks are Kapalı
Pingbacks are Açık
Refbacks are Açık


Benzer Konular
Konu Konuyu Başlatan Forum Cevaplar Son Mesaj
Search and Replace class ( notepad ki düzen/değiştir işlemi) bul ve değiştir class hAte PHP 0 11 Kasım 2014 05:07
Hotlink ekleme nighthawk mIRC Scripting Sorunları 2 09 Mayıs 2014 13:59
HOTLINK Eventı Hakkında Anlatım Regex mIRC Scripting Dersleri 2 04 Ağustos 2009 14:12
Hotlink Yardım.. KiLL mIRC Scripting Sorunları 16 12 Şubat 2009 21:00