Файл: __core/__function.php
Строк: 245
<?
function getNumber($value,$names)
{
$temp = strval($value);
$temp = $temp[strlen($temp)-1];
return (($temp>1 and $temp <5 and (intval($value)>19 or intval($value)<10))?$names[1]:($temp==1?$names[0]:$names[2]));
}
function isDomainAvailible($domain)
{
if(!filter_var($domain, FILTER_VALIDATE_URL))
{
return false;
}
$curlInit = curl_init($domain);
curl_setopt($curlInit,CURLOPT_CONNECTTIMEOUT,10);
curl_setopt($curlInit,CURLOPT_HEADER,true);
curl_setopt($curlInit,CURLOPT_NOBODY,true);
curl_setopt($curlInit,CURLOPT_RETURNTRANSFER,true);
$response = curl_exec($curlInit);
curl_close($curlInit);
if ($response) return true;
return false;
}
function ua_ip()
{
global $ua;
if (preg_match('/opera min/i', $ua)) $browser = 'Opera Mini';
else if (preg_match('/Chrome/i', $ua))$browser = 'Chrome';
else if (preg_match('/Opera/i', $ua)) $browser = 'Opera';
else if (preg_match('/MSIE/i', $ua)) $browser = 'IE';
else if (preg_match('/Mozilla/i', $ua)) $browser = 'Mozilla';
else if (preg_match('/ucweb/i', $ua)) $browser = 'UCWeb';
else $browser = 'Неизвестно';
return $browser;
}
function pagination($posts, $num , $total , $page, $http)
{ if($num < $posts)
{
$pervpage = '';
$nextpage = '';
$page2left = '';
$page1left = '';
$page2right = '';
$page1right = '';
$back = '';
$next = '';
if ($page > 4)
$pervpage = '<a href="'.$http.'1/" class = "open">1</a>';
if ($page < ($total-4) and $page != $total)
$nextpage = '<a href="'.$http.''.$total.'/" class = "open">'.$total.'</a>';
if($page - 2 > 0)
$page2left = '<a href="'.$http.''.($page - 2).'/" class = "open">'.($page - 2).'</a>';
if($page - 1 > 0)
$page1left = '<a href="'.$http.''.($page - 1).'/" class = "open">'.($page - 1).'</a>';
if($page + 2 <= $total)
$page2right = '<a href="'.$http.''.($page + 2).'/" class = "open">'.($page + 2).'</a>';
if($page + 1 <= $total)
$page1right = '<a href="'.$http.''.($page + 1).'/" class = "open">'.($page + 1).'</a>';
echo '<div class="navigation">';
echo $back;
echo $pervpage;
echo "$page2left $page1left <span class='pagination_select'><b>$page</b></span> $page1right $page2right";
echo $nextpage;
echo $next;
echo '</div>';
}
}
function user($column)
{
global $db;
if(!isset($_COOKIE['login'])){$_COOKIE['login'] = '';}
if(!isset($_COOKIE['password'])){$_COOKIE['password'] = '';}
$user = $db -> query
("
SELECT `".$column."` FROM `users` WHERE `name` = '".$_COOKIE['login']."'
and `password`='".$_COOKIE['password']."' LIMIT 1
");
$s = $user -> fetch(PDO::FETCH_ASSOC);
return $s[$column];
}
function userID($column,$id)
{
global $db;
$user = $db -> query
("
SELECT `".$column."` FROM `users` WHERE `id` = '".$id."' LIMIT 1
");
$s = $user -> fetch(PDO::FETCH_ASSOC);
return $s[$column];
}
function auth()
{
global $db;
if(!isset($_COOKIE['login'])){$_COOKIE['login'] = '';}
if(!isset($_COOKIE['password'])){$_COOKIE['password'] = '';}
$usin = $db -> query
("
SELECT `id` FROM `users` WHERE `name` = '".$_COOKIE['login']."'
and `password`='".$_COOKIE['password']."' LIMIT 1
");
if($usin -> rowCount() == 0)
{
echo '<div class="main">Защищенная зона!<br />
'.url('/index/','Авторизуйтесь','').'</div>';
foot();
exit;
return false;
}
else
{
return true;
}
}
function url($http , $name , $type , $target)
{ if($type == 'http')
{ $url = '<a href="http://'.$http.'" target="'.$target.'">'.$name.'</a>';
}
else
{
$url = '<a href="'.$http.'" target="'.$target.'">'.$name.'</a>';
}
return $url;
}
Class filtration
{
function int($abs)
{
$abs = abs(intval($abs));
return $abs;
}
function text($abs)
{
return $abs;
}
}
function head()
{
global $db;
echo '
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Cache-Control" content="cache" />
<meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
<meta name="yandex-verification" content="5300e4c430648108" />
<meta name="title" content="waplog.pw - Рейтинг мобильных сайтов" />
<meta name="keywords" content="статистика, мобильных, mobtops, рейтинг, регистрация, игры, сайт, бесплатно, месяц, апреля, новый, связь, посетители, площадок, страница, общая, топа, знакомства" />
<meta name="description" content="waplog.pw - это популярный каталог мобильных сайтов. Участие в рейтинге даст вам бесплатных целевых посетителей каждый месяц." /><script type="text/javascript">
imageDir = "http://mvcreative.ru/example/6/2/snow/";
sflakesMax = 65;
sflakesMaxActive = 65;
svMaxX = 2;
svMaxY = 6;
ssnowStick = 1;
ssnowCollect = 0;
sfollowMouse = 1;
sflakeBottom = 0;
susePNG = 1;
sflakeTypes = 5;
sflakeWidth = 15;
sflakeHeight = 15;
</script>
<script type="text/javascript" src="http://mvcreative.ru/example/6/2/snow.js"></script>
<link href="/desing/style.css" rel="stylesheet" type="text/css">
<link href="/favicon.ico" rel="shortcut icon">
<title>WAPLOG.PW | '.TITLE.'</title>
<html>
<body>
<div class="logo"><a href="http://waplog.pw">
<img src="/desing/images/logo.png" /></a>
</div>';
if(!isset($_COOKIE['login'])){$_COOKIE['login'] = '';}
if(!isset($_COOKIE['password'])){$_COOKIE['password'] = '';}
if(!empty($_COOKIE['login']) && !empty($_COOKIE['password']))
{
echo '<div class="title5"><div align="right">';
if(user('access') == 5)
{
echo '<a href="/ads/"class="link">Админка</a> ';
}
echo ' <a href="/cabinet/"class="link">Кабинет</a> <a href="/exit/"class="link">Выход</a><br/></div></div>';
}
else
{
echo '<div class="title5"> <a href="/authentication/" class="link"> Вход</a>
<a href="/registration/" class="link"> Регистрация</a></div></div>';
}
echo'<div class="reclame">';
$nid=26217; // id вашего сайта
$kl=1;
print '<img src="/desing/images/n.png" alt=""/> '.get_link($nid,$kl);
function my_link($pid)
{
if ($fp = @fsockopen ("ontraf.ru", 80, $errno, $errstr, 3)) {
@fclose($fp);
return $get;
}
}
echo '<img src="/desing/images/n.png" alt=""/> '.my_link(1782);
$reclame = $db -> query
("
SELECT `id`,`title`,`restrictionDay`,`transitionsDay` FROM `reclame` WHERE `money` > '1' and `status` = '1' ORDER BY RAND() LIMIT 5
");
if($reclame -> rowCount() !== 0)
{
while($r = $reclame->fetch(PDO::FETCH_ASSOC))
{
if($r['restrictionDay'] == 0)
{
echo '<img src="/desing/images/n.png" alt=""/> <a href="/go/'.$r['id'].'/">'.$r['title'].'</a><br />';
}
else
{ if($r['transitionsDay'] < $r['restrictionDay'])
{
echo '<img src="/desing/images/n.png" alt=""/> <a href="/go/'.$r['id'].'/">'.$r['title'].'</a><br />';
}
}
}
}
echo '<img src="/desing/images/n.png" alt=""/> <a href="/reclame/">Купить рекламу</a><br />';
echo '</div>';
if (empty($_SERVER['REQUEST_URI']) or $_SERVER['REQUEST_URI'] == 'index.php' or $_SERVER['REQUEST_URI'] == '/' or $_SERVER['REQUEST_URI'] == '') {
echo '<div class="title2"><a href=/news/><b style="color:#ffffff">Новости проекта </a></b></div>';
if(isset($_GET['deleteNews']) and !empty($_GET['id']) and user('access') == 5)
{
$news = $db -> query
("
SELECT `id` FROM `news` WHERE `id` = '".filtration::int($_GET['id'])."' LIMIT 1
");
if($news -> rowCount() == 1)
{
$deleteNews = $db->exec("DELETE FROM `news` WHERE `id` = '".filtration::int($_GET['id'])."' LIMIT 1 ");
}
}
$news = $db -> query
("
SELECT * FROM `news` ORDER BY `id` ASC
");
if($news -> rowCount() > 0)
{
$start_limit = 1;
while($n = $news -> fetch(PDO::FETCH_ASSOC))
{
echo '<div class="title">';
if(user('access') == 5)
{
echo '';
}
echo'</div><div class="main">'.nl2br($n['news']).'<br/><br/>Добавил: '.userID('name',$n['userID']).'<br/></div>';
$start_limit++;
}
}
}
echo '<div class="title2"><b style="color:#ffffff">'.TITLE.'</b> | <a href=/category/><b style="color:#ffffff">Категории </a></b></div>';
}
function foot()
{
echo '<div class="title2"><a href=/statistics/><b style="color:#ffffff">Статистика топа</a></b></div>';
// echo ' <div class="menu_j"><a href="http://masteram.us/" class="top_menu_j"><img src="/favicon.ico" alt="*"/> Клуб мастеров </a></div>';
echo '<div class="title2"><a href=/><b style="color:#ffffff">WAPLOG.PW</a></b></div>';
echo '<div class="title5"><a href="http://waplog.pw/in/1/"><img src="http://waplog.pw/etc/counter/1/b/" alt="waplog.pw"/></a> </div>';
}
function get_link($nid,$kl)
{
$nua = urlencode(@$_SERVER['HTTP_USER_AGENT']);
$nip = urlencode(@$_SERVER['REMOTE_ADDR']);
$nip2 = urlencode(@$_SERVER['HTTP_X_FORWARDED_FOR']);
$timeout = 2; // таймаут соединения с сервером в секундах
if ($ch = @curl_init())
{
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$nlinks = curl_exec($ch);
curl_close($ch);
}
return $nlinks;
}
# ip
$ip = $_SERVER['REMOTE_ADDR'];
if (isset($_SERVER['HTTP_X_OPERAMINI_PHONE_UA'])){
$ua = trim(htmlspecialchars($_SERVER['HTTP_X_OPERAMINI_PHONE_UA']));
}elseif (isset($_SERVER['HTTP_USER_AGENT'])){
$ua = trim(htmlspecialchars($_SERVER['HTTP_USER_AGENT']));
}else{
$ua = 'Скрыт';
}
$ua = strtok($ua, '/');
$ua = strtok($ua, ' ');
if (preg_match('/opera min/i', $ua)) $browser = 'Opera Mini';
else if (preg_match('/Chrome/i', $ua))$browser = 'Chrome';
else if (preg_match('/Opera/i', $ua)) $browser = 'Opera';
else if (preg_match('/MSIE/i', $ua)) $browser = 'IE';
else if (preg_match('/Mozilla/i', $ua)) $browser = 'Mozilla';
else if (preg_match('/ucweb/i', $ua)) $browser = 'UCWeb';
else $browser = 'Неизвестно';
########################
?>