Файл: archive/www/musimka.ru/connect.php
Строк: 264
<?
session_start();
//-------------Заголовок--------------//
$title = 'Musimka.ru';
//---------Название (адрес)-------//
$site_name = 'Musimka.ru';
//----------Адрес сайта-------------//
$url = 'Musimka.ru';
//-------Ссылка на главную-----//
$home_url = '<a href="http://musimka.ru">Главная</a>';
//----------Данные базы-----------//
$dbserver='localhost';
$dbuser='sql';
$dbpassword='bugtrag1';
$db='sql';
//---------Время в онлайн-------//
$system['online_time'] = 1800;
//-------------Антифлуд в беседке---------///
$system['arbour_antiflud'] = 20;
//-------------Антифлуд в дневнике---------///
$system['diary_antiflud'] = 300;
//-------------Антифлуд при добавлении статуса в микроблогах-----------//
$system['microblog_antiflud'] = 100;
//-------------------Антифлуд при комментария в микроблогах----------------//
$system['microblog_comm_antiflud'] = 20;
//-----------------------------Антифлуд лайков в микроблогах---------------------//
$system['microblog_like_antiflud'] = 5;
//--------------------------------Антифлуд на стенах-------------------------------//
$system['wall_antiflud'] = 20;
//--------------------------------Антифлуд на фото-------------------------------//
$system['photo_antiflud'] = 100;
//--------------------------------Антифлуд на редактирование форума-------------------------------//
$system['edit_forum_antiflud'] = 60;
//--------------------------------Антифлуд на создане категории в форуме-------------------------------//
$system['cat_forum_antiflud'] = 60;
//--------------------------------Антифлуд на редактирование категориий в форуме-------------------------------//
$system['cat_edit_forum_antiflud'] = 60;
//--------------------------------Антифлуд на удаление категории в форуме-------------------------------//
$system['deleted_forum_antiflud'] = 3600;
//--------------------------------Антифлуд на блокирование-------------------------------//
$system['ban_user'] = 10;
//--------------------------------Антифлуд на Редактирование-------------------------------//
$system['edit_user'] = 10;
//--------------------------------Антифлуд на Создание темы в форуме-------------------------------//
$system['forum_theme'] = 60;
//--------------------------------Антифлуд на редактирование темы в форуме-------------------------------//
$system['edit_forum_theme'] = 20;
//--------------------------------Антифлуд на редактирование сообщения в форуме-------------------------------//
$system['edit_comm_forum_theme'] = 20;
//--------------------------------Антифлуд на сообщения в чате-------------------------------//
$system['chat_comm'] = 3;
//--------------------------------Антифлуд на добавление комнаты в чате-------------------------------//
$system['chat_add'] = 60;
//--------------------------------Антифлуд на редактировани комнаты в чате-------------------------------//
$system['chat_edit'] = 60;
//--------------------------------Антифлуд на удаление комнаты в чате-------------------------------//
$system['deleted_chat_antiflud'] = 1800;
//--------------------------------Антифлуд на vip статус-------------------------------//
$system['vip'] = 60;
if (!mysql_connect($dbserver, $dbuser, $dbpassword)) {
echo "Ошибка подключения к серверу MySQL";
exit;
}
mysql_select_db($db);
mysql_query("SET NAMES utf8");
if (isset ($_SESSION['login']) && isset ($_SESSION['pass'])) {
$login = mysql_real_escape_string($_SESSION['login']);
$pass = mysql_real_escape_string($_SESSION['pass']);
} else {
if (isset ($_COOKIE['clogin']) && isset ($_COOKIE['cpass'])) {
$login = mysql_real_escape_string($_COOKIE['clogin']);
$_SESSION['login'] = $login;
$pass = md5(mysql_real_escape_string($_COOKIE['cpass']));
$_SESSION['pass'] = $pass;
}
}
if ($login && $pass) {
$login = check($login);
$req = mysql_query("SELECT * FROM `users` WHERE `login` = '$login' LIMIT 1");
if (mysql_num_rows($req)) {
$u = mysql_fetch_assoc($req);
if ($pass === $u['pass']) {
} else {
unset ($_SESSION['login']);
unset ($_SESSION['pass']);
setcookie('clogin', '');
setcookie('cpass', '');
$login = false;
$pass = false;
}
} else {
unset ($_SESSION['login']);
unset ($_SESSION['pass']);
setcookie('clogin', '');
setcookie('cpass', '');
$login = false;
$pass = false;
}
}
function ban($id) {
$req = mysql_query("SELECT * FROM `users_ban` WHERE `user` = '".$id."' ORDER BY `time_ban` DESC LIMIT 1");
$res = mysql_fetch_assoc($req);
if($res['time_ban'] > time()) return true;
}
function error($text) {
echo '<div class = "div"><font color="red">'.$text.'</font></div>';
}
function ok($text) {
echo '<div class = "div"><font color="green">'.$text.'</font></div>';
}
function avatar_soo($id)
{
global $set;
if (is_file('.H.'."sys/avatar/$id.gif"))
echo "<img src='/sys/avatar/$id.gif' alt='' />n";
elseif (is_file('.H.'."sys/avatar/$id.jpg"))
echo "<img src='/sys/avatar/$id.jpg' alt='' />n";
elseif (is_file('.H.'."sys/avatar/$id.png"))
echo "<img src='/sys/avatar/$id.png' alt='' />n";
elseif ($_SERVER['PHP_SELF']!='')
echo "<img src='/style/themes/user.png' alt='' />n";
}
function online($online) {
if($online > (time()-1800)) {
$online = '<img src = "/ico/on.png">';
} else {
$online = '<img src = "/ico/off.png">';
}
return $online;
}
// получаем данные пользователя и уровень прав (+ кеширование)
function get_user($user_id=0)
{
if($user_id!=0){
static $users; // переменная не удаляется после вызова функции
$user_id=intval($user_id);
$users[0]=false;
if (!isset($users[$user_id])){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `id` = '$user_id'"),0)==1)
{
$users[$user_id]=mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '$user_id' LIMIT 1"));
}
else $users[$user_id]=false;
}
return $users[$user_id];
}
}
function ico($sex,$admin){
if($admin == 0) {
if($sex == 'm') $icon = '<img src = "/ico/men.gif">'; else $icon = '<img src = "/ico/woman.gif">';
}
if($admin == 1) {
if($sex == 'm') $icon = '<img src = "/i/admin.gif">'; else $icon = '<img src = "/ico/creator_woman.png">';
}
if($admin == 2) {
if($sex == 'm') $icon = '<img src = "/ico/admin_men.gif">'; else $icon = '<img src = "/ico/admin_woman.gif">';
}
if($admin == 3) {
if($sex == 'm') $icon = '<img src = "/ico/moder_men.gif">'; else $icon = '<img src = "/ico/moder_woman.gif">';
}
if($admin == 4) {
if($sex == 'm') $icon = '<img src = "/ico/moder_men.gif">'; else $icon = '<img src = "/ico/moder_woman.gif">';
}
if($admin == 5) {
if($sex == 'm') $icon = '<img src = "/ico/moder_men.gif">'; else $icon = '<img src = "/ico/moder_woman.gif">';
}
return $icon;
}
function navigation($page, $total, $link) {
if ($page != 1) $pervpage = ' ← <a href= "'.$link.'page='. ($page - 1) .'"><u>Предыдущая</u></a> ';
if ($page != $total) $nextpage = ' <a href= "'.$link.'page='. ($page + 1) .'"><u>Следующая</u></a> →';
if($page - 2 > 0) $page3left = ' <a href= "'.$link.'page='. ($page - 2) .'" class="next">'. ($page - 2) .'</a> ';
if($page - 1 > 0) $page2left = ' <a href= "'.$link.'page='. ($page - 1) .'" class="next">'. ($page - 1) .'</a> ';
if($page - 1 > 0) $page1left = '</a> ';
if($page + 2 <= $total) $page3right = ' <a href= "'.$link.'page='. ($page + 2) .'" class="next">'. ($page + 2) .'</a>';
if($page + 1 <= $total) $page2right = ' <a href= "'.$link.'page='. ($page + 1) .'" class="next">'. ($page + 1) .'</a>';
if($page + 1 <= $total) $page1right = '</a>';
if ($page != $total || $page - 1 > 0) {
echo '<div class="navig">';
}
if ($page != $total || $page - 1 > 0) {
echo $pervpage.''.$nextpage;
echo '</br></br>';
echo $page3left.$page2left.'<l>'.$page.'</l>'.$page2right.$page3right;
}
echo '</div>';
echo '</div>';
}
function login($id){
$id = abs(intval($id));
$login = mysql_result(mysql_query("SELECT `login` FROM `users` WHERE `id` = '$id'"), 0);
return $login;
}
//if(isset($u['id']) && $u['id']==1){
//error_reporting(E_ALL); // включаем показ ошибок
//ini_set('display_errors',true); // включаем показ ошибок
//error_reporting(-1);
//}
// вывод времени
function vremya_ban($time=NULL)
{
global $u;
if ($time==NULL)$time=time();
if (isset($u))$time=$time+$u['set_timesdvig']*60*60;
$timep="".date("j M в H:i", $time)."";
$time_p[0]=date("j n", $time);
$time_p[1]=date("H:i", $time);
if ($time_p[0]==date("j n"))$timep=date("H:i", $time);
if (isset($u)){
if ($time_p[0]==date("j n", time()+$u['set_timesdvig']*60*60))$timep=date("H:i", $time);
if ($time_p[0]==date("j n", time()-60*60*(24-$u['set_timesdvig'])))$timep="Вчера в $time_p[1]";
}else{
if ($time_p[0]==date("j n"))$timep=date("H:i", $time);
if ($time_p[0]==date("j n", time()-60*60*24))$timep="Вчера в $time_p[1]";
}
$timep=str_replace("Jan","Янв",$timep);
$timep=str_replace("Feb","Фев",$timep);
$timep=str_replace("Mar","Марта",$timep);
$timep=str_replace("May","Мая",$timep);
$timep=str_replace("Apr","Апр",$timep);
$timep=str_replace("Jun","Июня",$timep);
$timep=str_replace("Jul","Июля",$timep);
$timep=str_replace("Aug","Авг",$timep);
$timep=str_replace("Sep","Сент",$timep);
$timep=str_replace("Oct","Окт",$timep);
$timep=str_replace("Nov","Ноября",$timep);
$timep=str_replace("Dec","Дек",$timep);
return $timep;
}
function vremja($time=NULL)
{
global $u;
if ($time==NULL)$time=time();
if (isset($u))$time=$time+$u['set_timesdvig']*60*60;
$timep="".date("j M в H:i", $time)."";
$time_p[0]=date("j n", $time);
$time_p[1]=date("H:i", $time);
if ($time_p[0]==date("j n"))$timep=date("H:i", $time);
if (isset($u)){
if ($time_p[0]==date("j n", time()+$u['set_timesdvig']*60*60))$timep=date("H:i", $time);
if ($time_p[0]==date("j n", time()-60*60*(24-$u['set_timesdvig'])))$timep="Вчера в $time_p[1]";
}else{
if ($time_p[0]==date("j n"))$timep=date("H:i", $time);
if ($time_p[0]==date("j n", time()-60*60*24))$timep="Вчера в $time_p[1]";
}
$timep=str_replace("Jan","Янв",$timep);
$timep=str_replace("Feb","Фев",$timep);
$timep=str_replace("Mar","Марта",$timep);
$timep=str_replace("May","Мая",$timep);
$timep=str_replace("Apr","Апр",$timep);
$timep=str_replace("Jun","Июня",$timep);
$timep=str_replace("Jul","Июля",$timep);
$timep=str_replace("Aug","Авг",$timep);
$timep=str_replace("Sep","Сент",$timep);
$timep=str_replace("Oct","Окт",$timep);
$timep=str_replace("Nov","Ноября",$timep);
$timep=str_replace("Dec","Дек",$timep);
return $timep;
}
function vremya($time=NULL)
{
global $u;
if ($time==NULL)$time=time();
if (isset($u))$time=$time+$u['set_timesdvig']*60*60;
$timep="".date("j M Y в H:i", $time)."";
$time_p[0]=date("j n Y", $time);
$time_p[1]=date("H:i", $time);
if ($time_p[0]==date("j n Y"))$timep=date("H:i:s", $time);
if (isset($u)){
if ($time_p[0]==date("j n Y", time()+$u['set_timesdvig']*60*60))$timep=date("H:i:s", $time);
if ($time_p[0]==date("j n Y", time()-60*60*(24-$u['set_timesdvig'])))$timep="Вчера в $time_p[1]";}
else{
if ($time_p[0]==date("j n Y"))$timep=date("H:i:s", $time);
if ($time_p[0]==date("j n Y", time()-60*60*24))$timep="Вчера в $time_p[1]";}
$timep=str_replace("Jan","Янв",$timep);
$timep=str_replace("Feb","Фев",$timep);
$timep=str_replace("Mar","Марта",$timep);
$timep=str_replace("May","Мая",$timep);
$timep=str_replace("Apr","Апр",$timep);
$timep=str_replace("Jun","Июня",$timep);
$timep=str_replace("Jul","Июля",$timep);
$timep=str_replace("Aug","Авг",$timep);
$timep=str_replace("Sep","Сент",$timep);
$timep=str_replace("Oct","Окт",$timep);
$timep=str_replace("Nov","Ноября",$timep);
$timep=str_replace("Dec","Дек",$timep);
return $timep;
}
function kikt($t)
{
$t2 = $t - time();
if ($t2 > (60 * 60 * 24 * 30)) $t3 = round($t2 / (60 * 60 * 24 * 30)) . ' месяцев';
elseif ($t2 > (60 * 60 * 24)) $t3 = round($t2 / (60 * 60 * 24)) . ' дней';
elseif ($t2 > (60 * 60)) $t3 = round($t2 / (60 * 60)) . ' часов';
elseif ($t2 > 60) $t3 = round($t2 / 60) . ' минут';
else $t3 = $t2 . ' секунд';
return $t3;
}
function num($num){
$num = abs(intval($num));
return $num;
}
function check($str) {
$str = htmlentities(trim($str), ENT_QUOTES, 'UTF-8');
$str = mysql_real_escape_string($str);
return $str;
}
function checkout($str) {
$str = nl2br($str);
$str = str_replace(chr(226) . chr(128) . chr(174), '.', $str);
return $str;
}
function strtolower_utf8($string){
$convert_to = array(
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u",
"v", "w", "x", "y", "z", "à", "á", "â", "ã", "ä", "å", "æ", "ç", "è", "é", "ê", "ë", "ì", "í", "î", "ï",
"ð", "ñ", "ò", "ó", "ô", "õ", "ö", "ø", "ù", "ú", "û", "ü", "ý", "а", "б", "в", "г", "д", "е", "ё", "ж",
"з", "и", "й", "к", "л", "м", "н", "о", "п", "р", "с", "т", "у", "ф", "х", "ц", "ч", "ш", "щ", "ъ", "ы",
"ь", "э", "ю", "я"
);
$convert_from = array(
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U",
"V", "W", "X", "Y", "Z", "À", "Á", "Â", "Ã", "Ä", "Å", "Æ", "Ç", "È", "É", "Ê", "Ë", "Ì", "Í", "Î", "Ï",
"Ð", "Ñ", "Ò", "Ó", "Ô", "Õ", "Ö", "Ø", "Ù", "Ú", "Û", "Ü", "Ý", "А", "Б", "В", "Г", "Д", "Е", "Ё", "Ж",
"З", "И", "Й", "К", "Л", "М", "Н", "О", "П", "Р", "С", "Т", "У", "Ф", "Х", "Ц", "Ч", "Ш", "Щ", "Ъ", "Ъ",
"Ь", "Э", "Ю", "Я"
);
return str_replace($convert_from, $convert_to, $string);
}
if (extension_loaded('zlib') and ini_get('zlib.output_compression') != 1 and ini_get('output_handler') != 'ob_gzhandler')
{
$PREFER_DEFLATE = false;
$FORCE_COMPRESSION = false;
function compress_output_gzip($output)
{
return gzencode($output);
}
function compress_output_deflate($output)
{
return gzdeflate($output, 9);
}
function compress_output_x_gzip($output)
{
return gzcompress($output, 9);
}
if (isset($_SERVER['HTTP_ACCEPT_ENCODING']))
$AE = $_SERVER['HTTP_ACCEPT_ENCODING'];
else
$AE = $_SERVER['HTTP_TE'];
$support_gzip = (strpos($AE, 'gzip') !== FALSE) || $FORCE_COMPRESSION;
$support_deflate = (strpos($AE, 'deflate') !== FALSE) || $FORCE_COMPRESSION;
$support_x_gzip = (strpos($AE, 'x-gzip') !== FALSE) || $FORCE_COMPRESSION;
if ($support_gzip && $support_deflate)
{
$support_deflate = $PREFER_DEFLATE;
}
if ($support_deflate)
{
header("Content-Encoding: deflate");
ob_start("compress_output_deflate");
}
else
{
if ($support_gzip)
{
header("Content-Encoding: gzip");
ob_start("compress_output_gzip");
}
else
{
if ($support_x_gzip)
{
header("Content-Encoding: x_gzip");
ob_start("compress_output_x_gzip");
}
else
{
ob_start();
$config_gzip = 0;
}
}
}
}
else
{
$config_gzip = 0;
}
?>