Файл: search/index.php
Строк: 86
<?php
require_once '../incfiles/core.php';
require_once '../incfiles/func.php';
require_once '../incfiles/auth.php';
require_once '../incfiles/user.php';
$search = check($_POST['search']);
if($_GET['search'])$search = check($_GET['search']);
$title = $search;
echo '<div class="title"><span style="border-radius:6px; background:#45c3d3; padding:5px; color:#f2f4f5;">'.lang('Люди','Люди').'</span>
</div>';
$act = htmlentities(trim($_GET['act']));
switch($act)
{
default:
$string_array = explode(" ", $search);
$name = $string_array[1]; //
$surname = current(explode(' ',$search));
$all = mysql_query("SELECT * FROM `users` WHERE name LIKE '$name' and surname LIKE '$surname'");
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `name` LIKE '%$name%' and `surname` LIKE '%$surname%'"),0)==0)
{
$newname = $surname;
$surname = $name;
$name = $newname;
$all = mysql_query("SELECT * FROM `users` WHERE name LIKE '$name' and surname LIKE '$surname'");
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE `name` LIKE '%$name%' and `surname` LIKE '%$surname%'"),0)!=0)
{
$cp = ceil($all/30);
$p = (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p']>1 and $_GET['p']<=$cp) ? $_GET['p'] : 1;
$start = $p*10-10;
$arr_comm = mysql_query("SELECT * FROM `users` WHERE name LIKE '%$name%' and surname LIKE '%$surname%' or surname LIKE '%$search%' or name LIKE '%$search%' ORDER BY `visit` DESC LIMIT $start,10");
require_once '../incfiles/head.php';
while ($arr = mysql_fetch_array($arr_comm))
{
echo '<div class="block">';
echo user_name($arr['id']).'<br/><div class="clear"></div>';
//echo '<p>'.text_view(convert_clickable_links($arr['text'])).'</p>';
echo '</div>';
}
navi($p,$cp,''.URL.'/search/?search='.$search.'&');
}else{
echo '<div class="block">'.lang('Поиск не дал результатов','Нічого не знайдено').'';
}
break;
case 'wall':
$all = mysql_query("SELECT * FROM `wall` WHERE text LIKE '$search'");
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `wall` WHERE `text` LIKE '%$search%'"),0)!=0)
{
$cp = ceil($all/30);
$p = (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p']>1 and $_GET['p']<=$cp) ? $_GET['p'] : 1;
$start = $p*10-10;
$arr_comm = mysql_query("SELECT * FROM `wall` WHERE text LIKE '%$search%' ORDER BY `id` DESC LIMIT $start,10");
require_once '../incfiles/head.php';
while ($arr = mysql_fetch_array($arr_comm))
{
echo '<div class="block">';
if (!empty($user_id)) if ($user_id == $arr_post['wall_id'] || $user_id == $arr_post['user_id'] || $user_id == $arr['user_id']) echo '<div class="right"><a href="'.URL.'/wall/post.php?id='.$id.'&p='.$p.'&del_comm='.$arr['id'].'" onclick="Form.delPost(this.href); return false"><img src="'.URL.'/design/img/closed.png"/></a></div>';
echo user_name($arr['user_id']).'<br/>'.vtime($arr['time']).'<div class="clear"></div>';
echo '<p>'.text_view(convert_clickable_links($arr['text'])).'</p>';
if ($window == false)
{
echo '<div class="post_panel">';
echo repost('wall',$arr['id'],$arr['urepost'],$arr['crepost'],$arr['user_id']);
echo like('wall',$arr['id'],$arr['ulike'],$arr['clike'],$arr['user_id']);
echo '</div>';
}
echo '</div>';
}
navi($p,$cp,''.URL.'/search/?search='.$search.'&');
}else{
echo '<div class="block">'.lang('Поиск не дал результатов','Нічого не знайдено').'';
}
break;
}
require_once '../incfiles/foot.php';
?>