Файл: 3020.ru/file_3020/_system/_function/banbaseUser.php
Строк: 157
<?
/*banbase.ru Кредитор*/
function writeCacheBan2($content, $filename) {
$fp = fopen(ROOT.'/_images/cache/banbase/' . $filename, 'w');
fwrite($fp, $content);
fclose($fp);
}
function readCacheBan2($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();
$name2 = md5($ank['id'].'banbase');
if (!$main22_cache = readCacheBan2($name2.'.banbase.cache', 86400)){
//Кэширование
$urlbanbase = 'http://banbase.ru/api/search/?wmid='.$ank['wmid'].'&icq='.$ank['icq'].'&email='.$ank['email'];
require FUNC . 'Banbase.php';
$banbase['wmid'] = $ank['wmid'];
$banbase['icq'] = $ank['icq'];
$banbase['email'] = $ank['email'];
$banbase['join'] = '1';
/*$banbase['user'] = '';*/
$res = Banbase::search_arr($banbase);
$banname = NULL;
$banwmid = NULL;
$banicq = NULL;
$banemail = NULL;
$bandescr = NULL;
$ans = $res['answer'];
/*
echo '<pre>';
print_r($ans);
echo '</pre>';
*/
if ($ans)
{
if (!empty($ans['name']))
{
$name_arr = $ans['name'];
$name_str = '|'.implode('|', $name_arr).'|';
$banname = '<br />'.htmlspecialchars('Ники: '.implode(', ', $name_arr));
}
if (!empty($ans['wmid']))
{
$wmid_arr = $ans['wmid'];
$wmid_str = '|'.implode('|', $wmid_arr).'|';
$banwmid = '<br />'.htmlspecialchars('WMID: '.implode(', ', $wmid_arr));
}
if (!empty($ans['icq']))
{
$icq_arr = $ans['icq'];
$icq_str = '|'.implode('|', $icq_arr).'|';
$banicq = '<br />'.htmlspecialchars('ICQ: '.implode(', ', $icq_arr));
}
if (!empty($ans['email']))
{
$email_arr = $ans['email'];
$email_str = '|'.implode('|', $email_arr).'|';
$banemail = '<br />'.htmlspecialchars('EMAIL: '.implode(', ', $email_arr));
}
if (!empty($ans['descr']))
{
$descr_arr = $ans['descr'];
$descr_str = '|'.implode('|', $descr_arr);
$bandescr = '<br />'.htmlspecialchars('Причина: '.implode(', ', $descr_arr));
}
$admin_str = '|'.implode('|', $ans['admin']).'|';
$url_str = '|'.implode('|', $ans['url']).'|';
$site = 'Занес в список: '.implode(', ', $ans['admin']).' ('.implode(', ', $ans['url']).')';
$mas = 'Пользователь находится в черном списке <a href="'.$urlbanbase.'">Banbase.ru</a> '.$banname.$banwmid.$banicq.$banemail.$bandescr.'<br />'.$site;
$banank = $sql -> select("SELECT * FROM `banbase` WHERE `id_user` = '".$ank['id']."' LIMIT 1");
if (($banank) == 0)
{
$time_obn = time() + 60;
$sql -> insert("INSERT INTO `banbase`(`id_user`, `time`, `time_obn`, `nick`, `icq`, `email`, `wmid`, `descr`, `admin`, `site`) VALUES('".$ank['id']."', '".time()."', '".$time_obn."', '".$sql -> esc($name_str)."', '".$sql -> esc($icq_str)."', '".$sql -> esc($email_str)."', '".$sql -> esc($wmid_str)."', '".$sql -> esc($descr_str)."', '".$sql -> esc($admin_str)."', '".$sql -> esc($url_str)."')");
}
/*
else
{
$usban = $sql -> fetch($banank);
if ($usban['time_obn'] < time())
{
$time_obn = time() + 60;
$sql -> update("UPDATE `banbase` SET `time_obn` = '".$time_obn."', `nick` = '".$sql -> esc($name_str)."', `icq` = '".$sql -> esc($icq_str)."', `email` = '".$sql -> esc($email_str)."', `wmid` = '".$sql -> esc($wmid_str)."', `descr` = '".$sql -> esc($descr_str)."', `admin` = '".$sql -> esc($admin_str)."', `site` = '".$sql -> esc($url_str)."' WHERE `id_user` = '".$ank['id']."' LIMIT 1");
}
}
*/
?><div class="profile">
<span class="ank_n"><?= $mas?></span>
</div><?
}else{
?>
<div class="profile">
<span class="ank_n">Ник:</span> <span class="ank_d"><?= $ank['login']?></span>
</div>
<?
}
$main22_cache = ob_get_contents();
ob_clean();
$name2 = md5($ank['id'].'banbase');
writeCacheBan2($main22_cache,$name2.'.banbase.cache');
}
ob_end_clean();
echo $main22_cache;
/*end banbase.ru*/