Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function writeCache($content, $filename) {
- $fp = fopen('./tmp/cache/ban-acc/' . $filename, 'w');
- fwrite($fp, $content);
- fclose($fp);}
- function readCache($filename, $expiry) {
- if (file_exists('./tmp/cache/ban-acc/' . $filename)) {
- if ((time() - $expiry) > filemtime('./tmp/cache/ban-acc/' . $filename))
- return FALSE;
- $cache = file('./tmp/cache/ban-acc/' . $filename);
- return implode('', $cache);}
- return FALSE;}
- ob_start();
- ?>
- <cached>
- <?php
- if (!$cached = readCache('ban_acc.cache', 700)) {
- ?>
- <?php
- $host = 'localhost';
- $user = 'root';
- $pass = '';
- $rdb = 'blizz';
- $connect = mysql_connect($host,$user,$pass) or die('Нет подключения к базе данных');
- mysql_select_db ($rdb, $connect) or die(mysql_error());
- $ban_account = mysql_query('SET NAMES utf8');
- $ban_account = mysql_query("SELECT * FROM `account_banned` WHERE `active` = 1 ORDER BY `bandate` DESC LIMIT 35000", $connect) or die(mysql_error());
- $id = 1;
- while ($result_account = mysql_fetch_array($ban_account)){
- $accout_id = $result_account['id'];
- $username_sql = mysql_query("SELECT * FROM `account` WHERE `id` = $accout_id LIMIT 1", $connect) or die(mysql_error());
- $result_username = mysql_fetch_array($username_sql);
- $account = $result_username['username'];
- $bandate = date("H:i:s d.m.Y", $result_account['bandate']);
- $bannedby = $result_account['bannedby'];
- $banreason = $result_account['banreason'];
- if ($result_account['bandate'] == $result_account['unbandate'])
- $unbandate = '<center>Навсегда</center>';
- else
- $unbandate = date("H:i:s d.m.Y", $result_account['unbandate']);
- if ($result_account['bannedby'] == '')
- $bannedby = 'Консоль';
- print "
- <tr class=\"dissing-col\">
- <th class=\"hoge-bane-page-st\"scope=\"row\">$id</th>
- <th class=\"hoge-bane-page-st\">$account</th>
- <th class=\"hoge-bane-page-st\">$bandate</th>
- <th class=\"hoge-bane-page-st\">$bannedby</th>
- <th class=\"hoge-bane-page-st\">$banreason</th>
- <th class=\"hoge-bane-page-st\">$unbandate</th>
- </tr>
- ";
- $id++;
- }
- mysql_close($connect);
- ?>
- </cached>
- <?php
- $cached = ob_get_contents();
- ob_clean();
- writeCache($cached, 'ban_acc.cache');
- }
- ob_end_clean();
- echo $cached;
- $cachefile = 'cached-files/'.date('M-d-Y').'.php';
- $cachetime = 18000;
- if (file_exists($cachefile) && time() - $cachetime < filemtime($cachefile)) {
- include($cachefile);
- exit;
- }
- ob_start();
- $fp = fopen($cachefile, 'w');
- fwrite($fp, ob_get_contents());
- fclose($fp);
- ob_end_flush();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement