File size: 9.9Kb
<?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);
if(isset($_POST['action']))
{
$ttl="Результаты поиска";
}
else
{
$ttl= "Найти пользователя";
}
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";
echo "<br/>$wmlfoot";
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
$error="";
$error1="";
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=\"$ttl\"><p align=\"left\">\n";
if(!empty($_POST[nickname]) && strlen($_POST[nickname]) < 3)
{
$error .= "Неправильный ник. Длина ника от 3-х до 15-и сиволов. Допустимые символы: русские ИЛИ английские буквы, цифры, пробел и знаки _@=![]()~*.~-. Недопустимо одновременное использование русских и английских букв.<br/>";
echo $error;
}
echo "<input name=\"nickname$ref\" maxlength=\"20\" title=\"nickname\"/><br/>\n";
echo "<anchor>Найти<go href=\"search.php?ref=$ref&ver=wml&".SID."\" method=\"post\">\n";
echo "<postfield name=\"nickname\" value=\"$(nickname$ref)\"/>\n";
echo "<postfield name=\"action\" value=\"search\"/>\n";
echo "</go></anchor><br/>\n";
echo'Введите весь ник или его часть (не менее 3-х символов).<br/>';
$_POST[nickname]=htmlspecialchars($_POST[nickname]);
if(empty($_POST[nickname]) and empty($error))
{
$error1 .= "Пользователи не найдены.<br/>";
echo $error1;
}
if(isset($_POST['action']) and !empty($_POST[nickname]) and empty($error))
{
$q=mysql_query('SELECT * FROM `chat_users` WHERE `nickname` LIKE "%'.$_POST[nickname].'%" LIMIT 10;');
}
if(mysql_num_rows($q) == 0 and empty($error))
{
$error1 .= "Пользователи не найдены.<br/>";
echo $error1;
}
else
{
while($poisk = mysql_fetch_array($q))
{
$uid = $poisk['id'];
$pass = $poisk['password'];
$ip = $poisk['ip'];
$ua = $poisk['ua'];
$kick = $poisk['kick'];
$moder = $poisk['moder'];
$reason = $poisk['reason'];
$name = $poisk['name'];
$site = $poisk['site'];
$sex = $poisk['sex'];
$city = $poisk['city'];
$mobile = $poisk['mobile'];
$email = $poisk['email'];
$birthday = $poisk['birthday'];
$about = $poisk['about'];
$posts = $poisk['posts'];
$lev = $poisk['level'];
$answers = $poisk['answers'];
$gbalans = $poisk['gbalans'];
$status = $poisk['status'];
$regdate = $poisk['regdate'];
$place = $poisk['place'];
$time = $poisk['time'];
//
//
$ltime = time() - ($time - 60);
if($ltime < 60 && $ltime >= 0)
{
$var = "Секунд";
}
elseif($ltime < 3600 && $ltime > 60)
{
$new = $ltime;
$ltime = $new/60;
$var = "Минут";
}
elseif($ltime < 86400 && $ltime > 3600)
{
$new = $ltime;
$ltime = $new/3600;
$var = "Часов";
}
elseif($ltime > 86400)
{
$new = $ltime;
$ltime = $new/86400;
$var = "Дней";
}
$ltime = round($ltime, 2);
////////////////////////////////////////////////////////
//
$qq = mysql_query("SELECT `id` FROM `chat_users` WHERE `nickname` = '".$poisk[nickname]."';");
$usid = mysql_fetch_array($qq);
//
$qwho = mysql_query("SELECT `name`, `id` FROM `chat_rooms` WHERE `id` = '".$place."';");
$whoroom = mysql_fetch_array($qwho);
$who = "$whoroom[name]";
//
if(empty($whode))
{
$whode="<a href=\"menu.php?".SID."&ver=wml\">Прихожая</a><br/>";
}
else
{
$whode="<a href=\"room.php?".SID."&rid=".$whoroom[id]."&ver=wml\">$who</a><br/>";
}
echo"• <a href=\"info.php?".SID."&uid=".$usid[id]."&ver=wml\">$poisk[nickname]</a> ";
if($ltime > 0)
{
echo "Последний визит: $ltime $var назад<br/>\n";
}
else
{
echo "Сейчас в: $whode \n";
}
}
}
echo "<br/>• <a href=\"menu.php?".SID."&ver=wml\">В прихожую</a><br/>\n";
echo "<br/>$wmlfoot";
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 "$css";
echo'<title>'.$ttl.'</title>';
echo'<div class="d3">Ошибка</div>';
echo "<div class=\"d5\">Ошибка авторизации!</div>\n";
echo'<div class="d3">';
echo"$sitefoot";
echo'</div>';
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
echo "$css";
echo'<title>'.$ttl.'</title>';
echo'<div class="d3">'.$ttl.'</div>';
$error="";
$error1="";
if(!empty($_POST[nickname]) && strlen($_POST[nickname]) < 3)
{
$error .= "<div class=\"d5\">Неправильный ник. Длина ника от 3-х до 15-и сиволов. Допустимые символы: русские ИЛИ английские буквы, цифры, пробел и знаки _@=![]()~*.~-. Недопустимо одновременное использование русских и английских букв.</div>";
echo $error;
}
echo'<div class="d1">';
echo "<form method=\"post\" action=\"search.php?".SID."&ref=$ref&ver=html\">\n";
echo "<input name=\"nickname\" maxlength=\"20\"/>";
echo "<input type=\"hidden\" name=\"action\" value=\"search\"/>";
echo "<input type=\"submit\" value=\"Найти\"/></form>\n";
echo'Введите весь ник или его часть (не менее 3-х символов).</div>';
$_POST[nickname]=htmlspecialchars($_POST[nickname]);
if(empty($_POST[nickname]) and empty($error))
{
$error1 .= "Пользователи не найдены.";
echo $error1;
}
if(isset($_POST['action']) and !empty($_POST[nickname]) and empty($error))
{
$q=mysql_query('SELECT * FROM `chat_users` WHERE `nickname` LIKE "%'.$_POST[nickname].'%" LIMIT 10;');
}
if(mysql_num_rows($q) == 0 and empty($error))
{
$error1 .= "Пользователи не найдены.";
echo $error1;
}
else
{
while($poisk = mysql_fetch_array($q))
{
$uid = $poisk['id'];
$pass = $poisk['password'];
$ip = $poisk['ip'];
$ua = $poisk['ua'];
$kick = $poisk['kick'];
$moder = $poisk['moder'];
$reason = $poisk['reason'];
$name = $poisk['name'];
$site = $poisk['site'];
$sex = $poisk['sex'];
$city = $poisk['city'];
$mobile = $poisk['mobile'];
$email = $poisk['email'];
$birthday = $poisk['birthday'];
$about = $poisk['about'];
$posts = $poisk['posts'];
$lev = $poisk['level'];
$answers = $poisk['answers'];
$gbalans = $poisk['gbalans'];
$status = $poisk['status'];
$regdate = $poisk['regdate'];
$place = $poisk['place'];
$time = $poisk['time'];
//
//
$ltime = time() - ($time - 60);
if($ltime < 60 && $ltime >= 0)
{
$var = "Секунд";
}
elseif($ltime < 3600 && $ltime > 60)
{
$new = $ltime;
$ltime = $new/60;
$var = "Минут";
}
elseif($ltime < 86400 && $ltime > 3600)
{
$new = $ltime;
$ltime = $new/3600;
$var = "Часов";
}
elseif($ltime > 86400)
{
$new = $ltime;
$ltime = $new/86400;
$var = "Дней";
}
$ltime = round($ltime, 2);
////////////////////////////////////////////////////////
//
$qq = mysql_query("SELECT `id` FROM `chat_users` WHERE `nickname` = '".$poisk[nickname]."';");
$usid = mysql_fetch_array($qq);
//
$qwho = mysql_query("SELECT `name`, `id` FROM `chat_rooms` WHERE `id` = '".$place."';");
$whoroom = mysql_fetch_array($qwho);
$who = "$whoroom[name]";
//
if(empty($whode))
{
$whode="<a href=\"menu.php?".SID."&ver=html\">Прихожая</a><br/>";
}
else
{
$whode="<a href=\"room.php?".SID."&rid=".$whoroom[id]."&ver=html\">$who</a><br/>";
}
echo"• <a href=\"info.php?".SID."&uid=".$usid[id]."&ver=html\">$poisk[nickname]</a> ";
if($ltime > 0)
{
echo "Последний визит: $ltime $var назад<br/>\n";
}
else
{
echo "Сейчас в: $whode \n";
}
}
}
echo "<div class=\"d1\">• <a href=\"menu.php?".SID."&ver=html\">В прихожую</a></div>\n";
echo'<div class="d3">';
echo"$sitefoot";
echo'</div>';
echo "</body></html>";
break;
}
?>