View file inc/cache.php

File size: 7.55Kb
<?php
#############################################
# 0JXRgdC70Lgg0YLRiyDRh9C40YLQsNC10YjRjCDRj #
# dGC0L4g0YHQvtC+0LHRidC10L3QuNC1LCDQt9C90L #
# DRh9C40YIg0YLRiyDQvdC10LzQvdC+0LPQviDQt9C #
#          90LDQtdGI0YwgUEhQIQ==            #
#__---------------------------------------__#
#__        0JrQu9C40Log0JrQu9GD0LE=       __#
#  ---------------------------------------  #
# 0JDQstGC0L7RgCA6IE1vcmdhbg==              #
# SUNRIDog0L3QtSDRgdC60LDQttGDIHhE          #
#                                           #
#############################################

/*

$_cache = array();

if($config['oncache']==0)
{
//--------------- Кэштрование количества юзеров
$_cache['colusers']['value'] = mysql_result(query('SELECT COUNT(*) FROM `users`'),0);
//--------------- Кэширование количества доступных ссылок
$_cache['coldost_links']['value'] = 0;
$_res_links = query('SELECT id_user FROM `sites` WHERE `checked` = "1" ');
while($res_l = mysql_fetch_array($_res_links))
 {
 if(mysql_result(query('SELECT money FROM `users` WHERE `id`='.$res_l['id_user'].' '),0)>0)
  {  $_cache['coldost_links']['value']++;  }
 }
//--------------- Кэшрование количества кликов
$_cache['colclicks']['value'] = mysql_result(query('SELECT COUNT(*) FROM `clicks` WHERE `date`='.$day_all.''),0);
//--------------- Кэширование количества всего кликов
$_cache['colclicks_all']['value'] = mysql_result(query('SELECT COUNT(*) FROM `clicks`'),0);
//--------------- Кэширование количества всего площадок
$_cache['colsites']['value'] = mysql_result(query('SELECT COUNT(*) FROM `sites`'),0);

}else
{
//--------------- Кэширование количества юзеров
$res_cache_colusers = query('SELECT * FROM `cache` WHERE `name`="colusers"');
if(mysql_num_rows($res_cache_colusers)>0)
 {
 $_cache['colusers'] = mysql_fetch_array($res_cache_colusers);
 if(($_cache['colusers']['date']+$config['cache_limit_colusers'])<$sitetime || $_cache['colusers']['value'] == '' || $_cache['colusers']['date'] == '')
  {
  $_cache['colusers']['value'] = mysql_result(query('SELECT COUNT(*) FROM `users`'),0);
  query('UPDATE `cache` SET `value`='.$_cache['colusers']['value'].',`date`='.$sitetime.' WHERE `name`="colusers"');
  }
 }else
 {
 $_cache['colusers']['value'] = mysql_result(query('SELECT COUNT(*) FROM `users`'),0);
 query('INSERT INTO `cache` SET `name`="colusers",`value`='.$_cache['colusers']['value'].',`date`='.$sitetime.'');
 }
#mysql_free_result($res_cache_colusers);

//--------------- Кэширование количества доступных ссылок
$res_cache_coldost_links = query('SELECT * FROM `cache` WHERE `name`="coldost_links"');
if(mysql_num_rows($res_cache_coldost_links)>0)
 {
 $_cache['coldost_links'] = mysql_fetch_array($res_cache_coldost_links);
 if(($_cache['coldost_links']['date']+$config['cache_limit_coldost_links'])<$sitetime || $_cache['coldost_links']['value'] == '')
  {
  $_cache['coldost_links']['value'] = 0;
  $_res_links = query('SELECT id_user FROM `sites` WHERE `checked` = "1" ');
  while($res_l = mysql_fetch_array($_res_links))
   {
   if(mysql_result(query('SELECT money FROM `users` WHERE `id`='.$res_l['id_user'].' '),0)>0)
    {  $_cache['coldost_links']['value']++;  }
   }
  query('UPDATE `cache` SET `value`='.$_cache['coldost_links']['value'].',`date`='.$sitetime.' WHERE `name`="coldost_links"');
  }
 }else
 {
 $_cache['coldost_links']['value'] = 0;
 $_res_links = query('SELECT id_user FROM `sites` WHERE `checked` = "1" ');
  while($res_l = mysql_fetch_array($_res_links))
   {
   if(mysql_result(query('SELECT money FROM `users` WHERE `id`='.$res_l.' '),0))
    {  $_cache['coldost_links']['value']++;  }
   }
 query('INSERT INTO `cache` SET `name`="coldost_links",`value`='.$_cache['coldost_links']['value'].',`date`='.$sitetime.'');
 }
#mysql_free_result($res_cache_coldost_links);

//--------------- Кэшрование количества кликов
$res_cache_colclicks = query('SELECT * FROM `cache` WHERE `name`="colclicks"');
if(mysql_num_rows($res_cache_colclicks)>0)
 {
 $_cache['colclicks'] = mysql_fetch_array($res_cache_colclicks);
 if(($_cache['colclicks']['date']+$config['cache_limit_colclicks'])<$sitetime || $_cache['colclicks']['value'] == '')
  {
  $_cache['colclicks']['value'] = mysql_result(query('SELECT COUNT(*) FROM `clicks` WHERE `date`='.$day_all.''),0);
  query('UPDATE `cache` SET `value`='.$_cache['colclicks']['value'].',`date`='.$sitetime.' WHERE `name`="colclicks"');
  }
 }else
 {
 $_cache['colclicks']['value'] = mysql_result(query('SELECT COUNT(*)  FROM `clicks` WHERE `date`='.$day_all.''),0);
 query('INSERT INTO `cache` SET `name`="colclicks",`value`='.$_cache['colclicks']['value'].',`date`='.$sitetime.'');
 }
#mysql_free_result($res_cache_colclicks);

//--------------- Кэширование количества всего кликов
$res_cache_colclicks_all = query('SELECT * FROM `cache` WHERE `name`="colclicks_all"');
if(mysql_num_rows($res_cache_colclicks_all)>0)
 {
 $_cache['colclicks_all'] = mysql_fetch_array($res_cache_colclicks_all);
 if(($_cache['colclicks_all']['date']+$config['cache_limit_colclicks_all'])<$sitetime || $_cache['colclicks_all']['value'] == '')
  {
  $_cache['colclicks_all']['value'] = mysql_result(query('SELECT COUNT(who) FROM `clicks`'),0);
  query('UPDATE `cache` SET `value`='.$_cache['colclicks_all']['value'].',`date`='.$sitetime.' WHERE `name`="colclicks_all"');
  }
 }else
 {
 $_cache['colclicks_all']['value'] = mysql_result(query("SELECT SUM(clicks)  FROM `clicks_counter` "),0);

 query('INSERT INTO `cache` SET `name`="colclicks_all",`value`='.$_cache['colclicks_all']['value'].',`date`='.$sitetime.'');
 }
#mysql_free_result($res_cache_colclicks_all);


//--------------- Кэширование количества всего площадок
$res_cache_colsites = query('SELECT * FROM `cache` WHERE `name`="colsites"');
if(mysql_num_rows($res_cache_colsites)>0)
 {
 $_cache['colsites'] = mysql_fetch_array($res_cache_colsites);
 if(($_cache['colsites']['date']+$config['cache_limit_colsites'])<$sitetime)
  {
  $_cache['colsites']['value'] = mysql_result(query('SELECT COUNT(*) FROM `sites`'),0);
  query('UPDATE `cache` SET `value`='.$_cache['colsites']['value'].',`date`='.$sitetime.' WHERE `name`="colsites"');
  }
 }else
 {
 $_cache['colsites']['value'] = mysql_result(query('SELECT COUNT(*) FROM `sites`'),0);
 query('INSERT INTO `cache` SET `name`="colsites",`value`='.$_cache['colsites']['value'].',`date`='.$sitetime.'');
 }
#mysql_free_result($res_cache_colsites);
/*

//--------------- Кэширование
$res_cache_col = query('SELECT * FROM `cache` WHERE `name`="col"');
if(mysql_num_rows($res_cache_col)>0)
 {
 $_cache['col'] = mysql_fetch_array($res_cache_col);
 if(($_cache['col']['date']+$config['cache_limit_col'])<$sitetime)
  {
  $_cache['col']['value'] = mysql_result(query('SELECT COUNT(*) FROM ``'),0);
  query('UPDATE `cache` SET `value`='.$_cache['col']['value'].',`date`='.$sitetime.' WHERE `name`="col"');
  }
 }else
 {
 $_cache['col']['value'] = mysql_result(query('SELECT COUNT(*) FROM ``'),0);
 query('INSERT INTO `cache` SET `name`="col",`value`='.$_cache['col']['value'].',`date`='.$sitetime.'');
 }
mysql_free_result($res_cache_col);


}

*/

################################################
# 0KHQutGA0LjQv9GCINC90LUg0L/QsNCx0LvQuNC6IQ== #
#   0KHRgtCw0LLRgNC+0L/QvtC70YwsIDIwMDkg0LMu   #
################################################

?>