View file znaki_LIM/znaki_LIM/ini.php

File size: 5.13Kb
<?php


$parse_url=parse_url($REQUEST_URI);
$row = explode("/",$parse_url["path"]);
$patch_for_lang=$row[count($row)-2];

///////////////////////////////////////////////////////////
$DB_HOST = "localhost";//хост бд
$DB_USER = "waplimn_chat";	//имя пользоватебя бд
$DB_PASS = "lysyj";	//пароль пользователя бд
$DB_NAME = "waplimn_znak";	//название бд
///////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
$offline = 300;			//Время, через которое пользователь считается оффлайн
$px = "chat_";			//префикс названия таблицы
$utable = "users";		//имя таблицы пользователей
$stable = "settings";		//имя таблицы настроек
$meettable = "meets";		//имя таблицы встреч
////////////////////////////////////////////////////////////
function gettime()
{
	$part_time = explode(' ', microtime());
	$real_time = $part_time[1].substr($part_time[0], 1);
	return $real_time;
}
////////////////////////////////////////////////////////////
//функция для авторизации пользователя
function autorize() {
	global $px, $utable, $login, $id, $pass;
	//кодируем пароль
	//$сpass = crypt($pass, $crypt);
	//запрос на выбор пользователя из бд
	$q = @mysql_query("select * from `".$px.$utable."` where id='$id' and pass='$pass' limit 1;");
	//пихаем данные из запроса в массив
	$duser = @mysql_fetch_array($q);
	//возвращаем логин пользователя
	return $duser;
}

////////////////////////////////////////////////////////////
//массив для транслитерации букв
$tran = array(
"A"=>"А","a"=>"а","B"=>"Б","b"=>"б","V"=>"В",
"v"=>"в","G"=>"Г","g"=>"г","D"=>"Д","d"=>"д",
"E"=>"Е","e"=>"е","yo"=>"Ё","Zh"=>"Ж","ZH"=>"Ж","zh"=>"ж",
"Z"=>"З","z"=>"з","I"=>"И","i"=>"и","J"=>"Й",
"j"=>"й","K"=>"К","k"=>"к","L"=>"Л","l"=>"л",
"M"=>"М","m"=>"м","N"=>"Н","n"=>"н","O"=>"О",
"o"=>"о","P"=>"П","p"=>"п","R"=>"Р","r"=>"р",
"S"=>"С","s"=>"с","T"=>"Т","t"=>"т","U"=>"У",
"u"=>"у","F"=>"Ф","f"=>"ф","H"=>"Х","h"=>"х",
"C"=>"Ц","c"=>"ц","Ch"=>"Ч","ch"=>"ч","CH"=>"Ч","W"=>"Ш",
"w"=>"ш","Sch"=>"Щ","sch"=>"щ","''"=>"ъ",
"Y"=>"Ы","y"=>"ы","'"=>"ь","Ye"=>"Э","YE"=>"Э",
"ye"=>"э","Ju"=>"Ю","ju"=>"ю","Ja"=>"Я","ja"=>"я",
"Yo"=>"ё","s.ch"=>"сч","S.ch"=>"Сч","S.CH"=>"СЧ","SH"=>"СХ","JA"=>"Я","JU"=>"Ю","Y.E"=>"ЫЕ","z.h"=>"зх","Z.h"=>"Зх","Z.H"=>"ЗХ","y.e"=>"ые"
);
//функция конвертации транслита в юникод
function latrus($str) {
	global $tran;
	return strtr($str,$tran);
}
////////////////////////////////////////////////////////////
//выполняем соединение
mysql_connect($DB_HOST,$DB_USER,$DB_PASS) or die ('<card id="error" title="?">'.
	'<p>'.$lang['error_connect'].'<br/>'.
	'<anchor>$lang[back]<prev/></anchor><br/>'.
	'</p>'.
	'</card>'.
	'</wml>');
//выбираем базу для работы
mysql_select_db($DB_NAME);
///////////////////////////////////////////////////////////
//функция обновления статуса
function ustatus() {
global $login, $px, $utable;
$status = $login['status'];
$posts = $login['posts'];
//выбираем статус
if(empty($status))
@mysql_query("update `".$px.$utable."` set status='$lang[status_proch]' where id='".$login['id']."';");
if($posts>=100 && $posts<500 && $status=="$lang[status_proch]")
@mysql_query("update `".$px.$utable."` set status='$lang[status_new]' where id='".$login['id']."';");
if($posts>=500 && $posts<1000 && $status=="$lang[status_new]")
@mysql_query("update `".$px.$utable."` set status='$lang[status_user]' where id='".$login['id']."';");
if($posts>=1000 && $posts<3000 && $status=="$lang[status_user]")
@mysql_query("update `".$px.$utable."` set status='$lang[status_prodv]' where id='".$login['id']."';");
if($posts>=3000 && $posts<5000 && $status=="$lang[status_prodv]")
@mysql_query("update `".$px.$utable."` set status='$lang[status_chatter]' where id='".$login['id']."';");
if($posts>=5000 && $posts<7000 && $status=="$lang[status_chatter]")
@mysql_query("update `".$px.$utable."` set status='$lang[status_tus]' where id='".$login['id']."';");
if($posts>=7000 && $status=="$lang[status_tus]")
@mysql_query("update `".$px.$utable."` set status='$lang[status_poch]' where id='".$login['id']."';");
}

if (!@$lng){
$login_lng = autorize();
$lng=$login_lng['lng'];}

if ($lng!="ua" && $lng!="ru" && $lng!="tr" && $lng!="it")$lng="ru";
if ($patch_for_lang=="enter.php")
include("../lang.$lng.inc.php");
else
include("lang.$lng.inc.php");

$q = @mysql_query("select * from `$px$itable` where `loginid`='999999999' and `user`='".getenv(HTTP_USER_AGENT)." ".getenv(REMOTE_ADDR)."';");
if (@mysql_num_rows($q))
{
print<<<EOD
<card id="error" title="!!!"><p>$lang[access_denied]<br/>
<anchor>$lang[back]<prev/></anchor>
</p></card></wml>
EOD;
exit;
}
?>