Example #1
0
function GetFactionIcon($chatpath, $faction)
{
    global $handler;
    $faction = intval($faction);
    $result = count_mysql_query("SELECT icon FROM uo_chat_faction WHERE id={$faction} AND chat='{$chatpath}'", $handler);
    if (mysql_num_rows($result) && ($row = mysql_fetch_row($result))) {
        return $row[0];
    }
    mysql_free_result($result);
    return NULL;
}
Example #2
0
function GetViewers($pid)
{
    global $handler;
    $pid = trim($pid);
    $numview = 0;
    if (mt_rand(0, 10) == 5) {
        @count_mysql_query("DELETE FROM uo_chat WHERE utime<'" . (time() - 300) . "'", $handler, "std_uo.php: GetViewers() 1/2");
    }
    $result = @count_mysql_query("SELECT DISTINCT ip FROM uo_chat WHERE chat='{$pid}' AND utime>'" . (time() - 300) . "'", $handler, "std_uo.php: GetViewers() 2/2");
    $numview = @mysql_numrows($result);
    @mysql_free_result($result);
    return $numview;
}
Example #3
0
    $urlblock = $logblock;
}
if (!empty($altdata)) {
    $chatpath = $altdata;
} else {
    $chatpath = ereg_replace(".*/([^/]+)/gui_opt.php\$", "chat\\1", $_SERVER['PHP_SELF']);
    if ($_SERVER['HTTP_HOST'] != 'v2.pjj.cc' && strstr($_SERVER['HTTP_HOST'], '.pjj.cc')) {
        $chatpath = preg_replace('/(.*?)\\.pjj\\.cc/is', 'chat\\1', $_SERVER['HTTP_HOST']);
    }
}
$fn = "options.php";
$flags = ChatVerifyLogin($_REQUEST['login'], $_REQUEST['password'], $chatpath);
$bing = GetChatPrefs($chatpath);
if (!empty($message) && CheckFlags("oXZmM", $flags)) {
    @count_mysql_query("DELETE FROM uo_chat_adminlog WHERE stamp<DATE_SUB(now(), INTERVAL 28 DAY)", $handler);
    @count_mysql_query("INSERT INTO uo_chat_adminlog\n\t\t\t(page_id,chat_id,user_id,user_ip,stamp)\n\t\t\tVALUES (\n\t\t\t2,\n\t\t\t{$GLOBALS['biglog']['chat_id']},\n\t\t\t{$GLOBALS['biglog']['user_id']},\n\t\t\t'{$_SERVER['REMOTE_ADDR']}',\n\t\t\tnow()\n\t\t\t)", $handler);
    $fi = fopen($fn, "w");
    if (!$fi) {
        die("An error occured trying to write to the file.");
    }
    fwrite($fi, "<?php\n\$banwords = array (\n");
    for ($cc = 0; $cc < count($_REQUEST['iname']); $cc++) {
        if (trim($_REQUEST['iname'][$cc]) != "") {
            fwrite($fi, var_export(stripslashes(trim($_REQUEST['iname'][$cc])), true) . " => " . var_export(stripslashes(trim($_REQUEST['ifile'][$cc])), true) . ",\n");
        }
    }
    fwrite($fi, ");\n\$images = array(\n");
    for ($cc = 0; $cc < count($_REQUEST['images']); $cc++) {
        fwrite($fi, "\"" . trim($_REQUEST['images'][$cc]) . "\",\n");
    }
    fwrite($fi, ");\n\$jbbc = array(\n");
Example #4
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);
}
Example #5
0
 }
 echo "</td>\n\n<td valign=top align=right>\n<!-- <a href='register/viewer.php' target=_blank><img alt='Profiles' src='{$images['9']}' border=0></a><br> -->\n<img src='{$images['14']}' border=0><br>";
 //*
 if (!empty($_SESSION[$realpath]['user']['uid'])) {
     $result = @count_mysql_query("SELECT count(*) as cnt FROM uo_chat_message WHERE rcpt_uid=" . $_SESSION[$realpath]['user']['uid'] . " AND archived='no'", $handler, "sendmsg.php: Check 'private msg' 1/1");
     $nmsg = mysql_fetch_assoc($result);
     $rmsg = intval($nmsg['cnt']);
     mysql_free_result($result);
     $result = @count_mysql_query("SELECT count(*) as cnt FROM uo_chat_message WHERE rcpt_uid=" . $_SESSION[$realpath]['user']['uid'] . " AND unread='yes'", $handler, "sendmsg.php: Check 'private msg' 1/1");
     $nmsg = mysql_fetch_assoc($result);
     $umsg = intval($nmsg['cnt']);
     mysql_free_result($result);
     if (!empty($umsg)) {
         echo '[<span style="color: #ff0000;">', $umsg, '</span>] ';
     }
     $result = @count_mysql_query("SELECT count(*) as cnt FROM uo_chat_message WHERE rcpt_uid=" . $_SESSION[$realpath]['user']['uid'] . " AND archived='yes'", $handler, "sendmsg.php: Check 'private msg' 1/1");
     $nmsg = mysql_fetch_assoc($result);
     $amsg = intval($nmsg['cnt']);
     mysql_free_result($result);
     $button = "<img alt='{$umsg}/{$rmsg}/{$amsg}  unread/read/archived messages' src='{$images[6]}' border=0>";
     if (!preg_match('@^(ht|f)tps?://@ui', $images[6])) {
         $button = $images[6];
     }
     echo "<a href='reader.php?p=msgs&uid=", $_SESSION[$realpath]['user']['uid'], "' target='TextWindow' title='", $umsg, "/", $rmsg, "/", $amsg, " unread/read/archived messages'>{$button}</a>";
     echo "<br><img src='", $images[14], "' border=0><br>";
 }
 //*/
 if (!empty($musiclink)) {
     $button = "<img alt='Misc' src='{$images[7]}' border=0>";
     if (!preg_match('@^(ht|f)tps?://@ui', $images[7])) {
         $button = $images[7];
Example #6
0
function ClearIgnore($userident, $chatpath)
{
    global $handler;
    @count_mysql_query("DELETE FROM uo_chat_ignore WHERE chat='{$chatpath}' AND auth='{$userident}'", $handler, "ignore.php: ClearIgnore() 1/1");
}
Example #7
0
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");
}
Example #8
0
 if (!empty($regadmcom)) {
     $regadmcom = $GLOBALS['sql']->escapeString($regadmcom);
     $GLOBALS['sql']->query("UPDATE chatv2.chats SET regnotes='{$regadmcom}' WHERE chat_id=" . $GLOBALS['biglog']['chat_id']);
     echo "Admin comment edited.<BR>";
 }
 if ($decline) {
     $decline = intval($decline);
     count_mysql_query("UPDATE uo_chat_regapps SET appstat=2 WHERE chat='{$chatpath}' AND id='{$decline}'", $handler);
     $rsubject = "Application for chat {$ctitle} declined";
     $rmessage = "Your application for chat {$ctitle} with the username {$runame}, has been declined and deleted from the database.\n\n" . ucwords($login) . "\nAdministrator of {$ctitle}.";
     mail($rmail, $rsubject, $rmessage, "From: {$master_email}\nReply-To: {$cadmin}\nBCC: {$master_email}\nX-pJJ-IP: {$_SERVER['REMOTE_ADDR']}\nX-pJJ-Chat: https://pjj.cc/{$chatpath}/\nX-pJJ-Auth: {$_REQUEST['login']}\n");
     echo "Declined applicant {$runame}<BR>";
 }
 echo "<a href='login.php?adminaction=regapps&admcomed=edit&login={$login}&password={$password}'>Edit admin comment</a>\n<BR><BR>\n";
 // Applications
 $regapps = count_mysql_query("SELECT id,username,email,faction,rtime,appstat FROM uo_chat_regapps WHERE chat='{$chatpath}' ORDER BY rtime ASC", $handler);
 $rn = $rd = $ra = 0;
 $apps_n = $apps_d = $apps_a = "\t<table cellpadding=2 cellspacing=0 style='border-collapse: collapse'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td style='border: 1px black solid;'>Username</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td style='border: 1px black solid;'>E-Mail</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td style='border: 1px black solid;'>Faction</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td style='border: 1px black solid;'>Applied date</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</tr>";
 while (list($ruid, $rname, $remail, $rfaction, $regtime, $rstat) = mysql_fetch_row($regapps)) {
     $regtime = date("F j, g:i a", $regtime);
     $rfaction = $arr[$rfaction];
     $apps_n .= "<tr>\n";
     $apps_d .= "<tr>\n";
     $apps_a .= "<tr>\n";
     if ($rstat == 0) {
         $rn++;
         $apps_n .= "<td style='border: 1px black solid;'><a href='login.php?adminaction=regapps&ruid={$ruid}&login={$login}&password={$password}'>{$rname}</a></td>\n";
         $apps_n .= "<td style='border: 1px black solid;'>{$remail}</td>\n<td style='border: 1px black solid;'>{$rfaction}</td>\n<td style='border: 1px black solid;'>{$regtime}</td>\n</tr>";
     } elseif ($rstat == 1) {
         $ra++;
         $apps_a .= "<td style='border: 1px black solid;'><a href='login.php?adminaction=regapps&ruid={$ruid}&login={$login}&password={$password}'>{$rname}</a></td>\n";
Example #9
0
     $nu_err = true;
 }
 if (empty($_POST['nu_antispam_q']) || empty($_POST['nu_antispam_a']) || empty($GLOBALS['anti-spam-questions-sha1'][$_POST['nu_antispam_q']]) || $GLOBALS['anti-spam-questions-sha1'][$_POST['nu_antispam_q']] !== $_POST['nu_antispam_a']) {
     print '<div style="color: #CC0000;">Your anti-spam answer was wrong.</div>';
     $nu_err = true;
 }
 if (UserExists($chatpath, $nu_handle) != 0) {
     print '<div style="color: #CC0000;">A user already exists with the chosen handle</div>';
     $nu_err = true;
 }
 if (!$nu_err) {
     $query = sprintf("INSERT INTO uo_chat_regapps SET chat='%s', username='******', email='%s', description='%s', faction=%d, rtime=%d, appstat=%d", $chatpath, $nu_handle, $nu_email, $nu_desc, $nu_faction, time(), 0);
     count_mysql_query($query, $handler);
     $emails = array();
     $query = "SELECT DISTINCT email\r\n\t\t\t\t\tFROM uo_chat_database\r\n\t\t\t\t\tWHERE chat='" . $chatpath . "'\r\n\t\t\t\t\tAND email IS NOT NULL AND email != ''\r\n\t\t\t\t\tAND (flags LIKE BINARY '%m%' OR flags LIKE BINARY '%A%' OR flags LIKE BINARY '%X%' OR flags LIKE BINARY '%Z%')\r\n\t\t\t\t\t";
     $rez = count_mysql_query($query, $handler);
     while ($row = mysql_fetch_assoc($rez)) {
         $row['email'] = mb_strtolower($row['email']);
         if (preg_match('/^[-@.+_\\pL\\pN\\pM]+$/u', $row['email'])) {
             $emails[] = $row['email'];
         }
     }
     mysql_free_result($rez);
     sort($emails);
     $emails = array_unique($emails);
     $chatpath = substr($chatpath, 4);
     $headers = '';
     $headers .= "From: {$master_email}\n";
     $headers .= "BCC: " . implode(', ', $emails) . "\n";
     $headers .= "Reply-To: {$master_email}\n";
     $headers .= "X-pJJ-IP: {$_SERVER['REMOTE_ADDR']}\n";
Example #10
0
function ShowProfile($selecteduser, $chatpath)
{
    global $handler, $master_name_filter, $master_zlib;
    $selecteduser = trim(eregi_replace($master_name_filter, "", strtolower($selecteduser)));
    $rez = @count_mysql_query("SELECT profile FROM uo_chat_database WHERE chat='{$chatpath}' AND username='******' AND profile!='' AND dtime IS NULL", $handler);
    if ($prof = @mysql_fetch_assoc($rez)) {
        if ($prof['profile'][0] != 'x') {
            echo stripslashes($prof['profile']);
        } else {
            echo stripslashes(gzuncompress($prof['profile']));
        }
    } else {
        echo "User {$selecteduser} doesn't have a profile.";
    }
    @mysql_free_result($rez);
}
Example #11
0
require_once "../settings.php";
require_once "../options.php";
require_once "../../common/tome_of_power.php";
$realpath = ereg_replace(".*/([^/]+)/register/adminlog.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']);
}
if (!CheckFlags('MmZX', $_SESSION[$realpath]['flags'])) {
    die('Only administrators can view this page.');
}
$cpref = GetChatPrefs($realpath);
$output = '';
if ($_REQUEST['log'] === 'cpanel') {
    $output = '<pre>' . file_get_contents('wizard_locked/actionlog.log') . '</pre>';
} else {
    $rez = count_mysql_query("SELECT\n\t\t\talog.user_id, dtbs.username, alog.page_id, alog.stamp, alog.user_ip\n\t\t\tFROM uo_chat_adminlog as alog\n\t\t\tLEFT JOIN uo_chat_database as dtbs ON (alog.user_id=dtbs.uid)\n\t\t\tWHERE alog.chat_id={$GLOBALS['biglog']['chat_id']}\n\t\t\tORDER BY alog.entry_id ASC\n\t\t\t", $handler);
    if (mysql_num_rows($rez)) {
        $pages = array(1 => 'Settings', 2 => 'Options', 3 => 'Icons', 4 => 'Language');
        $output .= '<table cellspacing="0" cellpadding="3" border="1">';
        $output .= '<tr valign="top">
				<td><b>Page</b></td>
				<td><b>ID: Username</b></td>
				<td><b>IP</b></td>
				<td><b>Timestamp</b></td>
				</tr>';
        while ($row = mysql_fetch_assoc($rez)) {
            $row['page_id'] = $pages[$row['page_id']];
            $output .= <<<HTMLEND
\t\t\t\t<tr valign="top">
\t\t\t\t<td>{$row['page_id']}</td>
\t\t\t\t<td>{$row['user_id']}: {$row['username']}</td>
Example #12
0
function DeleteGag($userident, $chatpath)
{
    global $handler;
    @count_mysql_query("DELETE FROM uo_chat_gag WHERE (chat='{$chatpath}' AND ident='{$userident}') OR (utime<'" . time() . "')", $handler, "banhelp.php: DeleteGag() 1/1");
}
Example #13
0
<?php

// This file is part of the Project JJ PHP Chat distribution.
// Created and maintained by Tino Didriksen <*****@*****.**>
// The contents of this file is subject to a license.
// Read license.txt and readme.txt for more information.
require_once "mysql.php";
require_once "setup.php";
$base = getcwd() . "/";
//echo "$base<p>";
$rez = count_mysql_query('SELECT DISTINCT chat FROM uo_chat_last', $handler);
$oldumask = umask(0);
while ($row = mysql_fetch_assoc($rez)) {
    $nchat = mb_substr($row['chat'], 4);
    echo $nchat . "<br>\n";
    if ($nchat != "" && $nchat != "_new" && $nchat != $master_chat) {
        if (is_dir($base . $nchat) || mkdir($base . $nchat, 0777)) {
            if (!is_dir($base . $nchat . "/jbb")) {
                echo mkdir($base . $nchat . "/jbb", 0777) . "<br>\n";
            }
            if (is_dir($base . $nchat . "/register") || mkdir($base . $nchat . "/register", 0777)) {
                if (!is_dir($base . $nchat . "/register/wizard_locked")) {
                    echo mkdir($base . $nchat . "/register/wizard_locked", 0777) . "<br>\n";
                }
                $files = array("/sendmsg.php", "/index.php", "/login.php", "/reader.php", "/manual.php", "/gui_opt.php", "/gui_set.php", "/gui_icon.php", "/gui_lang.php", "/custom.php", "/userlist.php", "/register/biglist.php", "/register/adminlog.php", "/register/dblog.php", "/register/biglog.php", "/register/index.php", "/register/login.php", "/register/viewer.php", "/register/regapp.php", "/jbb/index.php");
                for ($cc = 0; $cc < count($files); $cc++) {
                    if (!file_exists($base . $nchat . $files[$cc])) {
                        echo copy($base . "_new" . $files[$cc], $base . $nchat . $files[$cc]) . " " . $base . $nchat . $files[$cc] . "<br>";
                        echo chmod($base . $nchat . $files[$cc], 0666) . '<br>';
                    }
                }