if (!ctype_alnum(str_replace(" ", "", $checkMessage[3]))) { die("text family is invalid"); } // is IRC numeric? if ($checkMessage[5] && !is_numeric($checkMessage[5])) { die("IRC value is invalid"); } // is linebreaks numeric? if ($checkMessage[6] && !is_numeric($checkMessage[6])) { die("linebreak value is invalid"); } // is message shared? (eg. broadcast) if (stristr($checkMessage[4], "BROADCAST") && getAdmin($_SESSION['username']) || stristr($checkMessage[4], "BROADCAST") && getModerator($_SESSION['username'])) { $share = '1'; } if (stristr($checkMessage[4], "BROADCAST") && !getAdmin($_SESSION['username']) && stristr($checkMessage[4], "BROADCAST") && !getModerator($_SESSION['username'])) { die("incorrect permissions"); } } // if intelli-bot is enabled if ($CONFIG['intelliBot'] && !$_POST['uname'] && $_SESSION['username']) { $senderName = $CONFIG['intelliBotName']; } else { $senderName = $_SESSION['username']; } // if user is not silenced if (!$_SESSION['silenceStart'] || $_SESSION['silenceStart'] < date("U") - $CONFIG['silent'] * 60) { unset($_SESSION['silenceStart']); if (!$senderName || empty($senderName)) { die("invalid username"); }
function chatRoomID($id, $pass) { // include files include getDocPath() . "includes/config.php"; if (!$id || !is_numeric($id)) { // if no room ID or room ID is not numeric then // log user into default room (set in config.php) $_SESSION['room'] = $CONFIG['defaultRoom']; return array($CONFIG['defaultRoom'], '1'); } else { // password encryption if (!empty($pass)) { $pass = md5($pass); } $roomPassword = "******" . makeSafe($pass) . "'"; // admin & mods dont need a password ;) if (getAdmin($_SESSION['username']) || getModerator($_SESSION['username'])) { $roomPassword = ''; } // check room exists $tmp = mysql_query("\n\t\t\tSELECT id, roomid, roomowner \n\t\t\tFROM prochatrooms_rooms \n\t\t\tWHERE id = '" . makeSafe($id) . "' \n\t\t\t" . $roomPassword . " \n\t\t\tORDER BY id DESC\n\t\t\tLIMIT 1\n\t\t\t") or die(mysql_error()); if (mysql_num_rows($tmp)) { while ($i = mysql_fetch_array($tmp)) { $_SESSION['room'] = $i['id']; $roomowner = $i['roomowner']; } return array($id, $roomowner); } else { include "templates/" . $CONFIG['template'] . "/private.php"; die; } } updateRoomUserCount($id); }
$_badwords = implode("|", badChars()); $_badwords = str_replace("'", "\\'", $_badwords); echo "var badChars = '" . $_badwords . "'; "; /* * assign admin status * */ if (isset($_SESSION['adminUser'])) { unset($_SESSION['adminUser']); } /* * user status * */ echo "var admin = " . getAdmin($_SESSION['username']) . "; "; echo "var moderator = " . getModerator($_SESSION['username']) . "; "; echo "var speaker = " . getSpeaker($_SESSION['username']) . "; "; /* * user messages * */ echo "var mBold = " . $CONFIG['text']['bold'] . "; "; echo "var mItalic = " . $CONFIG['text']['italic'] . "; "; echo "var mUnderline = " . $CONFIG['text']['underline'] . "; "; echo "var textColor = '" . $CONFIG['text']['color'] . "'; "; echo "var textSize = '" . $CONFIG['text']['size'] . "'; "; echo "var textFamily = '" . $CONFIG['text']['family'] . "'; "; /* * system messages * */
$onlineTime = getTime() - 300; // check user activity $offlineTime = getTime() - $CONFIG['activeTimeout']; $tmp = mysql_query("\n\tSELECT id, username, userid, prevroom, room, avatar, webcam, active, online, status, watching, eCredits, guest, lastActive, userIP \n\tFROM prochatrooms_users \n\tWHERE username != '' \n\tAND active > '" . $onlineTime . "'\n\t" . $singleRoom . "\n\tGROUP BY room, username ASC\n\t") or die(mysql_error()); while ($i = mysql_fetch_array($tmp)) { $showAllUsers = 1; if (invisibleAdmins($i['username'])) { $showAllUsers = 0; } if ($showAllUsers == 1) { $iAdmin = 0; if (getAdmin($i['username'])) { $iAdmin = 1; } $iModerator = 0; if (getModerator($i['username'])) { $iModerator = 1; } $iSpeaker = 0; if (getSpeaker($i['username'])) { $iSpeaker = 1; } $i['userid'] = empty($i['userid']) ? "0" : $i['userid']; $i['room'] = empty($i['room']) ? "0" : $i['room']; $xml .= '<userlist>'; $xml .= '<id>' . $i['id'] . '</id>'; $xml .= '<userid>' . stripslashes($i['userid']) . '</userid>'; $xml .= '<username>' . stripslashes($i['username']) . '</username>'; $xml .= '<avatar>' . stripslashes($i['avatar']) . '</avatar>'; $xml .= '<webcam>' . $i['webcam'] . '</webcam>'; $xml .= '<room>' . $i['room'] . '</room>';