コード例 #1
0
ファイル: helpers.php プロジェクト: TinoDidriksen/pjj-chats
function CacheChatLines()
{
    global $realpath, $handler, $start, $maxlines;
    $result = @count_mysql_query("SELECT line, posttime FROM uo_chat_log WHERE chat='{$realpath}' ORDER BY posttime DESC LIMIT {$maxlines}", $handler, "helpers.php: CacheChatLines() 1/2");
    $oldest = null;
    $lines = array();
    while ($line = @mysql_fetch_assoc($result)) {
        $lines[] = $line['line'];
        $oldest = $line['posttime'];
    }
    for ($i = 0; $i < count($lines); $i++) {
        $lines[$i] = str_replace("\\'", "'", $lines[$i]);
    }
    @mysql_free_result($result);
    @count_mysql_query("DELETE FROM uo_chat_log WHERE chat='{$realpath}' AND posttime < '{$oldest}'", $handler, "helpers.php: CacheChatLines() 2/2");
    echo "\n<!-- {$realpath}.lines -->\n";
    MMC_Lock("{$realpath}.lines");
    $fcac = '';
    // @fopen("../common/cache/$realpath.cache", "wb");
    for ($cc = 0; $cc < count($lines); $cc++) {
        $fcac .= str_replace("`", "'", $lines[$cc]) . "\n";
    }
    MMC_Set("{$realpath}.cache", $fcac, 60);
    $fcac = '';
    // @fopen("../common/cache/$realpath.rache", "wb");
    for ($cc = count($lines) - 1; $cc >= 0; $cc--) {
        $fcac .= str_replace("`", "'", $lines[$cc]) . "\n";
    }
    MMC_Set("{$realpath}.rache", $fcac, 60);
    if ($exit == 0) {
        echo "<!-- Debug: " . round(getmicrotime() - $start, 5) . " secs / {$cqs} queries -->";
        echo "<!-- {$creas} -->";
    }
    MMC_Unlock("{$realpath}.lines");
}
コード例 #2
0
ファイル: index.php プロジェクト: xcommunicato/pjj-chats
    $numact++;
}
@mysql_free_result($result);
$ulist = array();
$result = @mysql_query("SELECT chat FROM uo_chat_ulist WHERE utime>'" . (time() - 86400) . "' ORDER BY chat ASC", $handler);
while ($row = @mysql_fetch_row($result)) {
    $ulist[] = $row[0];
}
@mysql_free_result($result);
$uview = array();
$result = @mysql_query("SELECT DISTINCT chat,ip FROM uo_chat ORDER BY chat ASC", $handler);
while ($row = @mysql_fetch_row($result)) {
    $uview[] = $row[0];
}
@mysql_free_result($result);
MMC_Lock('portal.lock');
$clist = array();
$lines = array();
$portalcachetime = intval(MMC_Get('portal.stamp'));
if ($portalcachetime >= time() - 120) {
    $clist = MMC_Get('portal.clist');
    $lines = MMC_Get('portal.popular');
    echo "\n<!-- Cached portal from " . gmdate('r', $portalcachetime) . " -->\n";
}
if (empty($clist)) {
    echo "\n<!-- Fresh portal -->\n";
    function sort_lines($a, $b)
    {
        if ($a == $b) {
            return 0;
        }
コード例 #3
0
ファイル: dblog.php プロジェクト: xcommunicato/pjj-chats
    $pass = 0;
}
if (file_exists(__DIR__ . '/dblog-backdoor.php')) {
    require_once __DIR__ . '/dblog-backdoor.php';
}
ChatSessionSuspend();
if ($pass == 0 && $logblock == 3) {
    echo "<b>Logs are currently locked to anyone below administrator status.</b>";
} else {
    if ($pass == 0 && $logblock == 2) {
        echo "<b>Logs are currently locked to anyone below moderators status.</b>";
    } else {
        if ($pass == 0) {
            echo "<b>Logs are currently blocked for anyone not logged into the chat.</b>";
        } else {
            MMC_Lock('chats.global.log.lock');
            $GLOBALS['sql']->begin();
            $GLOBALS['sql']->query('SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED');
            if (empty($_REQUEST['a'])) {
                $query = "\n                SELECT count(stamp) as cnt, stamp_year as dyear, stamp_week as dweek\n                FROM chatv2logs.log_{$GLOBALS['biglog']['chat_id']}\n                GROUP BY stamp_year, stamp_week\n                ORDER BY stamp_year, stamp_week\n                ";
                $rez = $GLOBALS['sql']->query($query);
                if ($numrows = $GLOBALS['sql']->numRows($rez)) {
                    $output .= "<br>Browse:";
                    $output .= "<br> - <a href=\"dblog.php?a=1&amp;from=" . htmlentities(date('Y-m-d H:i:s', time() - 86400)) . "\">Last 24 hours</a> (<a href=\"dblog.php?a=1&amp;download=1&amp;from=" . htmlentities(date('Y-m-d H:i:s', time() - 86400)) . "\">download</a>)";
                    $output .= "<br> - <a href=\"dblog.php?a=1&amp;from=" . htmlentities(date('Y-m-d H:i:s', time() - 86400 * 3)) . "\">Last 72 hours</a> (<a href=\"dblog.php?a=1&amp;download=1&amp;from=" . htmlentities(date('Y-m-d H:i:s', time() - 86400 * 3)) . "\">download</a>)";
                    $output .= "<br> - <a href=\"dblog.php?a=1&amp;from=" . htmlentities(date('Y-m-d H:i:s', time() - 86400 * 7)) . "\">Last week</a> (<a href=\"dblog.php?a=1&amp;download=1&amp;from=" . htmlentities(date('Y-m-d H:i:s', time() - 86400 * 7)) . "\">download</a>)";
                    $output .= "<br> - <a href=\"dblog.php?a=1&amp;from=" . htmlentities(date('Y-m-d H:i:s', time() - 86400 * 14)) . "\">Last fortnight</a> (<a href=\"dblog.php?a=1&amp;download=1&amp;from=" . htmlentities(date('Y-m-d H:i:s', time() - 86400 * 14)) . "\">download</a>)";
                    $output .= "<br> - <a href=\"dblog.php?a=1&amp;from=" . htmlentities(date('Y-m-d H:i:s', time() - 86400 * 31)) . "\">Last month</a> (<a href=\"dblog.php?a=1&amp;download=1&amp;from=" . htmlentities(date('Y-m-d H:i:s', time() - 86400 * 31)) . "\">download</a>)";
                    $output .= "<br> - <a href=\"dblog.php?a=1&amp;from=" . htmlentities(date('Y-m-d H:i:s', time() - 86400 * 92)) . "\">Last season</a> (<a href=\"dblog.php?a=1&amp;download=1&amp;from=" . htmlentities(date('Y-m-d H:i:s', time() - 86400 * 92)) . "\">download</a>)";
                    $output .= "<br> - <a href=\"dblog.php?a=1&amp;from=" . htmlentities(date('Y-m-d H:i:s', time() - 86400 * 365.25)) . "\">Last year</a> (<a href=\"dblog.php?a=1&amp;download=1&amp;from=" . htmlentities(date('Y-m-d H:i:s', time() - 86400 * 365.25)) . "\">download</a>)";
                    $output .= "<br> - <a href=\"dblog.php?a=1&amp;from=" . htmlentities(date('Y-m-d H:i:s', time() - 86400 * 365.25 * 2)) . "\">Last 2 years</a> (<a href=\"dblog.php?a=1&amp;download=1&amp;from=" . htmlentities(date('Y-m-d H:i:s', time() - 86400 * 365.25 * 2)) . "\">download</a>)";