Вход Регистрация
Файл: plugins/admin.ballans.php
Строк: 68
<?
if ($level <= 2) {
die(
'У вас нет прав доступа');
}

$system['title'] = 'Сколько Денег у магазина';
require 
SYS . 'header.php';


function 
writeCacheBal($content, $filename) {
  
$fp = fopen(ROOT.'/_images/cache/banbase/' . $filename, 'w');
  
fwrite($fp, $content);
  
fclose($fp);
}
      
function 
readCacheBal($filename, $expiry) {
  if (
file_exists(ROOT.'/_images/cache/banbase/' . $filename)) {
    if ((
time() - $expiry) > filemtime('_images/cache/banbase/' . $filename))
      return 
FALSE;
    
$cache = file(ROOT.'/_images/cache/banbase/' . $filename);
    return 
implode('', $cache);
  }
  return 
FALSE;
} 
 
  
ob_start();
$name = md5('shopMagazinBrodaga'.'bal');
if (!
$main2_cache = readCacheBal($name.'.bal.cache', 86400)){
//Кэширование

// test.php - скрипт для тестирования
require FUNC . 'inc.webmoney.balans.php';

$r=_WMXML9();

while(list(
$key,$val)=each($r['purses'])) {
echo 
"<div class='main_menu'>&raquo; На кошельке WM".$key." сумма ".$val." </div>";
}

  
$main2_cache = ob_get_contents();
    
ob_clean();
$name = md5('shopMagazinBrodaga'.'bal');
    
writeCacheBal($main2_cache,$name.'.bal.cache');
} 

ob_end_clean();
echo 
$main2_cache; 

$hfile = $_SERVER['DOCUMENT_ROOT'] .'/_system/_inifiles/cron-balans.json';
if (@
filectime($hfile) < time() - 600) {
    @
unlink($hfile);
}

if (!
file_exists($hfile)) {
    
$fkp = new FreeKassaHade();
    
$balans = $fkp->balans();
    
file_put_contents($hfile, json_encode($balans, true));
}

$json = file_get_contents($hfile);
$balans = json_decode($json, TRUE);

foreach(
$balans['data'] AS $p => $key) {
    echo 
"<div class='main_menu'>&raquo; На кошельке ". $p ." сумма ". $key ." </div>";
}

?>
<div class="foot">
&laquo; <a href="?func=admin"><?= __('Админ панель')?></a>
</div>
<?  
?>
Онлайн: 4
Реклама