Вход Регистрация
Файл: friends/poshuk.php
Строк: 81
<?php

require_once '../incfiles/core.php';
require_once 
'../incfiles/func.php';
require_once 
'../incfiles/auth.php';
require_once 
'../incfiles/user.php';

if (empty(
$user_id)) {go(URL.'/');}

$title lang('Поиск сообщества','Пошук спільнот');
require_once 
'../incfiles/head.php';



if (!empty(
$_GET['id']) && is_numeric($_GET['id']))
{
    
$id abs(intval($_GET['id']));
    
$result mysql_query("SELECT * FROM `users` WHERE `id` = '".$id."' LIMIT 1");
    if (
mysql_num_rows($result) == true$arr_user mysql_fetch_array($result);
        else 
go(URL);

}

if (!empty(
$_REQUEST['search']) && mb_strlen(check($_REQUEST['search']))>2$search substr(check($_REQUEST['search']),0,100);
    
?>
<script type="text/javascript">
$(function(){
    $('#form').on('submit', function(e){
    Page.Loading('start');
    e.preventDefault();
    var $that = $(this),
        formData = new FormData($that.get(0));
    $.ajax({
      url: $that.attr('action'),
      type: $that.attr('method'),
      contentType: false,
      processData: false,
      data: formData,
      success: function(response){
        if(response){
             $('.content').html(response);
       }
        Page.Loading('stop');
     }
    });
  });
});
</script>
<?
                                        
echo '<div class="title">    
                                            <div class="block2">
    <form id="form" action="'
.URL.'/friends/poshuk.php" method="post">
    <input class="input2" style="width:70%" type="text" name="search" value="'
.$search.'"/>
    <input class="button2" type="submit" value="'
.lang('Поиск','Пошук').'"/>
    </form>
    </div></div>'
;    
    
    if(!empty(
$search))
    {
        
$all_on mysql_result(mysql_query("SELECT COUNT(`id`) FROM `friends` WHERE `user_id` = '".$id."' AND `online` > '".(time() - 600)."' LIMIT 1"),0);

//$all = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `friends` WHERE `user_id` = '".$id."' AND `name` LIKE '%".$search."%'"),0);

$all mysql_result(mysql_query("SELECT COUNT(`id`) FROM `friends` WHERE `user_id` = '".$id." ".$search."' AND `online` > '".(time() - 600)."' LIMIT 1"),0);

    if (
$arr_user['count_friends'] > 0)
    {
        
$all $arr_user['count_friends'];
        
$cp ceil($all/10);
        
$p = (isset($_GET['p']) and is_numeric($_GET['p']) and $_GET['p']>and $_GET['p']<=$cp) ? $_GET['p'] : 1;
        
$start $p*10-10;

        
$res mysql_query("SELECT * FROM `friends` WHERE `user_id` = '".$id."' ORDER by `time` DESC LIMIT $start,10");
        while (
$array mysql_fetch_array($res))
        {
            echo 
'<div class="block">';
            echo 
user_name($array['friend_id']);
            
            if (
$user_id == $array['friend_id']) echo '<br/><br/>'; else echo '<ul><a href="'.URL.'/mail/new.php?id='.$array['friend_id'].'" onclick="Page.Go(this.href); return false">'.lang('Написать','Написати').'</a></ul>';
            if (
$user_id == $array['friend_id']) echo '<br/><br/>'; else echo '<ul><a href="'.URL.'/friends/del.php?del='.$array['friend_id'].'" onclick="Page.Go(this.href); return false">'.lang('Удалить из друзей','Видалити з друзів').'</a></ul>';
            
            echo 
'</div>';

        }
        
navi($p,$cp,'/friends/?id='.$id.'&');

    }

        else echo 
'<div class="block">'.lang('По Вашему запросу ничего не найдено','За Вашим запитом нічого не знайдено').'</div>';

    }
    require_once 
'../incfiles/foot.php';

?>
Онлайн: 0
Реклама