示例#1
0
ob_start();
/*
DROP TABLE IF EXISTS tmpa ;
CREATE TABLE tmpa AS SELECT T.* FROM uo_chat_threads as T LEFT JOIN uo_chat_boards as B ON (T.id=B.uid) WHERE flags IS NOT NULL ;
TRUNCATE uo_chat_threads ;
INSERT INTO uo_chat_threads SELECT * FROM tmpa ;
//*/
/*
	if ($_SERVER['REMOTE_ADDR'] != '62.198.254.119') {
		header('HTTP/1.0 403 Temporarily Disabled');
	    die ('Temporarily disabled due to spam overload.');
	}
	//*/
if (!empty($_REQUEST) && !empty($_REQUEST['post'])) {
    require_once '../../../chatv3/_inc/mmcache.php';
    $last = intval(MMC_Get('jbb.' . $_SERVER['REMOTE_ADDR']));
    MMC_Set('jbb.' . $_SERVER['REMOTE_ADDR'], max(time(), $last) + 10);
    if (time() < $last) {
        header('HTTP/1.0 403 Too Soon');
        die('You cannot post again that fast.');
    }
    sleep(2);
}
set_magic_quotes_runtime(0);
if (get_magic_quotes_gpc()) {
    foreach ($_REQUEST as $key => $value) {
        $_REQUEST[$key] = stripslashes($value);
    }
    foreach ($_COOKIE as $key => $value) {
        $_COOKIE[$key] = stripslashes($value);
    }
示例#2
0
    $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;
        }
        return $a < $b;
    }
    $rez = $GLOBALS['sql']->query("SELECT chat_id, chat\n\t\t\tFROM chatv2.chats WHERE (ctime < now() - INTERVAL '1 month' OR ctime IS NULL)\n\t\t\tAND utime > now() - INTERVAL '1 month' AND dtime IS NULL\n\t\t\tORDER BY chat_id ASC");
    $num = $GLOBALS['sql']->numRows($rez);
    if (empty($num)) {
        die('Empty.');
示例#3
0
function GenerateXML($last = 0, $info = 0)
{
    global $realpath, $handler, $maxlines, $ctitle, $nview;
    header('Content-Type: text/xml');
    $rez = count_mysql_query("SELECT UNIX_TIMESTAMP(MAX(posttime)) as stamp FROM uo_chat_log WHERE chat='{$realpath}'", $handler, "reader.php: GenerateXML() 1/1");
    $row = mysql_fetch_assoc($rez);
    mysql_free_result($rez);
    if (!empty($last) && $last >= intval($row['stamp'])) {
        header('HTTP/1.1 304 Not Modified');
        die;
    }
    //	$last = 0;
    $last = intval(MMC_Get($realpath . '.xml.last'));
    if (empty($info) && !empty($last) && $last >= intval($row['stamp'])) {
        $output = MMC_Get($realpath . '.xml.output');
        if (!empty($output)) {
            echo $output;
            echo '<!-- cached version -->', "\n";
            die;
        }
    }
    MMC_Set($realpath . '.xml.last', intval($row['stamp']), 900);
    $tz = date('Z');
    $path = mb_substr($realpath, 4);
    $rez = @count_mysql_query("SELECT count(chat) FROM uo_chat_ulist WHERE chat='{$realpath}' AND utime>" . (time() - 300) . "", $handler, "reader.php: GenerateXML() 1/1");
    $active = mysql_fetch_row($rez);
    $active = intval($active[0]);
    mysql_free_result($rez);
    $rez = @count_mysql_query("SELECT count(chat) FROM uo_chat_ulist WHERE chat='{$realpath}'", $handler, "reader.php: GenerateXML() 1/1");
    $chatters = mysql_fetch_row($rez);
    $chatters = intval($chatters[0]);
    mysql_free_result($rez);
    $output = '';
    $output .= '<' . '?xml version="1.0" encoding="UTF-8"?' . ">\n";
    $xinfo = <<<XMLEND
<info>
\t<chat>{$path}</chat>
\t<title>{$ctitle}</title>
\t<lastpost>{$row['stamp']}</lastpost>
\t<timezone>{$tz}</timezone>
\t<viewers>{$nview}</viewers>
\t<chatters>{$chatters}</chatters>
\t<active>{$active}</active>
</info>
XMLEND;
    if (!empty($info)) {
        echo $output;
        echo $xinfo;
        return;
    }
    $output .= <<<XMLEND
<reader>
\t{$xinfo}
\t<lines>
XMLEND;
    $rez = @count_mysql_query("SELECT\n\t\tUNIX_TIMESTAMP(posttime) as stamp,ident,username,line,rawpost,\n\t\txmlpost,color\n\t\tFROM uo_chat_log\n\t\tWHERE\n\t\tchat='{$realpath}'\n\t\tORDER BY posttime DESC LIMIT {$maxlines}\n\t\t", $handler, "reader.php: GenerateXML() 1/1");
    for ($i = 0; $row = mysql_fetch_assoc($rez); $i++) {
        $row['line'] = EncodeLtGt($row['line']);
        $row['rawpost'] = EncodeLtGt($row['rawpost']);
        $row['xmlpost'] = EncodeLtGt($row['xmlpost']);
        $output .= <<<XMLEND

\t\t<line>
\t\t\t<id>{$i}</id>
\t\t\t<ident>{$row['ident']}</ident>
\t\t\t<color>#{$row['color']}</color>
\t\t\t<username>{$row['username']}</username>
\t\t\t<posttime>{$row['stamp']}</posttime>
\t\t\t<fullpost>{$row['line']}</fullpost>
\t\t\t<rawpost>{$row['rawpost']}</rawpost>
\t\t\t<post>{$row['xmlpost']}</post>
\t\t</line>
XMLEND;
    }
    $output .= <<<XMLEND

\t</lines>
</reader>

XMLEND;
    echo $output;
    echo '<!-- generated fresh -->', "\n";
    MMC_Set($realpath . '.xml.output', $output, 900);
}