function check_bot_status($browser, $ip) { $bots_array = get_bots(); $is_bot = false; foreach ($bots_array as $bot) { if ($bot['user_agent'] && mb_strpos(mb_strtolower($browser), mb_strtolower($bot['user_agent'])) === 0) { $is_bot = $bot['user_id']; } if ($bot['user_ip'] && (!$bot['user_agent'] || $is_bot)) { $is_bot = false; foreach (explode(',', $bot['user_ip']) as $bot_ip) { if (strpos($ip, $bot_ip) === 0) { $is_bot = $bot['user_id']; } } } if ($is_bot) { if ($bot['user_status'] == USER_DISABLE) { // How would this affect indexing ? header("HTTP/1.0 503 Service Unavailable"); script_close(false); } break; } } return $is_bot; }
private function f_connected($sql) { static $bots; if (!isset($bots)) { $bots = get_bots(); } $fields = array('last_bio_id' => 0, 'users_visible' => 0, 'users_hidden' => 0, 'users_guests' => 0, 'users_bots' => 0, 'users_online' => 0, 'last_ip' => ''); foreach ($fields as $k => $v) { ${$k} = $v; } _style($block, array('L_TITLE' => _lang($block_title))); _style($block . '.members'); $online = sql_rowset($sql); foreach ($online as $row) { // Guest if ($row->bio_id == 1) { if ($row->session_ip != $last_ip) { $users_guests++; } $last_ip = $row->session_ip; continue; } // Member if ($row->bio_id != $last_bio_id) { $is_bot = isset($user_bots[$row->bio_id]); if ($row->bio_show) { $username = $row->bio_name; if (!$is_bot) { $users_visible++; } } else { $username = '******' . $row->bio_name; $users_hidden++; } if (($row->bio_show || $bio->v('auth_founder')) && !$is_bot || $is_bot && $bio->v('auth_founder')) { _style($block . '.members.item', array('USERNAME' => $username, 'PROFILE' => _link_bio($row->bio_alias))); } } $last_bio_id = $row->bio_id; } $users_total = (int) $users_visible + $users_hidden + $users_guests + $users_bots; if (!($users_visible + $users_hidden) || !$users_visible && $users_hidden) { _style($block . '.members.none'); } if (!$users_visible) { _style($block . '.members.none'); } _style($block . '.legend'); $online_ary = array('MEMBERS_TOTAL' => $users_total, 'MEMBERS_VISIBLE' => $users_visible, 'MEMBERS_GUESTS' => $users_guests, 'MEMBERS_HIDDEN' => $users_hidden, 'MEMBERS_BOT' => $users_bots); if ($unset_legend !== false) { unset($online_ary[$unset_legend]); } foreach ($online_ary as $lk => $vk) { if (!$vk && $lk != 'MEMBERS_TOTAL') { continue; } _style($block . '.legend.item', array('L_MEMBERS' => _lang($lk . ($vk != 1 ? '2' : '')), 'ONLINE_VALUE' => $vk)); } return; }