Просмотр файла ilichat3.9/ilichat/search.php

Размер файла: 13.17Kb
<?php
error_reporting(0);
include('start.php');
include("config.php");
include("./includes/".$ver."/banned");

list($msec, $sec) = explode(chr(32), microtime()); 
$headtime = $sec + $msec;

$ref = rand(1000, 9999);

switch($ver)
{
////////////////////////////////////////////////////////
//WML VERSION
////////////////////////////////////////////////////////
case 'wml':
header ("Content-type:text/vnd.wap.wml; charset=utf-8");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-relative");

//AUTH
$id = intval($_SESSION['id']);
$password = mysql_escape_string($_SESSION['password']);
$q = mysql_query("SELECT `level` FROM `chat_users` WHERE `id` = '".$id."' AND `password` = '".md5($password)."';");

if(mysql_num_rows($q) == 0)
{
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.3//EN\" \"http://www.wapforum.org/DTD/wml13.dtd\"><wml>\n";
echo "<card title=\"ERROR\" ontimer=\"index.php?ver=wml\"><timer value=\"15\"/><p align=\"left\">\n";
echo "<small>Ошибка авторизации!<br/>\n";
list($msec, $sec) = explode(chr(32), microtime());
echo "<br/>[".round(($sec+$msec)-$headtime,5)."] sec<br/>\n";
echo "</small></p></card></wml>";
exit();
}
//END AUTH

$level = mysql_result($q, 0);

//ONLINE
$online = time() + 60;
$update = mysql_query("UPDATE `chat_users` SET `time` = '".$online."', `place` = 0, `ip` = '".getenv('REMOTE_ADDR')."', `ua` = '".htmlspecialchars(getenv('HTTP_USER_AGENT'))."' WHERE `id` = '".$id."';");
//END ONLINE

if(!isset($_POST['action']))
{
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.3//EN\" \"http://www.wapforum.org/DTD/wml13.dtd\"><wml>\n";
echo "<card title=\"Поиск\"><p align=\"left\">\n";
echo "Никнейм:<br/>\n";
echo "<input name=\"nickname$ref\" maxlength=\"20\" title=\"nickname\"/><br/>\n";
echo "<anchor>[Искать]<go href=\"search.php?ref=$ref&amp;ver=wml&amp;".SID."\" method=\"post\">\n";
echo "<postfield name=\"nickname\" value=\"$(nickname$ref)\"/>\n";
echo "<postfield name=\"action\" value=\"search\"/>\n";
echo "</go></anchor><br/>\n";
}
else
{
$q = mysql_query("SELECT * FROM `chat_users` WHERE `nickname` = '".mysql_escape_string($_POST['nickname'])."';");

if(mysql_num_rows($q) == 0)
{
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.3//EN\" \"http://www.wapforum.org/DTD/wml13.dtd\"><wml>\n";
echo "<card title=\"Поиск\"><p align=\"left\">\n";
echo "Пользователь не найден в базе данных.<br/>\n";
echo "<a href=\"search.php?".SID."&amp;ver=wml\">Поиск</a><br/>\n";
}
else
{
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.3//EN\" \"http://www.wapforum.org/DTD/wml13.dtd\"><wml>\n";
echo "<card title=\"".$_POST['nickname']."\"><p align=\"left\">\n";

$user = mysql_fetch_array($q);
$uid = $user['id'];
$pass = $user['password'];
$ip = $user['ip'];
$ua = $user['ua'];
$kick = $user['kick'];
$moder = $user['moder'];
$reason = $user['reason'];
$name = $user['name'];
$site = $user['site'];
$sex = $user['sex'];
$city = $user['city'];
$mobile = $user['mobile'];
$email = $user['email'];
$birthday = $user['birthday'];
$about = $user['about'];
$posts = $user['posts'];
$lev = $user['level'];
$answers = $user['answers'];
$gbalans = $user['gbalans'];
$status = $user['status'];
$regdate = $user['regdate'];
$place = $user['place'];
$time = $user['time'];

echo "Ник: ".$_POST['nickname']."<br/>\n";
if($level == 4 && $uid != 1) echo "[Пароль]: ".$pass."<br/>\n";
	if($level > 2 && ($lev <= $level))
	{
	echo "[IP]: ".$ip."<br/>\n";
	echo "[UserAgent]: ".$ua."<br/>\n";
	echo "[ID]: ".$uid."<br/>\n";
	}
	if($level == 4)
	{
		if(time() < $kick)
		{
		$tkick = $kick - time();
		if($tkick < 60 && $tkick > 0)
		{
		$var = "sec.";
		}
		elseif($tkick < 3600 && $tkick > 60)
		{
		$new = $tkick;
		$tkick = $new/60;
		$var = "min.";
		}
		elseif($tkick < 86400 && $tkick > 3600)
		{
		$new = $tkick;
		$tkick = $new/3600;
		$var = "hours";
		}
		elseif($tkick > 86400)
		{
		$new = $tkick;
		$tkick = $new/86400;
		$var = "days";
		}
		$tkick = round($tkick, 2);
		echo "Выпнут модератором <u>".$moder."</u>.<br/>\n";
		echo "Разбан через <u>".$tkick." $var</u><br/>\n";
		echo "Причина: <u>".$reason."</u><br/>\n";
		}
	}
echo "Имя: $name<br/>\n";
if($sex == 0)
{
echo "Пол: мужской<br/>\n";
}
else
{
echo "Пол: женский<br/>\n";
}
echo "Дата рождения: $birthday<br/>\n";
echo "Статус: $status<br/>\n";
echo "Количество постов: $posts<br/>\n";
echo "Ответов в викторине: $answers<br/>\n";
echo "Игровой баланс: $gbalans<br/>\n";
echo "Город: $city<br/>\n";
echo "Модель мобильного телефона: $mobile<br/>\n";
echo "Сайт: <a href=\"http://$site\">$site</a><br/>\n";
echo "Email: $email<br/>\n";
echo "О себе: $about<br/>\n";
echo "Дата регистрации: $regdate<br/>\n";

$ltime = time() - ($time - 60);

	if($ltime < 60 && $ltime >= 0)
	{
	$var = "sec.";
	}
	elseif($ltime < 3600 && $ltime > 60)
	{
	$new = $ltime;
	$ltime = $new/60;
	$var = "min.";
	}
	elseif($ltime < 86400 && $ltime > 3600)
	{
	$new = $ltime;
	$ltime = $new/3600;
	$var = "hours";
	}
	elseif($ltime > 86400)
	{
	$new = $ltime;
	$ltime = $new/86400;
	$var = "days";
	}

$ltime = round($ltime, 2);

	if($ltime > 0)
	{
	echo "Время с последнего захода в чат: $ltime $var<br/>\n";
	}
	else
	{
	echo "Онлайн.<br/>\n";
	}
echo "<a href=\"search.php?".SID."&amp;ver=wml\">Поиск</a><br/>\n";
}
}

echo "<br/><a href=\"menu.php?".SID."&amp;ver=wml\">Меню чата</a><br/>\n";
list($msec, $sec) = explode(chr(32), microtime());
echo "<br/><small>[".round(($sec+$msec)-$headtime,5)."] sec</small><br/>\n";
echo "</p></card></wml>";
break;

////////////////////////////////////////////////////////
//HTML VERSION
////////////////////////////////////////////////////////
case 'html':
header ("Content-type: text/html; charset=utf-8");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-cache, must-relative");

//AUTH
$id = intval($_SESSION['id']);
$password = mysql_escape_string($_SESSION['password']);
$q = mysql_query("SELECT `level` FROM `chat_users` WHERE `id` = '".$id."' AND `password` = '".md5($password)."';");

if(mysql_num_rows($q) == 0)
{
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10-flat.dtd\">\n";
echo "<html><head>\n";
echo "<link rel=\"shortcut icon\" href=\"$icon\" /><title>".$title."</title>\n";
echo "<style type=\"text/css\">";
echo "body { font-weight: normal; font-size: normal; font-family: ".$font."; color: ".$color."; background-color: ".$background." }";
echo "a:link,a:active,a:visited { text-decoration: underline; color : ".$links." }";
echo "</style></head><body>";
echo "Ошибка авторизации!<br/>\n";
list($msec, $sec) = explode(chr(32), microtime());
echo "<br/>[".round(($sec+$msec)-$headtime,5)."] sec<br/>\n";
echo "</body></html>";
exit();
}
//END AUTH

$level = mysql_result($q, 0);

//ONLINE
$online = time() + 60;
$update = mysql_query("UPDATE `chat_users` SET `time` = '".$online."', `place` = 0, `ip` = '".getenv('REMOTE_ADDR')."', `ua` = '".htmlspecialchars(getenv('HTTP_USER_AGENT'))."' WHERE `id` = '".$id."';");
//END ONLINE

if(!isset($_POST['action']))
{
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
echo "<html><head>\n";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n";
echo "<link rel=\"shortcut icon\" href=\"$icon\" /><title>Поиск</title>\n";
echo "<style type=\"text/css\">
body { font-weight: normal; font-size: normal; font-family: ".$font."; color: ".$color."; background-color: ".$background." }
a:link,a:active,a:visited { text-decoration: underline; color : ".$links." }
div { margin: 1px 0px 1px 0px; padding: 4px 4px 4px 4px }
div.form { background-color: ".$form_color."; text-align: left }
</style></head><body>";
echo "<div class=\"form\">\n";
echo "<form method=\"post\" action=\"search.php?".SID."&amp;ref=$ref&amp;ver=html\">\n";
echo "Никнейм:<br/>\n";
echo "<input name=\"nickname\" maxlength=\"20\"/><br/>\n";
echo "<input type=\"hidden\" name=\"action\" value=\"search\"/>";
echo "<input type=\"submit\" value=\"Искать\"/></form></div><br/>\n";
}
else
{
$q = mysql_query("SELECT * FROM `chat_users` WHERE `nickname` = '".mysql_escape_string($_POST['nickname'])."';");

if(mysql_num_rows($q) == 0)
{
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
echo "<html><head>\n";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n";
echo "<link rel=\"shortcut icon\" href=\"$icon\" /><title>Поиск</title>\n";
echo "<style type=\"text/css\">
body { font-weight: normal; font-size: normal; font-family: ".$font."; color: ".$color."; background-color: ".$background." }
a:link,a:active,a:visited { text-decoration: underline; color : ".$links." }
</style></head><body>";
echo "Пользователь не найден в базе данных.<br/>\n";
echo "<a href=\"search.php?".SID."&amp;ver=html\">Поиск</a><br/>\n";
}
else
{
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
echo "<html><head>\n";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n";
echo "<link rel=\"shortcut icon\" href=\"$icon\" /><title>".$_POST['nickname']."</title>\n";
echo "<style type=\"text/css\">
body { font-weight: normal; font-size: normal; font-family: ".$font."; color: ".$color."; background-color: ".$background." }
a:link,a:active,a:visited { text-decoration: underline; color : ".$links." }
div.form { background-color: ".$form_color."; text-align: left }
</style></head><body>";

$user = mysql_fetch_array($q);
$uid = $user['id'];
$pass = $user['password'];
$ip = $user['ip'];
$ua = $user['ua'];
$kick = $user['kick'];
$moder = $user['moder'];
$reason = $user['reason'];
$name = $user['name'];
$site = $user['site'];
$sex = $user['sex'];
$city = $user['city'];
$mobile = $user['mobile'];
$email = $user['email'];
$birthday = $user['birthday'];
$about = $user['about'];
$posts = $user['posts'];
$lev = $user['level'];
$answers = $user['answers'];
$gbalans = $user['gbalans'];
$status = $user['status'];
$regdate = $user['regdate'];
$place = $user['place'];
$time = $user['time'];

echo "Ник: ".$_POST['nickname']."<br/>\n";
if($level == 4 && $uid != 1) echo "[Пароль]: ".$pass."<br/>\n";
	if($level > 2 && ($lev <= $level))
	{
	echo "[IP]: ".$ip."<br/>\n";
	echo "[UserAgent]: ".$ua."<br/>\n";
	echo "[ID]: ".$uid."<br/>\n";
	}
	if($level == 4)
	{
		if(time() < $kick)
		{
		$tkick = $kick - time();
		if($tkick < 60 && $tkick > 0)
		{
		$var = "sec.";
		}
		elseif($tkick < 3600 && $tkick > 60)
		{
		$new = $tkick;
		$tkick = $new/60;
		$var = "min.";
		}
		elseif($tkick < 86400 && $tkick > 3600)
		{
		$new = $tkick;
		$tkick = $new/3600;
		$var = "hours";
		}
		elseif($tkick > 86400)
		{
		$new = $tkick;
		$tkick = $new/86400;
		$var = "days";
		}
		$tkick = round($tkick, 2);
		echo "Выпнут модератором <u>".$moder."</u>.<br/>\n";
		echo "Разбан через <u>".$tkick." $var</u><br/>\n";
		echo "Причина: <u>".$reason."</u><br/>\n";
		}
	}
echo "Имя: $name<br/>\n";
if($sex == 0)
{
echo "Пол: мужской<br/>\n";
}
else
{
echo "Пол: женский<br/>\n";
}
echo "Дата рождения: $birthday<br/>\n";
echo "Статус: $status<br/>\n";
echo "Количество постов: $posts<br/>\n";
echo "Ответов в викторине: $answers<br/>\n";
echo "Игровой баланс: $gbalans<br/>\n";
echo "Город: $city<br/>\n";
echo "Модель мобильного телефона: $mobile<br/>\n";
echo "Сайт: <a href=\"http://$site\">$site</a><br/>\n";
echo "Email: $email<br/>\n";
echo "О себе: $about<br/>\n";
echo "Дата регистрации: $regdate<br/>\n";
$ltime = time() - ($time - 60);
if($ltime < 60 && $ltime >= 0)
{
$var = "sec.";
}
elseif($ltime < 3600 && $ltime > 60)
{
$new = $ltime;
$ltime = $new/60;
$var = "min.";
}
elseif($ltime < 86400 && $ltime > 3600)
{
$new = $ltime;
$ltime = $new/3600;
$var = "hours";
}
elseif($ltime > 86400)
{
$new = $ltime;
$ltime = $new/86400;
$var = "days";
}
$ltime = round($ltime, 2);
if($ltime > 0)
{
echo "Время с последнего захода в чат: $ltime $var<br/>\n";
}
else
{
echo "Онлайн.<br/>\n";
}
echo "<a href=\"search.php?".SID."&amp;ver=html\">Поиск</a><br/>\n";
}
}

echo "<br/><a href=\"menu.php?".SID."&amp;ver=html\">Меню чата</a><br/>\n";
list($msec, $sec) = explode(chr(32), microtime());
echo "<br/><span style=\"font-size: small\">[".round(($sec+$msec)-$headtime,5)."] sec</span><br/>\n";
echo "</body></html>";
break;
}
?>