Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //// Copyright 2011-~ Muammer TURKMEN
- class rfistop{
- public $silarray=array("php","txt","asp","aspx","html");
- public $dizinarray=array("public_html","htdocs","httpdocs","httpsdocs");
- public function rfidurdur($durdur="exit",$yapilacak="index.php"){
- foreach($_REQUEST as $gelen=>$veri){
- if(preg_match("#(./|http|.\\\)#si",$veri)){
- if($this->rfikontrol($veri)===false){
- switch($durdur){
- case "exit":
- exit();
- break;
- case "header":
- header("Location:".$yapilacak);
- break;
- case "custom":
- echo $yapilacak;
- break;
- }
- }else{
- echo "tamam";
- }
- }
- }
- }
- private function rfikontrol($suzulecek){
- if(preg_match("#http#si",$suzulecek)){
- $urlal=array_reverse(explode("/",$suzulecek));
- return $this->rfiuygunluk($urlal[0]);
- }else{
- if(preg_match("#(..\\\|../|.\\\|./)#si",$suzulecek)){
- $dizinust="";
- $ustsayi="";
- if(preg_match("#/#si",__FILE__)){
- $dizinbol=array_reverse(explode("/",__FILE__));
- }else{
- $dizinbol=array_reverse(explode("\\",__FILE__));
- }
- foreach($this->dizinarray as $dizin){
- $sayi=array_search($dizin,$dizinbol);
- if($sayi>0){
- $dizinust=$sayi;
- }
- }
- $ustsayi+=substr_count($suzulecek,".\\");
- $ustsayi+=substr_count($suzulecek,"./");
- if($dizinust<$ustsayi){
- return false;
- }else{
- return true;
- }
- }
- }
- }
- private function rfiuygunluk($detect){
- $uzanti=array_reverse(explode(".",$detect));
- if(in_array($uzanti[0],$this->silarray)){
- return false;
- }else{
- return true;
- }
- }
- }
- /*
- $test=new rfistop; // New Class
- $deneme1->rfidurdur("custom","Stop Lamer <img src="http://atmoner.com/wp-includes/images/smilies/icon_biggrin.gif" alt=":D" class="wp-smiley"> "); . Add Custom Message
- $deneme1->rfidurdur(); or $deneme1->rfidurdur("exit"); Use command when locates error. default is exit();
- $deneme1->rfidurdur("header","deneme.php"); Send Attacker to defined page.
- ****** when upload use $_FILES else will be caught to class. **********
- */
- //// Copyright 2011-~ Muammer TURKMEN
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement