function listGuests($rGuests, $noMsg) { global $showIPs; if (!NumRows($rGuests)) { return "<tr class=\"cell0\"><td colspan=\"6\">{$noMsg}</td></tr>"; } $i = 1; while ($guest = Fetch($rGuests)) { $cellClass = ($cellClass + 1) % 2; if ($guest['date']) { $lastUrl = "<a href=\"" . FilterURL($guest['lasturl']) . "\">" . FilterURL($guest['lasturl']) . "</a>"; } else { $lastUrl = __("None"); } $guestList .= "\n\t\t<tr class=\"cell{$cellClass}\">\n\t\t\t<td>{$i}</td>\n\t\t\t<td colspan=\"2\" title=\"" . htmlspecialchars($guest['useragent']) . "\">" . htmlspecialchars(substr($guest['useragent'], 0, 65)) . "</td>\n\t\t\t<td>" . cdate("d-m-y G:i:s", $guest['date']) . "</td>\n\t\t\t<td>{$lastUrl}</td>"; if ($showIPs) { $guestList .= "<td>" . formatIP($guest['ip']) . "</td>"; } $guestList .= "</tr>"; $i++; } return $guestList; }
function listGuests($rGuests) { global $showIPs; $guestList = array(); $i = 1; while ($guest = Fetch($rGuests)) { $gdata = array(); $gdata['num'] = $i++; if ($showIPs) { $gdata['userAgent'] = '<span title="' . htmlspecialchars($guest['useragent']) . '">' . htmlspecialchars(substr($guest['useragent'], 0, 65)) . '</span>'; } $gdata['lastView'] = cdate("d-m-y G:i:s", $guest['date']); if ($guest['date']) { $gdata['lastURL'] = "<a href=\"" . FilterURL($guest['lasturl']) . "\">" . FilterURL($guest['lasturl']) . "</a>"; } else { $gdata['lastURL'] = __("None"); } if ($showIPs) { $gdata['ip'] = formatIP($guest['ip']); } $guestList[] = $gdata; } return $guestList; }
} else { $lastUrl = __("None"); } $guestList .= format("\n\t\t<tr class=\"cell{0}\">\n\t\t\t<td>{1}</td>\n\t\t\t<td title=\"{2}\">{3}</td>\n\t\t\t<td>{4}</td>\n\t\t\t<td>{5}</td>\n\t\t\t<td>{6} {7}</td>\n\t\t</tr>\n", $cellClass, $i, htmlspecialchars($guest['useragent']), htmlspecialchars(substr($guest['useragent'], 0, 65)), cdate("d-m-y G:i:s", $guest['date']), $lastUrl, $guest['ip'], IP2C($guest['ip'])); $i++; } } else { $guestList = "<tr class=\"cell0\"><td colspan=\"5\">" . __("No guests") . "</td></tr>"; } $botList = ""; if (NumRows($rBots)) { $i = 1; while ($bot = Fetch($rBots)) { $cellClass = ($cellClass + 1) % 2; if ($bot['date']) { $lastUrl = "<a href=\"" . $bot['lasturl'] . "\">" . FilterURL($bot['lasturl']) . "</a>"; } else { $lastUrl = __("None"); } $botList .= format("\n\t\t<tr class=\"cell{0}\">\n\t\t\t<td>{1}</td>\n\t\t\t<td title=\"{2}\">{3}</td>\n\t\t\t<td>{4}</td>\n\t\t\t<td>{5}</td>\n\t\t\t<td>{6}</td>\n\t\t</tr>\n", $cellClass, $i, htmlspecialchars($bot['useragent']), htmlspecialchars(substr($bot['useragent'], 0, 65)), cdate("d-m-y G:i:s", $bot['date']), $lastUrl, $bot['ip']); $i++; } } else { $botList = "<tr class=\"cell0\"><td colspan=\"5\">" . __("No bots") . "</td></tr>"; } write("\n\t<table class=\"outline margin\">\n\t\t<tr class=\"header0\">\n\t\t\t<th colspan=\"6\">\n\t\t\t\t" . __("Online users") . "\n\t\t\t</th>\n\t\t</tr>\n\t\t<tr class=\"header1\">\n\t\t\t<th style=\"width: 30px;\">\n\t\t\t\t#\n\t\t\t</th>\n\t\t\t<th>\n\t\t\t\t" . __("Name") . "\n\t\t\t</th>\n\t\t\t<th style=\"width: 140px;\">\n\t\t\t\t" . __("Last view") . "\n\t\t\t</th>\n\t\t\t<th style=\"width: 140px;\">\n\t\t\t\t" . __("Last post") . "\n\t\t\t</th>\n\t\t\t<th>\n\t\t\t\t" . __("URL") . "\n\t\t\t</th>\n" . ($loguser['powerlevel'] > 0 ? "\n\t\t\t<th style=\"width: 140px;\">\n\t\t\t\t" . __("IP") . "\n\t\t\t</th>\n" : "") . "\n\t\t</tr>\n\t\t{0}\n\t</table>\n\t<table class=\"outline margin\">\n\t\t<tr class=\"header1\">\n\t\t\t<th style=\"width: 30px;\">\n\t\t\t\t" . __("#") . "\n\t\t\t</th>\n\t\t\t<th>\n\t\t\t\t" . __("User agent") . "\n\t\t\t</th>\n\t\t\t<th style=\"width: 140px;\">\n\t\t\t\t" . __("Last view") . "\n\t\t\t</th>\n\t\t\t<th>\n\t\t\t\t" . __("URL") . "\n\t\t\t</th>\n\t\t\t<th style=\"width: 140px;\">\n\t\t\t\t" . __("IP") . "\n\t\t\t</th>\n\t\t</tr>\n\t\t<tr class=\"header0\">\n\t\t\t<th colspan=\"5\">\n\t\t\t\t" . __("Guests") . "\n\t\t\t</th>\n\t\t</tr>\n\t\t{1}\n\t\t<tr class=\"header0\">\n\t\t\t<th colspan=\"5\">\n\t\t\t\t" . __("Bots") . "\n\t\t\t</th>\n\t\t</tr>\n\t\t{2}\n\t</table>\n", $userList, $guestList, $botList); function IP2C($ip) { $q = @mysql_query("select cc from ip2c where ip_from <= inet_aton('" . $ip . "') and ip_to >= inet_aton('" . $ip . "')") or $r['cc'] = ""; if ($q) { $r = @mysql_fetch_array($q);