|
<?php
/*
-----------------------------------------
Автор: -=КотЭ=-(-=MTV=-) и Shot(Robber)
Бесплатный WAP движок: Strongcms
Контакты: 0664452670(МТС) ибо ICQ(7296000)
Файл: function.php
-------------------------------------------
*/
/****** Создаем переменную адреса *****/
$HOME = 'http://'.$_SERVER['HTTP_HOST'];
define('HOME', $_SERVER['DOCUMENT_ROOT']);
/******* Запускаем сессии ******/
session_start();
ob_start();
###############################
######## Фильтрация ###########
###############################
function strong($msg){
$msg = trim($msg);
$msg = htmlspecialchars($msg);
$msg = mysql_escape_string($msg);
return $msg;
}
###############################
####### Подключаем БД #########
###############################
require_once ('config.php'); //Подключаем конфиг с параметрами
$mysql_connect = mysql_connect(dbhost, dbuser, dbpass) or die('Сайт данный момент отключен!Узнаём подробно в http://vk.com/samiktj');
mysql_query('SET NAMES `utf8`', $mysql_connect);
mysql_select_db(dbname, $mysql_connect) or die('Нету подключения к БД');
###############################
##### Проверяем сылку гет #####
###############################
###############################
############ Куки #############
###############################
if (isset($_COOKIE['uslog']) and isset($_COOKIE['uspass'])) {
$uslog = strong($_COOKIE['uslog']);
$uspass = strong($_COOKIE['uspass']);
$dbs = mysql_query("SELECT * FROM `users` WHERE `login` = '".$uslog."' and `pass` = '".$uspass."' LIMIT 1");
$user = mysql_fetch_assoc($dbs);
if (isset($user['id'])) {
if ($user['login'] != $uslog or $user['pass'] != $uspass) {
setcookie('uslog', '', time() - 86400*31);
setcookie('uspass', '', time() - 86400*31);
}
}
$config = mysql_fetch_assoc(mysql_query("SELECT * FROM `config` WHERE `id` = '1'"));
$users = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `login` = '".$uslog."' and `pass`='".$uspass."' LIMIT 1"));
mysql_query("UPDATE `users` SET `viz`='".time()."', `ip`='".strong($_SERVER['REMOTE_ADDR'])."',`browser`='".strong($_SERVER['HTTP_USER_AGENT'])."',`gde`='".strong($_SERVER['REQUEST_URI'])."' WHERE `id`='".$users['id']."'");
$vremja = time() - $users['viz'];
if($vremja < 120) {
$newtime = $user['online'] + $vremja;
mysql_query("UPDATE `users` SET `online` ='".$newtime."' WHERE `id`='".$users['id']."'");
$timeactiv=time() - $users['viz'];
if($timeactiv < 120) {
$newtimeactiv=$users['allonline']+$timeactiv;
mysql_query("UPDATE `users` SET `allonline` ='".$newtimeactiv."' WHERE `id`='".$users['id']."'");
}
}
if(isset($user['id']) && $users['login']!=$uslog or $users['pass']!=$uspass) {
setcookie('uslog', '', time() - 86400*31);
setcookie('uspass', '', time() - 86400*31);
}
}
###############################
########### Ошибка ###########
###############################
function err($tit, $err = NULL){
if(!$err)
$m = '<div class="podmenu"><center><b>'.$tit.'</b></center></div>';
else
$m = '<div class="title">'.$tit.' | Ошибка</div><div class="podmenu"><center><b>'.$err.'</b></center></div>';
return $m;
}
###############################
######## Размер файла #########
###############################
function fsize($file){
if(!file_exists($file)) return "Файл не найден";
$filesize = filesize($file);
$size = array('б', 'Кб', 'Мб', 'Гб');
if($filesize > pow(1024,3)){$n=3;}
elseif($filesize > pow(1024,2)){$n=2;}
elseif($filesize > 1024){$n=1;}
else{$n=0;}
$filesize = ($filesize/pow(1024,$n));
$filesize = round($filesize, 1);
return $filesize.' '.$size[$n];
}
###############################
######### Градиент ############
###############################
function str2gradient($text,$from='', $to='', $mode="hex")
{
if($mode=="hex")
{
$to = hexdec($to[0].$to[1]).",".hexdec($to[2].$to[3]).",".hexdec($to[4].$to[5]);
$from = hexdec($from[0].$from[1]).",".hexdec($from[2].$from[3]).",".hexdec($from[4].$from[5]);
}
if( empty($text) )
return '';
else
$levels=mb_strlen($text);
if (empty($from))
$from = array(0,0,255);
else
$from = explode(",", $from);
if (empty($to))
$to = array(255,0,0);
else
$to = explode(",", $to);
$output = "";
for ($i=1;$i<=$levels;$i++)
{
for ($ii=0;$ii<4;$ii++)
{
$tmp[$ii] = $from[$ii] - $to[$ii];
$tmp[$ii] = floor($tmp[$ii] / $levels);
$rgb[$ii] = $from[$ii] -($tmp[$ii] * $i);
if ($rgb[$ii] > 255) $rgb[$ii] = 255;
$rgb[$ii] = dechex($rgb[$ii]);
$rgb[$ii] = mb_strtoupper($rgb[$ii]);
if (mb_strlen($rgb[$ii]) < 2) $rgb[$ii] = "0$rgb[$ii]";
}
$output .= "<font color=\"".$rgb[0].$rgb[1].$rgb[2]."\">" . $text[$i -1 ] . "</font>";
}
return $output;
}
function buildTextGradient($str, $points, $mode="hex"){
if( count($points) >= 2 && !empty($str) ){
if( count($points) == 2 ){
return iconv("windows-1251", "UTF-8", str2gradient( iconv("UTF-8", "windows-1251", $str), $points[0], $points[1], $mode ) );
}else{
$str = iconv("UTF-8", "windows-1251", $str);
$parts_count = count($points) - 1;
$let_in_part = round( strlen($str) / $parts_count );
$result = '';
for($i = 0; $i < $parts_count; $i++){
$s = substr($str, $i * $let_in_part, ($i < $parts_count ? $let_in_part : strlen($str) - $i * $let_in_part) );
$result .= str2gradient( $s, $points[ $i ], $points[ $i + 1 ], $mode );
}
return iconv("windows-1251", "UTF-8", $result );
}
}
return '';
}
###############################
########### BB Коды ###########
###############################
function bb($mes){
$mes = stripslashes($mes);
$mes = preg_replace('#\[cit\](.*?)\[/cit\]#si', '<div class="cit">\1</div>', $mes);
$mes = preg_replace_callback ('/us{(\d*)}/', 'nick', $mes);
$mes = preg_replace_callback ('/file{(\d*)}/', 'fname', $mes);
$mes = preg_replace_callback ('/tema{(\d*)}/', 'tname', $mes);
$mes = preg_replace('#\<code\>(.*?)\</code\>#si', '<div class="list1">\1</div>', $mes);
$mes = preg_replace('#\[b\](.*?)\[/b\]#si', '<span style="font-weight: bold;"> \1 </span>', $mes);
$mes = preg_replace('/\[url\s?=\s?([\'"]?)(?:http:\/\/)?(.*?)\1\](.*?)\[\/url\]/', ' <a href="http://$2"> $3 </a> ', $mes);
$mes = preg_replace('#\[black\](.*?)\[\/black\]#si', '<span style="color:#000000;">\1</span>', $mes);
$mes = preg_replace('#\[i\](.*?)\[\/i\]#si', '<i>\1</i>', $mes);
$mes = preg_replace('#\[u\](.*?)\[\/u\]#si', '<u>\1</u>', $mes);
$mes = preg_replace('#\[tema\](.*?)\[\/tema\]#si', '<a href="/forum/tema\1">Ссылка на тему в форуме</a>', $mes);
$mes = preg_replace('#\[s\](.*?)\[\/s\]#si', '<s>\1</s>', $mes);
$mes = preg_replace('#\[red\](.*?)\[\/red\]#si', '<span style="color: red">\1</span>', $mes);
$mes = preg_replace('#\[green\](.*?)\[\/green\]#si', '<span style="color: green">\1</span>', $mes);
$mes = preg_replace('#\[blue\](.*?)\[\/blue\]#si', '<span style="color: blue">\1</span>', $mes);
$mes = preg_replace("~(^|\s|-|:| |\()(http(s?)://|(www\.))((\S{25})(\S{5,})(\S{15})([^\<\s.,>)\];'\"!?]))~i", "\\1<a href=\"http\\3://\\4\\5\">\\4\\6...\\8\\9</a>", $mes);
$mes = preg_replace("~(^|\s|-|:|\(| |\xAB)(http(s?)://|(www\.))((\S+)([^\<\s.,>)\];'\"!?]))~i", "\\1<a href=\"http\\3://\\4\\5\">\\4\\5</a>", $mes);
$mes= preg_replace('#\[img\](http|https)://(.*).(gif|png|jpg|jpeg)\[/img]#sU','<img src="/img-src.php?img=\1://\2.\3" alt="Изображение" style="max-width= 140px" height="70">',$mes);
return $mes;
}
function tname($idf){
global $HOME;
if (is_array ($idf))
{
$id = $idf[1];
}
else {
$id = $idf;
}
$file = mysql_fetch_array(mysql_query("SELECT * FROM `forum_tema` WHERE `id` = '".$id."' LIMIT 1"));
return (empty($file)?'[Удален]':'<a href="/forum/tema'.$file['id'].'">'.$file['name'].'</a>');
}
function fname($idf){
global $HOME;
if (is_array ($idf))
{
$id = $idf[1];
}
else {
$id = $idf;
}
$file = mysql_fetch_array(mysql_query("SELECT * FROM `load_file` WHERE `id` = '".$id."' LIMIT 1"));
return (empty($file)?'[Удален]':'<a href="/down/file'.$file['id'].'">'.$file['name'].'</a>');
}
###############################
######### Функция ника ########
###############################
function nick($idf){
if (is_array ($idf)) {
$id = $idf[1];
}
else {
$id = $idf;
}
global $HOME;
$users = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '".$id."' LIMIT 1"));
//---Х-статус---//
$pol = '';
if($users['sex'] == 1)$pol = 'man_on';
else
if($users['sex'] == 2)$pol = 'j_on';
if($users['xstatus'] == 0)$xst = '<img src="'.$HOME.'/images/onl/'.$pol.'.png" alt="*" title="Онлайн" />';
elseif($users['xstatus'] == 1)$xst = '<img src="'.$HOME.'/images/x-status/1.png" alt="*" />';
elseif($users['xstatus'] == 2)$xst = '<img src="'.$HOME.'/images/x-status/2.png" alt="*" />';
elseif($users['xstatus'] == 3)$xst = '<img src="'.$HOME.'/images/x-status/3.png" alt="*" />';
elseif($users['xstatus'] == 4)$xst = '<img src="'.$HOME.'/images/x-status/4.png" alt="*" />';
elseif($users['xstatus'] == 5)$xst = '<img src="'.$HOME.'/images/x-status/5.png" alt="*" />';
elseif($users['xstatus'] == 6)$xst = '<img src="'.$HOME.'/images/x-status/6.png" alt="*" />';
elseif($users['xstatus'] == 7)$xst = '<img src="'.$HOME.'/images/x-status/7.png" alt="*" />';
elseif($users['xstatus'] == 8)$xst = '<img src="'.$HOME.'/images/x-status/8.png" alt="*" />';
elseif($users['xstatus'] == 9)$xst = '<img src="'.$HOME.'/images/x-status/9.png" alt="*" />';
elseif($users['xstatus'] == 10)$xst = '<img src="'.$HOME.'/images/x-status/10.png" alt="*" />';
elseif($users['xstatus'] == 11)$xst = '<img src="'.$HOME.'/images/x-status/11.png" alt="*" />';
elseif($users['xstatus'] == 12)$xst = '<img src="'.$HOME.'/images/x-status/12.png" alt="*" />';
elseif($users['xstatus'] == 13)$xst = '<img src="'.$HOME.'/images/x-status/13.png" alt="*" />';
elseif($users['xstatus'] == 14)$xst = '<img src="'.$HOME.'/images/x-status/14.png" alt="*" />';
elseif($users['xstatus'] == 15)$xst = '<img src="'.$HOME.'/images/x-status/15.png" alt="*" />';
elseif($users['xstatus'] == 16)$xst = '<img src="'.$HOME.'/images/x-status/16.png" alt="*" />';
elseif($users['xstatus'] == 17)$xst = '<img src="'.$HOME.'/images/x-status/17.png" alt="*" />';
//Админ мужского пола
elseif($users['xstatus'] == 18)$xst = '<img src="'.$HOME.'/images/x-status/18.png" alt="*" />';
elseif($users['xstatus'] == 19)$xst = '<img src="'.$HOME.'/images/x-status/19.png" alt="*" />';
elseif($users['xstatus'] == 20)$xst = '<img src="'.$HOME.'/images/x-status/20.png" alt="*" />';
//Админ женского пола
elseif($users['xstatus'] == 21)$xst = '<img src="'.$HOME.'/images/x-status/21.png" alt="*" />';
elseif($users['xstatus'] == 22)$xst = '<img src="'.$HOME.'/images/x-status/22.png" alt="*" />';
elseif($users['xstatus'] == 23)$xst = '<img src="'.$HOME.'/images/x-status/23.png" alt="*" />';
//-----Если пол == 1(мужской)-----//
if($users['sex'] == 1)
{
//-----Если онлайн-----//
if($users['viz'] > time()-3600)
{
$p = $xst;
if($users['iconka']!=NULL){
$p = '<img src="'.$HOME.'/files/iconka/'.$users['iconka'].'" alt="*" width="16" hight="16" title = "Персональная иконка"/>';
}
} else {
$p = '<img src="'.$HOME.'/images/onl/man_of.png" alt="*" title = "Оффлайн"/>';
}
}
//-----Если пол == 2(жен)-----//
elseif($users['sex'] == 2)
{
if($users['viz'] > time()-3600)
{
$p = $xst;
if($users['iconka']!=NULL){
$p = '<img src="'.$HOME.'/files/iconka/'.$users['iconka'].'" width="16" hight="16" alt="*" title = "Персональная иконка"/>';
}
} else {
$p = '<img src="'.$HOME.'/images/onl/j_of.png" alt="*" title = "Оффлайн"/>';
}
}
if($users['rang']==3) $us='<font color="green"><img src="'.$HOME.'/user/verifi.png" alt="Элитный мастер" title="Элитный мастер"></font>';
if($users['level']==1) $us='<font color="green">[<font color="red">Мд</font>]</font>';
if($users['level']==2) $us='<font color="green">[<font color="red">Адм</font>]</font>';
if($users['level']==3) $us='<font color="green">[<font color="red">Ст.Адм</font>]</font>';
if($users['level']==4) $us='<font color="green">[<font color="red">Соз</font>]</font>';
$ke = mysql_fetch_assoc(mysql_query("SELECT * FROM `ked_list` WHERE `kto` = '".$id."' LIMIT 1"));
if($ke != 0) $kd='<font color="green">[<font color="red"><b>кед</b></font>]</font>';
$ban = mysql_fetch_assoc(mysql_query("SELECT * FROM `ban_list` WHERE `kto` = '".$id."' LIMIT 1"));
if($ban != 0) $ban='<font color="black"><b>[Забанен]</b></font>';
if($users['urli']!=NULL)
{
$p1 = '<a href="/@'.$users['urli'].'">';
}else{
$p1 = '<a href="/profile/'.$users['login'].'">';
}
if($users['n_color']!=NULL){
return (empty($users)?'[Удален]':''.$p.' '.$p1.'<b>' . buildTextGradient($users['login'], array($users['n_color'], $users['k_color'])) . '</b></a>'.$ban.' '.$kd.' '.$us.'');
}else{
return (empty($users)?'[Удален]':''.$p.' '.$p1.' <font color="'.$users['color_nick'].'"><b>'.$users['login'].'</b></font></a> '.$ban.' '.$kd.' '.$us.' ');
}
}
###############################
########### Листинг ###########
###############################
function page($k_page=1) {
$page = 1;
$page = strong($page);
$k_page = strong($k_page);
if(isset($_GET['selection'])) {
if ($_GET['selection']=='top')
$page = strong(intval($k_page));
elseif(is_numeric($_GET['selection']))
$page = strong(intval($_GET['selection']));
}
if ($page<1)$page=1;
if ($page>$k_page)$page=$k_page;
return $page;
}
// Определяем кол-во страниц
function k_page($k_post = 0,$k_p_str = 10) {
if ($k_post != 0) {
$v_pages = ceil($k_post/$k_p_str);
return $v_pages;
}
else return 1;
}
function str($link='?',$k_page=1,$page=1){
if ($page<1)$page=1;
$page = strong($page);
$k_page = strong($k_page);
echo '<div class="links">Стр. ';
if ($page != 1)
echo '<a href="'.$link.'selection=1" >1</a>';
else echo '<b>1</b>';
for ($ot=-3; $ot<=3; $ot++){
if ($page+$ot>1 && $page+$ot<$k_page){
if ($ot==-3 && $page+$ot>2)echo " ..";
if ($ot!=0)echo '| <a href="'.$link.'selection='.($page+$ot).'" >'.($page+$ot).'</a> ';
else echo ' | <b>'.($page+$ot).'</b>';
if ($ot==3 && $page+$ot<$k_page-1)echo "|..";}}
if ($page!=$k_page)echo ' | <a href="'.$link.'selection=top" >'.$k_page.'</a> ';
if ($page<$k_page)echo '<a href="'.$link.'selection='.($page+1).'" > ></a> ';
elseif ($k_page>1)echo ' | <b>'.$k_page.'</b>';
if ($page!=$k_page)echo '<a href="'.$link.'selection=top" >>> </a> ';
echo '
';
echo '</div>';
}
###############################
############ Время ############
###############################
function tims2($string) {
$day=floor($string/86400);
$hours=floor(($string/3600)-$day*24);
$min=floor(($string-$hours*3600-$day*86400)/60);
$sec=$string-($min*60+$hours*3600+$day*86400);
if($day > 0) $day2 = $day.' дней,';
if($hours > 0 ) $hours2 = $hours.' часов,';
if($min > 0 ) $min2 = $min.' минут';
if($sec > 0 ) $sec2 = $sec.', секунд';
return $day2.' '.$hours2.' '.$min2.' ';
}
function vremja($time = NULL) {
if(!$time) $time = time();
$data = date('j.n.y', $time);
if($data == date('j.n.y')) $res = 'Сегодня в '. date('G:i', $time);
elseif($data == date('j.n.y', time() - 86400)) $res = 'Вчера в '. date('G:i', $time);
elseif($data == date('j.n.y', time() - 172800)) $res = 'Позавчера в '. date('G:i', $time);
else {
$m = array('0',
'Янв', 'Фев',
'Мар', 'Апр', 'Май',
'Июн', 'Июл', 'Авг',
'Сен', 'Окт', 'Ноя',
'Дек');
$res = date('j '. $m[date('n', $time)] .' Y в G:i', $time);
$res = str_replace(date('Y'), '', $res);
}
return $res;
}
function slv($str,$msg1,$msg2,$msg3) {
$str = (int)$str;
$str1 = abs($str) % 100;
$str2 = $str % 10;
if ($str1 > 10 && $str1 < 20) return $str .' '. $msg3;
if ($str2 > 1 && $str2 < 5) return $str .' '. $msg2;
if ($str2 == 1) return $str .' '. $msg1;
return $str .' '. $msg3;
}
function times($times=NULL){
global $db;
$time = time();
if(($time-$times)<=60){
$timesp = slv((($time-$times)),'секунду','секунды','секунд').' назад';
return $timesp;
}else if(($time-$times)<=3600){$timesp = slv((($time-$times)/60),'минуту','минуты','минут').' назад';
return $timesp;
}else{
$today = date("j M Y", $time);
$today = date("j M Y", $time);
$yesterday = date("j M Y", strtotime("-1 day"));
$timesp=date("j M Y в H:i", $times);
$timesp = str_replace($today, 'Сегодня', $timesp);
$timesp = str_replace($yesterday, 'Вчера', $timesp);
$timesp = strtr($timesp, array ("Jan" => "Янв","Feb" => "Фев","Mar" => "Марта","May" => "Мая","Apr" => "Апр","Jun" => "Июня","Jul" => "Июля","Aug" => "Авг","Sep" => "Сент","Oct" => "Окт","Nov" => "Ноября","Dec" => "Дек",));
return $timesp;}
}
function calc_age($data)
{
$ex_age = explode('.', $data);
$age = date('Y') - $ex_age[2];
if (date('m') < $ex_age[1] || (date('m') == $ex_age[1] && date('d') < $ex_age[0])) {
$age--;
}
$q1 = abs($age) % 100;
$q2 = $age % 10;
if ($q1 > 10 && $q1 < 20) {
$result = 'лет';
} elseif ($q2 > 1 && $q2 < 5) {
$result = 'года';
} elseif ($q2 == 1) {
$result = 'год';
} else {
$result = 'лет';
}
$age = (int)$age;
if ($age == date('Y')) $age = 0;
return $age . ' ' . $result;
}
function zodiak($birth)
{
$birth = explode('.', $birth);
$d = $birth[0];
$m = $birth[1];
$g = $birth[2];
if ($d != NULL and $m != NULL and $g != NULL) {
if ($m == 1);
elseif ($m == 2);
elseif ($m == 3);
elseif ($m == 4);
elseif ($m == 5);
elseif ($m == 6);
elseif ($m == 7);
elseif ($m == 8);
elseif ($m == 9);
elseif ($m == 10);
elseif ($m == 11);
elseif ($m == 12);
$birth = date('Y') - $g;
if (date('n') < $m) $birth = $birth-1;
elseif (date('n') == $m and date('j') < $d) $birth = $birth-1;
if (($d >= 20) and ($m == 3)) {
$znak = 'Овен';
}
elseif (($d <= 20) and ($m == 4)) {
$znak = 'Овен';
}
if (($d >= 20) and ($m == 4)) {
$znak = 'Телец';
}
elseif (($d <= 21) and ($m == 5)) {
$znak = 'Телец';
}
if (($d >= 21) and ($m == 5)) {
$znak = 'Близнецы';
}
elseif (($d <= 21) and ($m == 6)) {
$znak = 'Близнецы';
}
if (($d >= 21) and ($m == 6)) {
$znak = 'Рак';
}
elseif (($d <= 22) and ($m == 7)) {
$znak = 'Рак';
}
if (($d >= 22) and ($m == 7)) {
$znak = 'Лев';
}
elseif (($d <= 22) and ($m == 8)) {
$znak = 'Лев';
}
if (($d >= 23) and ($m == 8)) {
$znak = 'Дева';
}
elseif (($d <= 20) and ($m == 9)) {
$znak = 'Дева';
}
if (($d >= 23) and ($m == 9)) {
$znak = 'Весы';
}
elseif (($d <= 23) and ($m == 10)) {
$znak = 'Весы';
}
if (($d >= 24) and ($m == 10)) {
$znak = 'Скорпион';
}
elseif (($d <= 22) and ($m == 11)) {
$znak = 'Скорпион';
}
if (($d >= 23) and ($m == 11)) {
$znak = 'Стрелец';
}
elseif (($d <= 21) and ($m == 12)) {
$znak = 'Стрелец';
}
if (($d >= 22) and ($m == 12)) {
$znak = 'Козерог';
}
elseif (($d <= 20) and ($m == 1)) {
$znak = 'Козерог';
}
if (($d >= 21) and ($m == 1)) {
$znak = 'Водолей';
}
elseif (($d <= 18) and ($m == 2)) {
$znak = 'Водолей';
}
if (($d >= 19) and ($m == 2)) {
$znak = 'Рыбы';
}
elseif (($d <= 20) and ($m == 3)) {
$znak = 'Рыбы';
}
return $znak;
}
}
###############################
############ Смайлы ###########
###############################
function smile($msg) {
global $HOME;
$msg = trim($msg);
$s = mysql_query("SELECT * FROM `smile` ORDER BY `id` DESC");
while($smile = mysql_fetch_array($s)) {
$msg = str_replace($smile['name'],' <img src="'.$HOME.'/files/smile/'.$smile['icon'].'" alt="'.$smile['name'].'"/> ',$msg);
}
return $msg;
}
###############################
#### Определение браузера #####
###############################
function user($user = NULL) {
global $HOME;
// Определение браузера
$ank = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '$user' LIMIT 1"));
$ua = strtolower($ank['browser']);
if (preg_match('#(orca)#ui', $ua)) $browser = $path_pc .'<img src="'.$HOME.'/design/imgs/browsers/orca.png" alt="" />';
elseif (preg_match('#(lunascape)#ui', $ua)) $browser = $path_pc .'<img src="'.$HOME.'/design/imgs/browsers/lunascape.png" alt="" />';
elseif (preg_match('#(arora)#ui', $ua)) $browser = $path_pc .'<img src="'.$HOME.'/design/imgs/browsers/arora.png" />';
elseif (preg_match('#(coolnovo)#ui', $ua)) $browser = $path_pc .'<img src="'.$HOME.'/design/imgs/browsers/coolnovo.png" alt="" />';
elseif (preg_match('#(kylo)#ui', $ua)) $browser = $path_pc .'<img src="'.$HOME.'/design/imgs/browsers/kylo.png" alt="" />';
elseif (preg_match('#(flock)#ui', $ua)) $browser = $path_pc .'<img src="'.$HOME.'/design/imgs/browsers/flock.png" alt="" />';
elseif (preg_match('#(rockmelt)#ui', $ua)) $browser = $path_pc .'<img src="'.$HOME.'/design/imgs/browsers/rockmelt.png" alt="" />';
elseif (preg_match('#(cometbird)#ui', $ua)) $browser = $path_pc .'<img src="'.$HOME.'/design/imgs/browsers/cometbird.png" alt="" />';
elseif (preg_match('#(seamonkey)#ui', $ua)) $browser = $path_pc .'<img src="'.$HOME.'/design/imgs/browsers/seamonkey.png" alt="" />';
elseif (preg_match('#(iron)#ui', $ua)) $browser = $path_pc .'<img src="'.$HOME.'/design/imgs/browsers/iron.png" alt="" />';
elseif (preg_match('#(presto)#ui', $ua)) $browser = $path_pc .'<img src="'.$HOME.'/design/imgs/browsers/opera.png" alt="" />';
elseif (preg_match('#(yabrowser)#ui', $ua)) $browser = $path_pc .'<img src="'.$HOME.'/design/imgs/browsers/yabrowser.png" alt="" />';
elseif (preg_match('#(chrome)#ui', $ua)) $browser = $path_pc .'<img src="'.$HOME.'/design/imgs/browsers/chrome.png" alt="" />';
elseif (preg_match('#(msie)#ui', $ua)) $browser = $path_pc .'<img src="'.$HOME.'/design/imgs/browsers/msie.png" alt="" />';
elseif (preg_match('#(maxthon)#ui', $ua)) $browser = $path_pc .'<img src="'.$HOME.'/design/imgs/browsers/maxthon.png" alt="" />';
elseif (preg_match('#(safari)#ui', $ua)) $browser = $path_pc .'<img src="'.$HOME.'/design/imgs/browsers/safari.png" alt="" />';
elseif (preg_match('#(qtweb)#ui', $ua)) $browser = $path_pc .'<img src="'.$HOME.'/design/imgs/browsers/qtweb.png" alt="" />';
elseif (preg_match('#(firefox)#ui', $ua)) $browser = $path_pc .'<img src="'.$HOME.'/design/imgs/browsers/firefox.png" alt="" />';
// Мобильные браузеры
if (preg_match('#(sonyericsson)#ui', $ua)) $browser = $path_mob .'<img src="'.$HOME.'/design/imgs/browsers/sony_ericsson.png" alt="" />';
elseif (preg_match('#(ipod)#ui', $ua)) $browser = $path_mob .'<img src="'.$HOME.'/design/imgs/browsers/apple.png" alt="" />';
elseif (preg_match('#(iphone)#ui', $ua)) $browser = $path_mob .'<img src="'.$HOME.'/design/imgs/browsers/apple.png" alt="" />';
elseif (preg_match('#(android)#ui', $ua)) $browser = $path_mob .'<img src="'.$HOME.'/design/imgs/browsers/android.png" alt="" />';
elseif (preg_match('#(symbian)#ui', $ua)) $browser = $path_mob .'<img src="'.$HOME.'/design/imgs/browsers/symbian.png" alt="" />';
elseif (preg_match('#(windowsphone)#ui', $ua)) $browser = $path_mob .'<img src="'.$HOME.'/design/imgs/browsers/windows.png" alt="" />';
elseif (preg_match('#(wp7)#ui', $ua)) $browser = $path_mob .'<img src="'.$HOME.'/design/imgs/browsers/windows.png" alt="" />';
elseif (preg_match('#(wp8)#ui', $ua)) $browser = $path_mob .'<img src="'.$HOME.'/design/imgs/browsers/windows.png" alt="" />';
elseif (preg_match('#(webos)#ui', $ua)) $browser = $path_mob .'<img src="'.$HOME.'/design/imgs/browsers/hp.png" alt="" />';
elseif (preg_match('#(blackberry)#ui', $ua)) $browser = $path_mob .'<img src="'.$HOME.'/design/imgs/browsers/blackberry.png" alt="" />';
elseif (preg_match('#(htc)#ui', $ua)) $browser = $path_mob .'<img src="'.$HOME.'/design/imgs/browsers/htc.png" alt="" />';
elseif (preg_match('#(opera m)#ui', $ua)) $browser = $path_mob .'<img src="'.$HOME.'/design/imgs/browsers/opera.png" alt="" />';
return $browser;
$arr = array('nokia',
'samsung',
'siemens',
'fly',
'motorola',
'sharp',
'sony',
'lg',
'acer',
'alcatel',
'asus',
'gigabyte',
'highscreen',
'huawei',
'philips',
'mts',
'midp-2.0',
'ucweb');
foreach ($arr as $value) {
if (strpos($ua, $value) !== false) {
$browser = $path_mob;
return $browser;
}
}
}
function stati($id){
$status = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '".$id."'"));
return (empty($status['stat'])?'':' <div class="podmenu">Статус: ' . buildTextGradient($status['stat'], array($status['n_color'], $status['k_color'])) . '</div>');
}
require_once ('reg.php');
require_once ('block.php');
require_once ('wapweb.php');
#############################
############ Бан ############
#############################
require_once ('ban.php');
$guest = mysql_fetch_assoc(mysql_query("SELECT * FROM `guests` WHERE `ip` = '".mysql_real_escape_string($_SERVER['REMOTE_ADDR'])."' and `ua`='".$_SERVER['HTTP_USER_AGENT']."'"));
if($guest == 0) {
mysql_query("INSERT INTO `guests` SET `ip` = '".mysql_real_escape_string($_SERVER['REMOTE_ADDR'])."', `ua` = '".$_SERVER['HTTP_USER_AGENT']."', `time` = '".time()."'");
} else {
}
$ipproverka = mysql_fetch_assoc(mysql_query("SELECT * FROM `ban_ip` WHERE `ip` = '".mysql_real_escape_string($_SERVER['REMOTE_ADDR'])."' LIMIT 1")); //ищем ip в базе ban_ip
if($ipproverka != 0) {
require_once ('header.php');
echo '<div class="title">Бан по IP</div>';
echo '<div class="podmenu"><font color="red">Вы забанены по IP</font></div>';
echo '<div class="podmenu">Вас забанил: '.nick($ipproverka['user']).'</div>';
require_once ('footer.php');
exit();
}
?>