Example #1
0
$banorama = $_SERVER['REMOTE_ADDR'] == $x_hacks['adminip'] || $loguser['id'] == 1 || $loguser['id'] == 5 || $loguser['id'] == 2100;
if ($banorama && filter_string($_GET['banip']) && filter_string($_GET['valid']) == md5($_GET['banip'] . "aglkdgslhkadgshlkgds")) {
    $sql->query("INSERT INTO `ipbans` SET `ip` = '" . $_GET['banip'] . "', `reason`='online.php ban', `date` = '" . ctime() . "', `banner` = '{$loguserid}'") or print mysql_error();
    //		if ($_GET['uid']) mysql_query("UPDATE `users` SET `powerlevel` = -1, `title` = 'Banned; account hijacked. Contact admin via PM to change it.' WHERE `id` = '". $_GET['uid'] ."'") or print mysql_error();
    xk_ircsend("1|" . xk(8) . $loguser['name'] . xk(7) . " added IP ban for " . xk(8) . $_GET['banip'] . xk(7) . ".");
    return header("Location: online.php?m=1");
}
$sort = filter_bool($_GET['sort']);
$lnk = '<a href=online.php' . ($sort ? "?sort=1&" : '?') . 'time';
print "\n\t\t{$header}{$smallfont}\n\t\tShow online users during the last:\n\t\t{$lnk}=60>minute</a> |\n\t\t{$lnk}=300>5 minutes</a> |\n\t\t{$lnk}=900>15 minutes</a> |\n\t\t{$lnk}=3600>hour</a> |\n\t\t{$lnk}=86400>day</a>\n\t";
if ($isadmin) {
    print '<br>Admin cruft: <a href=online.php' . ($sort ? '?sort=1&' : '?') . "time={$time}>Sort by " . ($sort == 'IP' ? 'date' : 'IP') . "</a>";
}
// Logged in users
$posters = $sql->query("SELECT id,posts,name,sex,powerlevel,aka,lastactivity,lastip,lastposttime,lasturl,birthday FROM users WHERE lastactivity>" . (ctime() - $time) . ' ORDER BY ' . ($sort == 'IP' && $isadmin ? 'lastip' : 'lastactivity DESC'));
print "<br>\n\t{$fonttag} Online users during the last " . timeunits2($time) . ":\n\t{$tblstart}\n\t\t{$tccellh} width=20>&nbsp</td>\n\t\t{$tccellh} width=200>Username</td>\n\t\t{$tccellh} width=120> Last activity</td>\n\t\t{$tccellh} width=180> Last post</td>\n\t\t{$tccellh} width=*>URL</td>\n\t";
if ($isadmin) {
    print "{$tccellh} width=120>IP address</td>";
}
print "{$tccellh} width=60> Posts</tr>";
for ($i = 1; $user = $sql->fetch($posters); $i++) {
    $userlink = getuserlink($user);
    if (!$user['posts']) {
        $user['lastposttime'] = getblankdate();
    } else {
        $user['lastposttime'] = date($dateformat, $user['lastposttime'] + $tzoff);
    }
    $user['lasturl'] = str_replace('<', '&lt;', $user['lasturl']);
    $user['lasturl'] = str_replace('>', '&gt;', $user['lasturl']);
    $user['lasturl'] = str_replace('%20', ' ', $user['lasturl']);
    $user['lasturl'] = str_replace('shoph', 'shop', $user['lasturl']);
Example #2
0
$windowtitle = "Posts by time of day";
require 'lib/layout.php';
if (!isset($_GET['posttime'])) {
    $posttime = 86400;
} else {
    $posttime = intval($_GET['posttime']);
}
if ($id) {
    $qstrings[] = "user={$id}";
    $from = " from " . $sql->resultq("SELECT name FROM users WHERE id={$id}");
} else {
    $from = ' on the board';
}
if ($posttime !== 0) {
    $qstrings[] = "date > " . (ctime() - $posttime);
    $during = ' during the last ' . timeunits2($posttime);
}
if (empty($qstrings)) {
    $qwhere = '1';
} else {
    $qwhere = implode(' AND ', $qstrings);
}
$posts = $sql->query("SELECT count(*) AS cnt, FROM_UNIXTIME(date,'%k') AS hour FROM posts WHERE {$qwhere} GROUP BY hour");
$link = "<a href=postsbytime.php?" . ($id ? "id={$id}&" : "") . "posttime";
print "{$header}{$smallfont}\n\t\tTimeframe:\n\t\t{$link}=86400>Last day</a> |\n\t\t{$link}=604800>Last week</a> |\n\t\t{$link}=2592000>Last 30 days</a> |\n\t\t{$link}=31536000>Last year</a> |\n\t\t{$link}=0>All-time</a><br>\n\t\t{$fonttag} Posts{$from} by time of day{$during}:\n\t\t{$tblstart}\n\t\t\t{$tccellh} width=100>Time</td>\n\t\t\t{$tccellh} width=50>Posts</td>\n\t\t\t{$tccellh}>&nbsp</tr>";
$postshour = array_fill(0, 24, 0);
$max = 0;
while ($h = $sql->fetch($posts)) {
    if (($postshour[$h['hour']] = $h['cnt']) > $max) {
        $max = $h['cnt'];
    }
Example #3
0
}
if ($_GET['forum']) {
    $fid = intval($_GET['forum']);
    $forum = $sql->fetchq("SELECT title, minpower FROM forums WHERE id={$fid}");
    if ($forum['minpower'] > 0 && $power < $forum['minpower']) {
        errorpage('You don\'t have access to view posts in this forum.', 'return to the board', 'index.php');
    }
    $where = "in {$forum['title']}";
    $forumquery = " AND t.forum = {$fid}";
} else {
    $forumquery = '';
    $where = "on the board";
}
if ($_GET['time']) {
    $time = intval($_GET['time']);
    $when = " over the past " . timeunits2($time);
    $timequery = ' AND p.date > ' . (ctime() - $time);
} else {
    $timequery = $when = '';
}
if (!$page) {
    $page = 0;
}
if (!$ppp) {
    $ppp = 50;
}
$min = $ppp * $page;
$posts = $sql->query("SELECT p.id,thread,ip,date,num,t.title,minpower " . "FROM posts p " . "LEFT JOIN threads t ON (thread=t.id) " . "LEFT JOIN forums f ON (t.forum=f.id) " . "WHERE p.user={$id}{$forumquery}{$timequery} ORDER BY p.id DESC");
$posttotal = mysql_num_rows($posts);
// Seek to page
if (!@mysql_data_seek($posts, $min)) {
Example #4
0
} else {
    print "\r\n\t\t\t{$tblstart}\r\n\t\t\t\t<tr>{$tccellh}>Thread Repair System II</td></tr>\r\n\t\t\t\t<tr>{$tccell1}>Now running.\r\n\t\t\t\t</td></tr>\r\n\t\t\t{$tblend}\r\n\t\t<br>\r\n\t\t{$tblstart}\r\n\t\t\t<tr>\r\n\t\t\t\t{$tccellh}>id#</td>\r\n\t\t\t\t{$tccellh}>Name</td>\r\n\t\t\t\t{$tccellh}>Reported Date</td>\r\n\t\t\t\t{$tccellh}>Real Date</td>\r\n\t\t\t\t{$tccellh}>Difference</td>\r\n\t\t\t\t{$tccellh}>Status</td>\r\n\t\t\t</tr>\r\n\t\t";
    $q = "SELECT `threads`.`id`, `threads`.`title` , `threads`.`lastpostdate` , `posts`.`date` as realdate, (`posts`.`date` - `threads`.`lastpostdate`) AS `diff` FROM `threads` LEFT JOIN (SELECT MAX(`date`) as `date`, `thread` FROM `posts` GROUP BY `thread`) as `posts`  ON `posts`.`thread` = `threads`.`id` ORDER BY `diff` DESC";
    $sql = mysql_query($q) or die(mysql_error());
    $count = "";
    while ($data = mysql_fetch_array($sql, MYSQL_ASSOC)) {
        $status = "";
        if ($data['lastpostdate'] != $data['realdate']) {
            if ($data['lastpostdate'] == "0" && $data['realdate'] == NULL) {
                $status = "<font color=#ff8888>Broken thread</font>";
            } else {
                $userd = mysql_fetch_array(mysql_query("SELECT `date`, `user` FROM `posts` WHERE `thread` = '" . $data['id'] . "' ORDER BY `date` DESC LIMIT 1"), MYSQL_ASSOC);
                $status = mysql_query("UPDATE `threads` SET `lastposter` = '" . $userd['user'] . "', `lastpostdate` = '" . $userd['date'] . "' WHERE `id` = '" . $data['id'] . "'") or "<font color=#ff0000>Error</font>: " . mysql_error();
                if ($status == 1) {
                    $status = "<font color=#80ff80>Updated</font>";
                }
                $count++;
            }
        }
        if ($status) {
            print "\r\n\t\t\t<tr>\r\n\t\t\t\t{$tccell1}>" . $data['id'] . "</td>\r\n\t\t\t\t{$tccell2l}><a href=\"thread.php?id=" . $data['id'] . "\">" . $data['title'] . "</a></td>\r\n\t\t\t\t{$tccell1}>" . ($data['lastpostdate'] ? date($dateformat, $data['lastpostdate'] + $tzoff) : "-") . "</td>\r\n\t\t\t\t{$tccell1}>" . ($data['realdate'] ? date($dateformat, $data['realdate'] + $tzoff) : "-") . "</td>\r\n\t\t\t\t{$tccell1}>" . timeunits2($data['lastpostdate'] - $data['realdate']) . "</td>\r\n\t\t\t\t{$tccell2l}>{$status}</td>\r\n\t\t\t</tr>";
        }
    }
    if ($count) {
        print "<tr>{$tccellc} colspan=6>{$count} thread" . ($count != 1 ? "s" : "") . " updated.</td></tr>";
    } else {
        print "<tr>{$tccellc} colspan=6>Nothing to repair.</td></tr>";
    }
}
print "{$tblend}\r\n\t{$footer}\r\n\t";
printtimedif($startingtime);
Example #5
0
    $column2 = "PMs";
    $stat = "who you've sent the most messages to";
    $linklist[2] = "PMs sent by you";
} else {
    $posters = $sql->query("{$query}, posts WHERE posts.user=users.id" . ($tid ? " AND thread='{$tid}'" : '') . ($time ? " AND posts.date> '" . (ctime() - $time) . "'" : '') . $endp);
    $desc = "Most active posters";
    $column = "Posts";
    $column2 = "posts";
    $stat = "most active posters";
    $linklist[0] = "posts made";
    $type = '';
}
$link = '<a href=' . ($type ? "?type={$type}&" : '?') . 'time';
print "\n\t\t{$header}\n\t\t{$tblstart}\n\t\t<td align=left width=50%>{$smallfont}\n\t\t\tShow {$stat} in the:\n\t\t\t<br>{$link}=3600>last hour</a> - {$link}=86400>last day</a> - {$link}=604800>last week</a> - {$link}=2592000>last 30 days</a> - {$link}=0>from the beginning</a>\n\t\t</td><td width=50% align=right>{$smallfont}\n\t\tMost active users by:<br>\n\t\t" . implode(" - ", $linklist) . "\n\t\t{$tblend}\n\t";
if ($time) {
    $timespan = " during the last " . timeunits2($time);
} else {
    $timespan = "";
}
/*
	if ($loguser["powerlevel"] >= 1) {
		// Xk will hate me for using subqueries.
			// No, I'll just hate you for adding this period
			// It's like a sore.
			// Also, uh, interesting I guess. The more you know.
		$pcounts        = $sql -> query("
			SELECT
				(SELECT sum(u.posts) FROM users AS u WHERE u.powerlevel >= 1) AS posts_staff,
				(SELECT sum(u.posts) FROM users AS u WHERE u.powerlevel = 0) AS posts_users,
				(SELECT sum(u.posts) FROM users AS u WHERE u.powerlevel = -1) AS posts_banned");
Example #6
0
<?php

require 'lib/function.php';
$windowtitle = "Admin Cruft -- {$boardname}";
require 'lib/layout.php';
print "{$header}<br>";
if (!$isadmin) {
    print "  \n\t\t\t{$tblstart}\n\t\t\t\t{$tccell1}>Uh oh, you are not the admin go away.</td>\n\t\t\t{$tblend}\n\n\t\t{$footer}\n\t\t";
    printtimedif($startingtime);
    die;
}
$misc = $sql->fetchq("SELECT * FROM `misc`");
print adminlinkbar("admin.php") . "\n\t\t{$tblstart}\n\t\t\t<tr>{$tccellh}><b>Panel de Admin<br></td></tr>\n\t\t\t<tr>{$tccell1}>&nbsp;\n\t\t\t\t<br>Under construction for\n\t\t\t\t<br><b>" . timeunits2(time() - mktime(19, 20, 21, 9, 27, 2007)) . "</b>\n\t\t\t\t<br>...and counting!\n\t\t\t\t<br>&nbsp;\n\t\t\t</td></tr>\n\t\t{$tblend}\n\n\t\t<br>\n\t\t\n\t\t<form action='admin.php' method='post'>\n\t\t{$tblstart}\n\t\t\t<tr>{$tccellh} colspan=2><b>Setting up the Soft Dip</b></td></tr>\n\t\t\t<tr>{$tccellc} colspan=2>Board settings</td></tr>\n\n\t\t\t<tr>{$tccell1} width='200'><b>" . $statusicons['hot'] . " threshold</b></td>\n\t\t\t\t{$tccell2l}>\t{$inpt}='hotcount' value='" . $misc['hotcount'] . "' class='right'> replies\n\t\t\t\t\t\t\t{$inph}='hotcount_' value='" . $misc['hotcount'] . "'>\n\t\t\t\t</td></tr>\n\n\t\t\t<tr>{$tccell1} width='200'><b>Disable forum?</b></td>\n\t\t\t\t{$tccell2l}>\t{$inpc}='disable' value='1'> Disable\n\t\t\t\t</td></tr>\n\n\n\t\t\t<tr>{$tccellc} colspan=2>Records</td></tr>\n\n\t\t\t<tr>{$tccell1} width='200'><b>View count</b></td>\n\t\t\t\t{$tccell2l}>\t{$inpt}='views' value='" . $misc['views'] . "' class='right'> views\n\t\t\t\t\t\t\t{$inph}='views' value='" . $misc['views'] . "'>\n\t\t\t\t</td></tr>\n\n\n\t\t\t<tr>{$tccell1} width='200'><b>Max posts/day</b></td>\n\t\t\t\t{$tccell2l}>\t{$inpt}='maxpostsday' value='" . $misc['maxpostsday'] . "' class='right'> posts, at {$inpt}='maxpostsdaydate' value='" . $misc['maxpostsdaydate'] . "' class='right'>\n\t\t\t\t\t\t\t{$inph}='maxpostsday' value='" . $misc['maxpostsday'] . "'>{$inph}='maxpostsdaydate' value='" . $misc['maxpostsdaydate'] . "'>\n\t\t\t\t</td></tr>\n\n\t\t\t<tr>{$tccell1} width='200'><b>Max posts/hour</b></td>\n\t\t\t\t{$tccell2l}>\t{$inpt}='maxpostshour' value='" . $misc['maxpostshour'] . "' class='right'> posts, at {$inpt}='maxpostshourdate' value='" . $misc['maxpostshourdate'] . "' class='right'>\n\t\t\t\t\t\t\t{$inph}='maxpostshour' value='" . $misc['maxpostshour'] . "'>{$inph}='maxpostshourdate' value='" . $misc['maxpostshourdate'] . "'>\n\t\t\t\t</td></tr>\n\n\t\t\t<tr>{$tccell1} width='200'><b>Most users online</b></td>\n\t\t\t\t{$tccell2l}>\t{$inpt}='maxusers' value='" . $misc['maxusers'] . "' class='right'> users, at {$inpt}='maxusersdate' value='" . $misc['maxusersdate'] . "' class='right'>\n\t\t\t\t\t\t\t<br>{$inpc}='maxusersreset' value='1'> Reset user list\n\t\t\t\t\t\t\t{$inph}='maxusers' value='" . $misc['maxusers'] . "'>{$inph}='maxusersdate' value='" . $misc['maxusersdate'] . "'>\n\t\t\t\t</td></tr>\n\n\t\n\t\t\t<tr>{$tccellc} colspan=2><img src=\"images/ihateglennbeckbutistillthinkthisimagefitsquitenicelyundertheadminpanelmoneycounter.jpg\" title=\"longest file name ever\"><br>Monetary settings</td></tr>\n\n\t\t\t<tr>{$tccell1} width='200'><b>Donations</b></td>\n\t\t\t\t{$tccell2l}>\t{$inpt}='donations' value='" . sprintf("%01.2f", $misc['donations']) . "' class='right'>\$\n\t\t\t\t\t\t\t{$inph}='donations' value='" . sprintf("%01.2f", $misc['donations']) . "'>\n\t\t\t\t</td></tr>\n\n\t\t\t<tr>{$tccell1} width='200'><b>\$\$\$ Ads \$\$\$</b></td>\n\t\t\t\t{$tccell2l}>\t{$inpt}='ads' value='" . sprintf("%01.2f", $misc['ads']) . "' class='right'>\$\n\t\t\t\t\t\t\t{$inph}='ads' value='" . sprintf("%01.2f", $misc['ads']) . "'>\n\t\t\t\t</td></tr>\n\n\n\t\t\t<tr>{$tccellc} colspan=2>&nbsp;</td></tr>\n\n\t\t\t<tr>{$tccell1} width='200'>&nbsp;</td>\n\t\t\t\t{$tccell2l}>\t{$inps}='submit' value='Submit changes'>\n\t\t\t\t<br><s><strong>(Only saves the money settings though.)</strong></s> just kidding, it doesn't work.\n\t\t\t\t</td></tr>\n\n\t\t\n\t\t{$tblend}\n\t\t</form>\n\n\t";
print "{$footer}";
printtimedif($startingtime);
// returns several field names with hours/date/time all set up and that jazz etc blah blah blah
function timetofields($fname, $time)
{
    return;
}