=0;$cc--) { $fcac .= str_replace("´", "'", $lines[$cc])."\n"; } MMC_Set("$realpath.rache", $fcac, 60); echo "\n\n"; } function EncodeLtGt($str) { $str = html_entity_decode($str, ENT_NOQUOTES); $str = html_entity_decode($str, ENT_NOQUOTES); $str = str_replace('&', '&', $str); $str = str_replace('<', '<', $str); $str = str_replace('>', '>', $str); return $str; } function GenerateXML($last=0) { global $realpath, $handler, $master_zlib, $ctitle, $nview; $rez = @count_mysql_query("SELECT UNIX_TIMESTAMP(posttime) as stamp FROM uo_chat_log WHERE chat='$realpath' ORDER BY posttime DESC LIMIT 1", $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(); } header('Content-Type: text/xml'); // $last = 0; $last = MMC_Get("$realpath.xml.last"); if (!empty($last) && $last >= intval($row['stamp'])) { $output = MMC_Get("$realpath.xml.output"); if (!empty($output)) { echo $output; echo "\n"; die(); } } MMC_Set("$realpath.xml.last", intval($row['stamp']), 900); $tz = date('Z'); $path = 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="ISO-8859-15"?'.">\n"; $output .= << {$path} {$ctitle} {$row['stamp']} {$tz} {$nview} {$chatters} {$active} XMLEND; $rez = @count_mysql_query("SELECT UNIX_TIMESTAMP(posttime) as stamp,ident,username,line,rawpost, xmlpost,id,color FROM uo_chat_log WHERE chat='$realpath' ORDER BY id ASC, posttime DESC ", $handler, "reader.php: GenerateXML() 1/1"); while ($row = mysql_fetch_assoc($rez)) { $row['line'] = EncodeLtGt(gzuncompress($row['line'])); $row['rawpost'] = EncodeLtGt($row['rawpost']); $row['xmlpost'] = EncodeLtGt($row['xmlpost']); $output .= << {$row['id']} {$row['ident']} #{$row['color']} {$row['username']} {$row['stamp']} {$row['line']} {$row['rawpost']} {$row['xmlpost']} XMLEND; } $output .= << XMLEND; echo $output; echo "\n"; MMC_Set("$realpath.xml.output", $output, 900); } require_once("../common/session.php"); require_once("../../chatv3/_inc/mmcache.php"); require_once("../mysql.php"); require_once("../setup.php"); require_once("settings.php"); require_once("../common/helpers.php"); require_once("../std_uo.php"); require_once("options.php"); require_once("../common/banhelp.php"); require_once("../common/ignore.php"); require_once("../common/lastmsg.php"); require_once("../common/proxy.php"); require_once("../common/language.php"); if (file_exists("language.php")) require_once("language.php"); if ($dtcalc == "") $dtcalc = "g:ia, F d (T)"; $realpath = ereg_replace(".*/([^/]+)/reader.php$", 'chat\1', $_SERVER['PHP_SELF']); if (($_SERVER['HTTP_HOST'] != 'v2.pjj.cc') && strstr($_SERVER['HTTP_HOST'], '.pjj.cc')) $realpath = preg_replace('/(.*?)\.pjj\.cc/is', 'chat\1', $_SERVER['HTTP_HOST']); MMC_Lock("$realpath.lines"); if ($altdata != "") $chatpath = $altdata; else $chatpath = $realpath; $inlinemsg = "

This chat has no valid Master Email contact. Please provide one in Settings.

"; if (strstr($cadmin, "@") && strstr($cadmin, ".")) $inlinemsg = ""; //$bannertest = "

Is this annoying?

\n"; $bannertest = ""; if (!$_REQUEST['cspeed']) $_REQUEST['cspeed'] = "default"; if ($_REQUEST['cspeed'] != "default") $respeed = $_REQUEST['cspeed']; $ident = substr(md5($_SERVER['REMOTE_ADDR'].$realpath), 0, $identlenght); $xcnt = count($banip); for ($cc=0;$cc<$xcnt;$cc++) { if ( ($ident == $banip[$cc]) || (strncmp($_SERVER['REMOTE_ADDR'], $banip[$cc], strlen($banip[$cc])) == 0) || (strncmp($_SERVER['HTTP_X_FORWARDED_FOR'], $banip[$cc], strlen($banip[$cc])) == 0) ) { echo "$cbodytag"; echo sprintf($banguage[4], $ident); echo ""; exit(); } else if (strpos($banip[$cc], '.') !== false || strpos($banip[$cc], '*') !== false) { $banip[$cc] = str_replace('\\*', '.*', preg_quote($banip[$cc])); if (preg_match('/^'.$banip[$cc].'$/is', gethostbyaddr($_SERVER['REMOTE_ADDR']))) { echo "\n$cbodytag"; echo sprintf($banguage[4], $ident); echo ""; exit(); } } } if ($_REQUEST['msgs'] != 1 && empty($_REQUEST['xml'])) { $random = mt_rand(1,9999999); $down = (($_REQUEST['reverse'] == "on") ? ("#down") : ("")); echo "\n"; echo <<

{$ctitle} {$bodytag} HEADER; $oldident = $ident; if ($_COOKIE['pJJChat_Banned'] != "") { $ident = $_COOKIE['pJJChat_Banned']; } if (CheckBan($ident, $chatpath) == 0) { $ident = $oldident; if ($proxyblock == 1) { $bl = Proxy_IsProxy($_SERVER['REMOTE_ADDR']); if ($bl !== false) { echo "This chat blocks open proxies, and you are using one. You have been banned for 8 hours."; echo "
The list that caught you is: $bl"; echo ""; AddBan($ident, time()+28800, '[proxy]', $chatpath); setcookie("pJJChat_Banned", "$ident", time()+604800); die(); } } UpdateViewers($realpath); $nview = GetViewers($realpath); if ($_REQUEST['reverse'] == "on") { echo $bannertest; // Testing } if (($memonly <= 1) || CheckFlags('1', $_SESSION[$realpath]['flags'])) { echo "
"; if ($logofile != '') echo ""; if ((file_exists('register/motd.dat')) && ($_REQUEST['motd'] == 'on')) { ParseMotD(); echo "

"; } else echo "
"; if ($_COOKIE['pJJChat_NoColor'] == "on") { echo ""; } readfile("../announce.dat"); echo ""; if ($_COOKIE['pJJChat_Styled'] != "") { echo "\n"; } if ($_REQUEST['reverse'] == "on") { $lines = MMC_Get("$realpath.rache"); if (empty($lines)) { CacheChatLines(); $lines = MMC_Get("$realpath.rache"); } if ($_COOKIE['pJJChat_NoColor'] == "on") { echo str_replace("color=", "", $lines); unset($lines); } else { echo $lines; } echo $inlinemsg; } else if (!CheckAnyIgnore($realpath, $ident)) { echo $inlinemsg; $lines = MMC_Get("$realpath.cache"); if (empty($lines)) { CacheChatLines(); $lines = MMC_Get("$realpath.cache"); } if ($_COOKIE['pJJChat_NoColor'] == "on") { echo str_replace("color=", "", $lines); unset($lines); } else { echo $lines; } } else { $result = count_mysql_query("SELECT ident,line,username FROM uo_chat_log WHERE chat='$realpath' ORDER BY id ASC", $handler); while($line = mysql_fetch_assoc($result)) { $line['line'] = stripslashes(gzuncompress($line['line'])); if (!CheckIgnore($line['ident'])) { if ($pJJChat_NoColor == "on") $line['line'] = str_replace("color=", "", $line['line']); echo str_replace("", "'", $line['line']); } } mysql_free_result($result); } if ($lastpos > 0) { echo "

"; echo $timer; echo date($dtcalc, GetLastMsg($realpath)+($tzone*3600)); echo " ($nview)"; } } else { echo $language[0]; } setcookie("pJJChat_Banned", "", 0); echo ""; echo ""; echo ""; if ($_REQUEST['reverse'] != "on") { echo $bannertest; // Testing } } else { setcookie("pJJChat_Banned", "$ident", time()+604800); echo $language[12]; echo $bannertest; // Testing } } else if (!empty($_REQUEST['xml'])) { $_REQUEST['handle'] = strtolower(ereg_replace($master_name_filter, '', $_REQUEST['handle'])); $userlevel = ChatVerifyLogin($_REQUEST['handle'], $_REQUEST['password'], $chatpath); if (($xml_anon == 1 && $memonly <= 1) || $userlevel > 0) { UpdateViewers($realpath); $nview = GetViewers($realpath); GenerateXML(intval($_REQUEST['lastpost'])); die(); } else { header('HTTP/1.1 403 Access Denied'); die(); } } else { $_REQUEST['handle'] = strtolower(ereg_replace($master_name_filter, '', $_REQUEST['handle'])); echo "Messages for {$_REQUEST['handle']}
"; echo ""; $userlevel = ChatVerifyLogin($_REQUEST['handle'], $_REQUEST['password'], $chatpath); $db_table = "uo_chat_message"; if ($userlevel > 0) { if ($_REQUEST['cleanmsg'] == 1) { @mysql_query("UPDATE $db_table SET deleted='yes' WHERE username='{$_REQUEST['handle']}' AND chat='$chatpath' AND unread='no'", $handler); } else { @mysql_query("UPDATE $db_table SET unread='no' WHERE username='{$_REQUEST['handle']}' AND chat='$chatpath'", $handler); } echo "Back to chat

"; echo ""; // @mysql_query("DELETE FROM $db_table WHERE utime<'".(time()-2419200)."'", $handler); $result = @mysql_query("SELECT chat,username,msg,auth,utime FROM $db_table WHERE username='{$_REQUEST['handle']}' AND chat='$chatpath' AND deleted='no' ORDER BY utime DESC", $handler); while ($msg = mysql_fetch_row($result)) { echo ""; } mysql_free_result($result); echo "
FromMessageTime
$msg[3]$msg[2]".date($dtcalc, $msg[4])."

Back to chat"; echo $bannertest; // Testing } else { echo $banguage[5]; echo $bannertest; // Testing } } MMC_Unlock("$realpath.lines"); ?>