Post by HALDOR » Tue Feb 23, 2010 4:22 am

Hello!

Please, ¿Does anyone know, how can I activate the glob() function from the php.ini on the server?

thank you very much, and sorry for my english, is terrible :)

User avatar
New member

Posts

Joined
Mon Dec 14, 2009 5:44 am

Post by amertad » Sat Feb 19, 2011 11:44 pm

help : http://seclists.org/fulldisclosure/2005/Sep/1


new cache.php

Code: Select all

<?php
////////////////////////////////////////////
// Opencart.com
// Farhad Sakhaei ~ parsmizban.com
// Mohammad Reza Mahmoudi ~ iropencart.com
///////////////////////////////////////////

	 function MRMs_glob($dir){
	  $files = array();
	   if(is_dir($dir)){
		   if($dh=opendir($dir)){
		   while(($file = readdir($dh)) !== false){
		      	$files[]=$dir.$file;
				}}
			}
		return $files;
		}
		
/////////////////////////////////////////

final class Cache { 
	private $expire = 3600; 

  	public function __construct() {
		$files = MRMs_glob(DIR_CACHE . 'cache.*');
		
		if ($files) {
			foreach ($files as $file) {
				$time = substr(strrchr($file, '.'), 1);

      			if ($time < time()) {
					if (file_exists($file)) {
						@unlink($file);
					}
      			}
    		}
		}
  	}

	public function get($key) {
		$files = MRMs_glob(DIR_CACHE . 'cache.' . $key . '.*');
		
		if ($files) {
    		foreach ($files as $file) {
      			$cache = '';
				
				$handle = fopen($file, 'r');
      			
				if ($handle) {
					$cache = fread($handle, filesize($file));
	  
					fclose($handle);
				}

	      		return unserialize($cache);
   		 	}
		}
  	}

  	public function set($key, $value) {
    	$this->delete($key);
		
		$file = DIR_CACHE . 'cache.' . $key . '.' . (time() + $this->expire);
    	
		$handle = fopen($file, 'w');

    	fwrite($handle, serialize($value));
		
    	fclose($handle);
  	}
	
  	public function delete($key) {
		$files = MRMs_glob(DIR_CACHE . 'cache.' . $key . '.*');
		
		if ($files) {
    		foreach ($files as $file) {
      			if (file_exists($file)) {
					@unlink($file);
					clearstatcache();
				}
    		}
		}
  	}
}
?>

توسعه اپن کارت
طراحی نرم افزارهای مبتنی بر اپن کارت - امنیت/توسعه اختصاصی/خدمات سئو/ سیستم تیکت و فروش بلیط/مدیر سمینار و همایش
اتصال اپن کارت به نرم افزارهای انبار داری و انواع CRM و ERP و دستگاه پوز و پرینتر
https://www.imahmoudi.ir
https://www.opencart.com/index.php?rout ... @gmail.com


User avatar
New member

Posts

Joined
Fri Apr 30, 2010 1:04 am
Location - tehran - iran
Who is online

Users browsing this forum: No registered users and 31 guests