Файл: element_online_user.php
Строк: 150
<?php
require_once './element_options/element_options.php';
    
if (!$user) { header('Location: /'); exit; }
    if (readcache('element_user_mesto'.$user['lost_id']) != 'Кто онлайн') writecache('element_user_mesto'.$user['lost_id'], 'Кто онлайн');
    
        if ($go == 'search') {
        $to = (isset($_GET['to']) AND !empty($_GET['to'])) ? addslashes(htmlspecialchars($_GET['to'])) : false;
        $title = 'Поиск персонажа';
        require_once './element_include/element_head.php';
        require_once './element_include/element_header_user_true.php';
        echo '<div class="nfl p5 mb5 mt5 mlra">';
        echo '<div class="mb5 cntr small"><a class="button w50" href="/online">Кто онлайн</a></div>';
        
            if ($to == 'go') {
            $nick = (isset($_POST['nick']) AND !empty($_POST['nick'])) ? addslashes(htmlspecialchars(trim($_POST['nick']))) : false;
                if ($nick) {
                    $query = mysql_query("SELECT `lost_id`,`lost_race`,`lost_login` FROM `element_user` WHERE `lost_login` LIKE '%$nick%' LIMIT 10");
                    $num_query = mysql_num_rows($query);
                }
            }
        
        echo '<div class="cntr p5 mt5 mb5 mlra">
        <form method="post" action="/online?go=search&to=go">
        <input class="fdark w98 mb10" type="text" name="nick" value="'.((isset($nick) AND !empty($nick)) ? $nick : '').'" size="20" maxlength="255">
            <span class="mt5 btn w30">
                <span class="el"><span class="er">
                    <input class="ttl" type="submit" id="" name="submit" value="Искать">
                </span></span> 
            </span> 
        </form></div>';
        
            if ($to == 'go' AND isset($num_query)) {
                if ($num_query > 0) {
                echo '<div class="nf2 small p5 yellow1 mt5 mlra">';
                $color = 1;
                while ($myrrow = mysql_fetch_array($query)) {
                if ($color % 2) $odd = ' odd'; else $odd = '';
                echo '
                <div class="ml5 mr5">
                <a class="bl p5 small block'.$odd.'" href="/user?id='.$myrrow['lost_id'].'">
                <span class="white small fr">'.$mesto.'</span>
                '.ikonka_user($myrrow['lost_race'], ((!empty($online[$myrrow['lost_id']])) ? 'online' : 'offline')).' <span class="yellow1">'.$myrrow['lost_login'].'</span>    
                </a>
                </div>
                ';
                $color++;
                }
                echo '</div>';
                } else echo '<div class="nf2 small p5 cntr red mt5 mlra">Персонаж "'.$nick.'" не найден</div>';
            
            }
        
        
        echo '</div>';
        require_once './element_include/element_foot_user_true.php';
        exit;
        }
    
    $title = 'Кто онлайн: '.count($online);
    require_once './element_include/element_head.php';
    require_once './element_include/element_header_user_true.php';
    echo '<div class="nfl p5 mb5 mt5 mlra">';
    echo '<div class="mb5 cntr small"><a class="button w50" href="/online?go=search">Поиск по нику</a></div>';
            if (!empty($online)) {
                arsort($online);
                require_once './element_function/element_function_pagination.php';
                $page = (isset($_GET['page']) AND is_numeric($_GET['page'])) ? (int)$_GET['page'] : 1;
                $pagination = pagination(10, $page, count($online));
                $color = $pagination['start'];
                echo '<div class="mt5 mlra">';
                $i = $pagination['start'] + 1;
            foreach(array_slice($online, $pagination['start'], $pagination['num'], true) as $id => $massiv) {
                $online_user = cache_user($id);
                if ($color % 2) $odd = ''; else $odd = ' odd';
                $explode = explode(" ", $massiv);
                $mesto = readcache('element_user_mesto'.$id);
                $mesto = (!empty($mesto)) ? $mesto : 'На сайте';
                
                
                
            echo '
            <div class="ml5 mr5">
                <a class="bl p5 small block'.$odd.'" href="/user?id='.$id.'">
                <span class="white small fr">'.$mesto.'</span>
                    '.$i.'. '.ikonka_user($online_user['lost_race'], 'online').' <span class="yellow1">'.$online_user['lost_login'].'</span>    
                </a>
            </div>
            ';
            
            $color++;
            $i++;
            }
                echo '</div>';
            }
            
    echo '</div>';
    echo pagination_echo($pagination['page'],$pagination['total'],'/online?page=');
    require_once './element_include/element_foot_user_true.php';
?>