function doLogList($cond) { $log_fields = array('user' => array('table' => 'users', 'key' => 'id', 'fields' => '_userfields'), 'user2' => array('table' => 'users', 'key' => 'id', 'fields' => '_userfields'), 'thread' => array('table' => 'threads', 'key' => 'id', 'fields' => 'id,title'), 'post' => array('table' => 'posts', 'key' => 'id', 'fields' => 'id'), 'forum' => array('table' => 'forums', 'key' => 'id', 'fields' => 'id,title'), 'forum2' => array('table' => 'forums', 'key' => 'id', 'fields' => 'id,title'), 'pm' => array('table' => 'pmsgs', 'key' => 'id', 'fields' => 'id')); $bucket = 'log_fields'; include 'lib/pluginloader.php'; $joinfields = ''; $joinstatements = ''; foreach ($log_fields as $field => $data) { $joinfields .= ", {$field}.({$data['fields']}) \n"; $joinstatements .= "LEFT JOIN {{$data['table']}} AS {$field} ON l.{$field}!='0' AND {$field}.{$data['key']}=l.{$field} \n"; } $logR = Query("\tSELECT \n\t\t\t\t\t\tl.*\n\t\t\t\t\t\t{$joinfields}\n\t\t\t\t\tFROM \n\t\t\t\t\t\t{log} l\n\t\t\t\t\t\t{$joinstatements}\n\t\t\t\t\tWHERE {$cond}\n\t\t\t\t\tORDER BY date DESC\n\t\t\t\t\tLIMIT 100"); //TODO Paging while ($item = Fetch($logR)) { $event = formatEvent($item); $ip = formatIP($item["ip"]); $cellClass = ($cellClass + 1) % 2; $log .= "\n\t\t\t<tr>\n\t\t\t\t<td class=\"cell2\">\n\t\t\t\t\t" . str_replace(" ", " ", TimeUnits(time() - $item['date'])) . "\n\t\t\t\t</td>\n\t\t\t\t<td class=\"cell{$cellClass}\">\n\t\t\t\t\t{$event}\n\t\t\t\t</td>\n\t\t\t\t<td class=\"cell{$cellClass}\">\n\t\t\t\t\t{$ip}\n\t\t\t\t</td>\n\t\t\t</tr>"; } echo "\n\t\t<table class=\"outline margin\">\n\t\t\t<tr class=\"header1\">\n\t\t\t\t<th>\n\t\t\t\t\t" . __("Time") . "\n\t\t\t\t</th>\n\t\t\t\t<th>\n\t\t\t\t\t" . __("Event") . "\n\t\t\t\t</th>\n\t\t\t\t<th>\n\t\t\t\t\t" . __("IP") . "\n\t\t\t\t</th>\n\t\t\t</tr>\n\t\t\t{$log}\n\t\t</table>"; }
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; }
echo $RolesString; ?> </td> <td class="Alt"><?php echo Gdn_Format::date($User->DateFirstVisit, 'html'); ?> </td> <td><?php echo Gdn_Format::date($User->DateLastActive, 'html'); ?> </td> <?php if ($ViewPersonalInfo) { ?> <td><?php echo formatIP($User->LastIPAddress); ?> </td> <?php } ?> <?php $this->EventArguments['User'] = $User; $this->fireEvent('UserCell'); ?> <?php if ($EditUser || $DeleteUser) { ?> <td class="options"> <div class="btn-group"> <?php
CheckPermission('admin.ipsearch'); $ip = $_GET["id"]; if (!filter_var($ip, FILTER_VALIDATE_IP)) { Kill("Invalid IP"); } $links = array(); $links[] = "<a href=\"http://dnsquery.org/ipwhois/{$ip}\" target=\"_blank\">Whois Query</a>"; $links[] = "<a onclick=\"if(confirm('Are you sure you want to IP-ban {$ip}?')) {document.getElementById('banform').submit();} return false;\" href=\"#\">IP Ban</a>"; MakeCrumbs(array(actionLink("admin") => __("Admin"), actionLink("ipbans") => __("IP ban manager"), '' => $ip), $links); $rUsers = Query("select * from {users} where lastip={0}", $ip); echo "<h3>Users with this IP</h3>"; $userList = ""; $ipBanComment = ""; $i = 1; if (NumRows($rUsers)) { while ($user = Fetch($rUsers)) { $ipBanComment .= $user["name"] . " "; $cellClass = ($cellClass + 1) % 2; if ($user['lasturl']) { $lastUrl = "<a href=\"" . $user['lasturl'] . "\">" . $user['lasturl'] . "</a>"; } else { $lastUrl = __("None"); } $userList .= format("\n\t\t<tr class=\"cell{0}\">\n\t\t\t<td>\n\t\t\t\t{1}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{2}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{3}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{4}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{5}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{6}\n\t\t\t</td>\n\t\t</tr>\n\t", $cellClass, $i, UserLink($user), cdate("d-m-y G:i:s", $user['lastactivity']), $user['lastposttime'] ? cdate("d-m-y G:i:s", $user['lastposttime']) : __("Never"), $lastUrl, formatIP($user['lastip'])); $i++; } } else { $userList = "<tr class=\"cell0\"><td colspan=\"6\">" . __("No users") . "</td></tr>"; } echo "<form id=\"banform\" action=\"" . htmlentities(actionLink('ipbans')) . "\" method=\"post\">\n\t<input type=\"hidden\" name=\"ip\" value=\"{$ip}\">\n\t<input type=\"hidden\" name=\"reason\" value=\"" . htmlentities($ipBanComment) . "\">\n\t<input type=\"hidden\" name=\"days\" value=\"0\">\n\t<input type=\"hidden\" name=\"actionadd\" value=\"yes, do it!\">\n</form>"; echo "\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" . __("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\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{$userList}\n\t</table>";
<th style="width:150px;">Date</th> <th style="width:150px;">IP</th> <th>Users</th> </tr> <?php $c = 1; foreach ($ipmatches as $ip => $match) { $date = formatdate($match['date']); unset($match['date']); $userlist = ''; foreach ($match as $user) { $userdata = getDataPrefix($user, 'u_'); $userlist .= userLink($userdata) . ', '; } $userlist = substr($userlist, 0, -2); $fip = formatIP($ip); echo ' <tr class="cell' . $c . '"> <td class="center">' . $date . '</td> <td class="center">' . $fip . '</td> <td>' . $userlist . '</td> </tr>'; $c = $c == 1 ? 2 : 1; } ?> </table> <table class="outline margin"> <tr class="header1"> <th colspan="2">Password matches</th> </tr> <tr class="header0">
<?php $title = "Service Abusers"; require 'bad-behavior/responses.inc.php'; if ($loguser['powerlevel'] < 3) { Kill('No.'); } echo "\n\t<table class=\"outline margin width100\">\n\t\t<tr class=\"header0\">\n\t\t\t<th>\n\t\t\t\tDate\n\t\t\t</th>\n\t\t\t<th>\n\t\t\t\tIP\n\t\t\t</th>\n\t\t\t<th>\n\t\t\t\tRequest\n\t\t\t</th>\n\t\t\t<th>\n\t\t\t\tKey\n\t\t\t</th>\n\t\t</tr>\n"; $abusers = query('SELECT * FROM {bad_behavior} ORDER BY `date` DESC'); while ($abuser = fetch($abusers)) { $date = formatdate(strtotime($abuser['date'])); $response = bb2_get_response($abuser['key']); echo "\n\t\t<tr class=\"cell0\">\n\t\t\t<td>\n\t\t\t\t{$date}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t" . formatIP($abuser['ip']) . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<pre style='white-space:pre-wrap'>" . htmlspecialchars(preg_replace('/logsession=\\w+/', 'logsession=?????', $abuser['http_headers'])) . "</pre>\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<abbr title=\"" . htmlspecialchars($response['log']) . "\">{$abuser['key']}</abbr>\n\t\t\t</td>\n\t\t</tr>\n"; } echo "\n\t</table>\n";
/** * Returns an IP address with a link to the user search. */ function ipAnchor($IP, $CssClass = '') { if ($IP) { return anchor(formatIP($IP), '/user/browse?keywords=' . urlencode($IP), $CssClass); } else { return $IP; } }
if (!HasPermission('forum.viewforum', $lastPost['fid'])) { $place = __("a restricted forum"); } else { $ispublic = HasPermission('forum.viewforum', $lastPost['fid'], true); $pid = $lastPost['pid']; $place = actionLinkTag($tags[0], 'post', $pid) . " (" . actionLinkTag($lastPost['ftit'], 'forum', $lastPost['fid'], '', $ispublic ? $lastPost['ftit'] : '') . ")"; } $temp[__("Last post")] = format("{0} ({1} ago)", formatdate($lastPost['date']), TimeUnits(time() - $lastPost['date'])) . "<br>" . __("in") . " " . $place; } else { $temp[__("Last post")] = __("Never"); } $temp[__("Last view")] = format("{0} ({1} ago)", formatdate($user['lastactivity']), TimeUnits(time() - $user['lastactivity'])); //$temp[__("Score")] = $score; if (HasPermission('admin.viewips')) { $temp[__("Last user agent")] = htmlspecialchars($user['lastknownbrowser']); $temp[__("Last IP address")] = formatIP($user['lastip']); } $profileParts[__("General information")] = $temp; $temp = array(); $temp[__("Email address")] = $emailField; if ($homepage) { $temp[__("Homepage")] = $homepage; } $profileParts[__("Contact information")] = $temp; $temp = array(); $infofile = "themes/" . $user['theme'] . "/themeinfo.txt"; if (file_exists($infofile)) { $themeinfo = file_get_contents($infofile); $themeinfo = explode("\n", $themeinfo, 2); $themename = trim($themeinfo[0]); $themeauthor = trim($themeinfo[1]);
} if ($lastPost["minpower"] > $realpl) { $place = __("a restricted forum."); } else { $pid = $lastPost["pid"]; $place = makeThreadLink($thread) . " (" . actionLinkTag($lastPost["ftit"], "forum", $lastPost["fid"], "", $lastPost["ftit"]) . ")"; $place .= " » " . actionLinkTag($pid, "post", $pid); } $foo[__("Last post")] = format("{0} ({1} ago)", formatdate($lastPost["date"]), TimeUnits(time() - $lastPost["date"])) . "<br>" . __("in") . " " . $place; } else { $foo[__("Last post")] = __("Never"); } $foo[__("Last view")] = format("{0} ({1} ago)", formatdate($user['lastactivity']), TimeUnits(time() - $user['lastactivity'])); $foo[__("Browser")] = $user['lastknownbrowser']; if ($loguser['powerlevel'] > 0) { $foo[__("Last known IP")] = formatIP($user['lastip']); } $profileParts[__("General information")] = $foo; $foo = array(); $foo[__("Email address")] = $emailField; if ($homepage) { $foo[__("Homepage")] = $homepage; } $profileParts[__("Contact information")] = $foo; $foo = array(); $infofile = "themes/" . $user['theme'] . "/themeinfo.txt"; $themeinfo = file_get_contents($infofile); $themeinfo = explode("\n", $themeinfo, 2); if (file_exists($infofile)) { $themename = trim($themeinfo[0]); $themeauthor = trim($themeinfo[1]);
<?php $title = "Admin Cruft"; if ($loguser['powerlevel'] < 4) { Kill('No.'); } $shitbugs = @file_get_contents('shitbugs.dat'); $shitbugs = $shitbugs ? unserialize($shitbugs) : array(); echo "\n\t<table class=\"outline margin width100\">\n\t\t<tr class=\"header0\">\n\t\t\t<th>\n\t\t\t\tDate\n\t\t\t</th>\n\t\t\t<th>\n\t\t\t\tIP\n\t\t\t</th>\n\t\t\t<th>\n\t\t\t\tMatching users\n\t\t\t</th>\n\t\t\t<th>\n\t\t\t\t \n\t\t\t</th>\n\t\t</tr>\n"; foreach ($shitbugs as $foo) { $date = formatdate($foo['date']); $userlisting = ''; $users = Query("SELECT name FROM {users} WHERE lastip={0} ORDER BY name", $foo['ip']); while ($user = Fetch($users)) { $userlisting .= htmlspecialchars($user['name']) . ', '; } if (!$userlisting) { $userlisting = 'None'; } else { $userlisting = substr($userlisting, 0, strlen($userlisting) - 2); } echo "\n\t\t<tr class=\"cell0\">\n\t\t\t<td>\n\t\t\t\t{$date}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t" . formatIP($foo['ip']) . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{$userlisting}\n\t\t\t</td>\n\t\t</tr>\n"; } echo "\n\t</table>\n";
$pagelinks .= " " . ($i / $ppp + 1); } else { $pagelinks .= " " . actionLinkTag($i / $ppp + 1, "lastknownbrowsers", "", $ual . "from=" . $i); } } if ($pagelinks) { if ($from == 0) { $pagelinks = "1" . $pagelinks; } else { $pagelinks = actionLinkTag(1, "lastknownbrowsers", "", $ual) . $pagelinks; } Write("<div class=\"smallFonts pages\">" . __("Pages:") . " {0}</div>", $pagelinks); } if ($isMod) { $format = "\n\t\t<tr class=\"cell{0}\">\n\t\t\t<td>\n\t\t\t\t{1}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{2}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{4}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{5}\n\t\t\t</td>\n\t\t</tr>\n\t"; } else { $format = "\n\t\t<tr class=\"cell{0}\">\n\t\t\t<td>\n\t\t\t\t{1}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{2}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{3}\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t{5}\n\t\t\t</td>\n\t\t</tr>\n\t"; } $items = ""; while ($user = Fetch($peeps)) { $lip = $user['lastip']; $lkb = $user['lastknownbrowser']; $lkb = str_replace("-->", "", str_replace("<!--", " —", $lkb)); $cellClass = ($cellClass + 1) % 2; $items .= format($format, $cellClass, $user['id'], UserLink(getDataPrefix($user, "u_")), IP2C($lip), formatIP($lip), $lkb); } if ($isMod) { write("\n\t<table class=\"outline margin\">\n\t\t<tr class=\"header1\">\n\t\t\t<th>\n\t\t\t\t" . __("ID") . "\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>\n\t\t\t\t" . __("IP") . "\n\t\t\t</th>\n\t\t\t<th>\n\t\t\t\t" . __("Last known browser") . "\n\t\t\t</th>\n\t\t</tr>\n\t\t{0}\n\t</table>\n", $items); } else { write("\n\t<table class=\"outline margin\">\n\t\t<tr class=\"header1\">\n\t\t\t<th>\n\t\t\t\t" . __("ID") . "\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>\n\t\t\t\t \n\t\t\t</th>\n\t\t\t<th>\n\t\t\t\t" . __("Last known browser") . "\n\t\t\t</th>\n\t\t</tr>\n\t\t{0}\n\t</table>\n", $items); }