سلام ، آیا این بازدید اول شماست ؟ یا
نمایش نتایج: از شماره 1 تا 10 , از مجموع 15

موضوع: مشگل در ماژول آخرين مراجعات به سايت

Hybrid View

پست قبلی پست قبلی   پست بعدی پست بعدی
  1. #1

    تاریخ عضویت
    Sep 2006
    محل سکونت
    مازندران - ساری
    نوشته ها
    1,609
    تشکر
    0
    تشکر شده 10 بار در 7 ارسال

    پاسخ : مشگل در ماژول آخرين مراجعات به سايت

    فایل mod_referer_extended.php را در شاخه modules باز کنید و تمامی خط ها را جایگزین خط های زیر کنید
    کد:
    <?php
    
    /*
    
    Latest referers, expanded
    Ben Jones, 2005, octopod.org
    Based on version 1.5 of 'MamboReferer' by Jeffery Fernandez, [مهمان/کاربر گرامی برای دیدن لینک ها ابتدا باید عضو سایت شوید و لاگین کنید برای ثبت نام اینجا کلیک کنید]
    
    Changelog:
    0.1.2 - Bugfixes for handling of output options in readreferers
    0.1.1 - Bugfixes for paramter handling
    0.1  - First version - fixed parameter handling, added admin parameters, added 'run hidden'
        mode and allowed for multiple runs per page, added output formatting paramters
        Tested with mambo 4.5.1a, March 2005
    
    */
    
    /*
    
    Retained copyrights:
    
    // Project Name: MamboReferer
    // For Mambo CMS version 4.5
    // Author : Jeffery Fernandez - [مهمان/کاربر گرامی برای دیدن لینک ها ابتدا باید عضو سایت شوید و لاگین کنید برای ثبت نام اینجا کلیک کنید]
    // Credit: Chris Burgess of [مهمان/کاربر گرامی برای دیدن لینک ها ابتدا باید عضو سایت شوید و لاگین کنید برای ثبت نام اینجا کلیک کنید] for inspiring me. ;o)
    // Version: stable 1.5
    // Date Released: 18/07/2004
    // Released under GNU/GPL License : [مهمان/کاربر گرامی برای دیدن لینک ها ابتدا باید عضو سایت شوید و لاگین کنید برای ثبت نام اینجا کلیک کنید]
    // Demo Url: [مهمان/کاربر گرامی برای دیدن لینک ها ابتدا باید عضو سایت شوید و لاگین کنید برای ثبت نام اینجا کلیک کنید]
    // Download Latest version from here: [مهمان/کاربر گرامی برای دیدن لینک ها ابتدا باید عضو سایت شوید و لاگین کنید برای ثبت نام اینجا کلیک کنید]
    
    */
    
    // Don't allow direct acces to the file
    defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
    
    // Check if we're trying to run this module more than once on the same page
    if (!defined( '_MOD_REFERRER' )) {
       $refererArray = array();
    	 $host = array();
       // Grab the module settings else set to default values. 
       // Number of referers to display: defaults to 12
       $refererCount = abs($params->def( 'refererCount', 5 ));
      
       // After which length should the title be cut off... defaults to 22
       $maxUrlLENGTH = abs($params->def( 'maxUrlLENGTH', 18 ));
    
       // Get the Ban List of sites. They should be separated by ,
       $banList = $params->def( 'banList', '' );
       $banList = explode(",",$banList);
       
       // Get the Bad URL List of sites, words, etc
       $badURLS = $params->def( 'badURLS', '' );
       $badURLS = explode(",",$badURLS);
    
       
       // Get rid of Bad URL's. 
       $badWords = array('<','>','192.168.');
       $badUrl = array_merge($badURLS, $badWords); 
      
       // Are we running in hidden mode, or showing output (default)?
       $showOutput 		= abs($params->def( 'showOutput', 1 ));
       
       // Output in UL list mode?
       $listOutput 		= abs($params->def( 'listOutput', 0 ));
      
       // Trim the output URL from the front?
       $trimFront 		= abs($params->def( 'trimFront', 1 ));
      
      // Setup our constant
      define( '_MOD_REFERRER', null );
      
      // Format the URL title for output
      function setupOutputTitle($fullURL,$maxUrlLENGTH,$trimFront) {
        if (strlen($fullURL) > $maxUrlLENGTH) {
          if ($trimFront==0) {
            return substr($fullURL,0,($maxUrlLENGTH-2)) . str_repeat(".", 2);
          } else {
            return str_repeat(".", 2) . substr($fullURL,-($maxUrlLENGTH-2));
          }
        } else {
          return $fullURL;
        }
      }
      
      // Clear the content from other modules
      $content = "";
      
      function Read_Referers($maxUrlLENGTH, $banList, $badUrl,$trimFront){
        global $mosConfig_absolute_path;	
      	$fileName = $mosConfig_absolute_path . "/modules/mod_referer_extended/referer.txt";
      	if(file_exists($fileName)){// File exists	 
      	 $fp = fopen($fileName,"r");
      	 if($fp){// File opened	  
      		$host = Extract_file($fp, $maxUrlLENGTH, $banList, $badUrl,$trimFront);		
      		$host["address"] = @array_reverse($host["address"]);
      		$host["output"] = @array_reverse($host["output"]);
      		$host["domain"] = @array_reverse($host["domain"]);
      		fclose($fp);
      	 }
      	 return $host;
      	}
      }
      function Extract_file($fp, $maxUrlLENGTH, $banList, $badUrl,$trimFront){
      	while(!feof($fp)){// Loop till End OF File	 
      	 $line = trim(fgets($fp, 999));
      	 if(!empty($line)){// If the read line is not empty 		
      		$url = parse_url($line);
      		// If the Referer has just been added in the Ban List
      		if(!@in_array($url['host'], $banList) && 
      		  (Bad_Str_In_Url($line, $badUrl) == false)
      		 ){
      		 $host["address"][] = $line;
      		 $host["domain"][] = $url['host'];
      		 $host["output"][] = setupOutputTitle($url['host'],$maxUrlLENGTH,$trimFront);
      		} 
      	 }
      	}
      	return $host;
      }
      function Bad_Str_In_Url($haystack, $needle){
       $isBadURL = false;
       $url = parse_url($haystack);
       if(!isset($url['scheme']) ){ //If the url referer has a scheme
        if($url['scheme'] != '[مهمان/کاربر گرامی برای دیدن لینک ها ابتدا باید عضو سایت شوید و لاگین کنید برای ثبت نام اینجا کلیک کنید]){
         $isBadURL = true;
      	 return $isBadURL;
      	}
       }
       if ( count($needle) > 0 ) {
         foreach($needle as $value) { //Loop through the bad url array.
          if ( strlen( $value ) > 0 ) {
            if(!strpos($haystack, $value) === false){
             $isBadURL = true;
          	 break;
          	}
          }
         }
       }
       return $isBadURL;
      }
      // Makes php3 use $_SERVER as well
      //if ( !isset($_SERVER) && (isset($GLOBALS['HTTP_SERVER_VARS'])) ) $GLOBALS['_SERVER'] = $GLOBALS['HTTP_SERVER_VARS'];
      
      // Check for XSS and bad url's.
      $urlPassed = false;
      if(isset($_SERVER['HTTP_REFERER'])){
       if(Bad_Str_In_Url($_SERVER['HTTP_REFERER'], $badUrl) == false)
        $urlPassed = true;
      }
      
      // Get the Refered Page
      if($urlPassed==true){
       $referer = $_SERVER['HTTP_REFERER'];
       $serverHost = $_SERVER['HTTP_HOST']; 
       $refererArray = parse_url($referer);
       if($refererArray['host'] != $serverHost){//Outside Referer  
      	$fileName = $mosConfig_absolute_path . "/modules/mod_referer_extended/referer.txt";
      	if(file_exists($fileName)){// File exists	 
      	 $fp = fopen($fileName,"r");
      	 if($fp){// File opened	  
      		$host = Extract_file($fp, ($maxUrlLENGTH-2), $banList, $badUrl,$trimFront);
      		fclose($fp);
          // Clear the cache
      		clearstatcache();		
      		//If site not recorded before or not in Ban List ;o) or not from localhost
      		if(!@in_array($refererArray['host'], $host["domain"]) && 
      		  !@in_array($refererArray['host'], $banList) && 
      			$refererArray['host']!="localhost"			
      		 ){//Add it to the end of the array
      		 $host["address"][] = $referer;
      		 $host["output"][] = setupOutputTitle($refererArray['host'],$maxUrlLENGTH,$trimFront);
      		 $host["domain"][] = $refererArray['host'];
           // Clear the cache
      		 clearstatcache();			
      		 if(sizeof($host["address"]) >= $refererCount){
      		  $fp = fopen($fileName,"w");
            for($j=((sizeof($host["address"]) - $refererCount)); $j <=$refererCount; $j++){
      			 fwrite($fp, $host["address"][$j] . "\r\n");
      			}
      			fclose($fp);
      		 }
      		 else{
      		  $fp = fopen($fileName,"a");
      		  fwrite($fp, $referer . "\r\n");
      			fclose($fp);
      		 }		 
      		}
      		elseif(@in_array($refererArray['host'], $host["domain"]) ){// If the site already exists on the List		 
      		 // Remove the old Entry
      		 for($j=0; $j <sizeof($host["domain"]); $j++){
      		  if($host["domain"][$j] != $refererArray['host']){
      			 $tempHost["address"][] = $host["address"][$j];
      			 $tempHost["output"][] = $host["output"][$j];
      			 $tempHost["domain"][] = $host["domain"][$j];
      			}
      		 }
      		 // Transfer the temp values across
      		 $host = $tempHost;		 
      		 // Add the new link at the end of the array
      		 $host["address"][] = $referer;
      		 $host["output"][] = setupOutputTitle($refererArray['host'],$maxUrlLENGTH,$trimFront);
      		 $host["domain"][] = $refererArray['host'];
      		 // Write into the Referer List
      		 $fp = fopen($fileName,"w");
           for($k=0; $k <sizeof($host["address"]); $k++){
      			fwrite($fp, $host["address"][$k] . "\r\n");
      		 }
      		 fclose($fp);		 
      		}		
      		$host["address"] = @array_reverse($host["address"]);
      		$host["output"] = @array_reverse($host["output"]);
      		$host["domain"] = @array_reverse($host["domain"]);
      	 }
      	}
       }
       else{// If the Referer is the same as host.... just read the Referer List   
        $host = Read_Referers( $maxUrlLENGTH, $banList, $badUrl,$trimFront);
       } 
      }
      else{// Possibily arrived from a Book-mark or typed in the address of your site 
       $host = Read_Referers( $maxUrlLENGTH, $banList, $badUrl,$trimFront);
      }
      
      // If we're showing output
      if ( $showOutput==1) {
        // Put the output on screen
         if ($listOutput==0) $content .='<table cellpadding="1" cellspacing="0" border="0">';
         if ($listOutput==1) $content .= "<ul>";
         for($i = 0; $i < $refererCount; $i++){ 
          if(!empty($host["address"][$i])){
           if ($listOutput==1) $content .= "<li>";
        	 $highLight = ($refererArray['host'] == $host["domain"][$i])?" class=\"referer\" ":"";
           if ($listOutput==0) $content .= "<tr>\n";
           if ($listOutput==0) $content .= "<td>\n";
        	 $content .= '<a href="' . $host["address"][$i] . '" title="' . $host["address"][$i] . '"' . $highLight . '>' . $host["output"][$i] . '</a>'. "\n";
           if ($listOutput==1) $content .= "</li>";
           if ($listOutput==0) $content .= "</td>\n</tr>\n";
        	}
         }
         if ($listOutput==1) $content .= "</ul>";
         if ($listOutput==0) $content .="</table>\n";
      } else {
        $moduleclass_sfx="_referer_blank";
        $content .= '<style type="text/css">
    			  <!--
    			  .moduletable_referer_blank {
    			  visible: false;
    			  clear: none;
    			  width: 0px;
    			  height: 0px;  
    			  }
    			  -->
    			  </style>
    			  ';  
      }
    
    }
    
    ?>
    موفق و پیروز باشید
    یا علی

    جهت مشاهده لینک ها باید ثبت نام کنید یا لاگین کنید.


  2. # ADS
    تبلیغات در جوملا فارسی
    تاریخ عضویت
    Always
    محل سکونت
    Advertising world
    نوشته ها
    Many
     

علاقه مندی ها (Bookmarks)

علاقه مندی ها (Bookmarks)

مجوز های ارسال و ویرایش

  • شما نمیتوانید موضوع جدیدی ارسال کنید
  • شما امکان ارسال پاسخ را ندارید
  • شما نمیتوانید فایل پیوست کنید.
  • شما نمیتوانید پست های خود را ویرایش کنید
  •