query("SELECT room, status, ip FROM ".C_USR_TBL." WHERE username = '$U' LIMIT 1"); if ($DbLink->num_rows() != 0) { list($room, $status, $knownIp) = $DbLink->next_record(); $DbLink->clean_results(); $kicked = 0; // Security issue include("./lib/get_IP.lib.php3"); if ($knownIp != $IP) { $kicked = 5; } // Update users info if ($room != stripslashes($R)) // Same nick in another room { $DbLink->query("INSERT INTO ".C_MSG_TBL." VALUES ($T, '$R', 'SYS exit', '', ".time().", '', 'sprintf(L_EXIT_ROM, \"".special_char($U,$Latin1)."\")')"); $kicked = 3; } elseif ($status == "k") // Kicked by a moderator or the admin. { $DbLink->query("INSERT INTO ".C_MSG_TBL." VALUES ($T, '$R', 'SYS exit', '', ".time().", '', 'sprintf(L_KICKED, \"".special_char($U,$Latin1)."\")')"); $kicked = 1; } elseif ($status == "d") // The admin just deleted the room { $kicked = 2; } elseif ($status == "b") // Banished by a moderator or the admin. { $DbLink->query("INSERT INTO ".C_MSG_TBL." VALUES ($T, '$R', 'SYS exit', '', ".time().", '', 'sprintf(L_BANISHED, \"".special_char($U,$Latin1)."\")')"); $kicked = 4; }; if ($kicked > 0) { // Kick the user from the current room $kickedUrl = ($kicked < 5) ? "$From?L=$L&U=".urlencode(stripslashes($U))."&E=".urlencode(stripslashes($R))."&KICKED=$kicked" : "$From?L=$L"; ?> close(); exit; } } else { $DbLink->clean_results(); // Fix a security issue ?> close(); exit; }; // ** Send formated messages to the message table ** function AddMessage($M, $T, $R, $U, $C, $Private) { global $DbLink; global $Latin1; global $status; // Text formating tags if(C_HTML_TAGS_KEEP == "none") { if(C_HTML_TAGS_SHOW == 0) { // eliminates every HTML like tags $M = ereg_replace("<[^>]+>", "", $M); } else { // or keep it without effect $M = str_replace("<", "<", $M); $M = str_replace(">", ">", $M); } } else { // then C_HTML_TAGS_KEEP == "simple", we keep U, B and I tags $M = str_replace("<", "<", $M); $M = str_replace(">", ">", $M); if(function_exists("preg_match")) { while(preg_match("/<([ubi]?)>(.*?)<(\/\\1)>/i",$M)) { $M = preg_replace("/<([ubi]?)>(.*?)<(\/\\1)>/i","<\\1>\\2<\\3>",$M); } if(C_HTML_TAGS_SHOW == 0) { $M = preg_replace("/<\/?[ubi]?>/i","",$M); } } } // URL $M = eregi_replace('([[:space:]]|^)(www)', '\\1http://\\2', $M); // no prefix (www.myurl.ext) $prefix = '(http|https|ftp|telnet|news|gopher|file|wais)://'; $pureUrl = '([[:alnum:]/\n+-=%&:_.~?]+[#[:alnum:]+]*)'; $M = eregi_replace($prefix . $pureUrl, '\\1://\\2', $M); // e-mail addresses $M = eregi_replace('([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)', '\\1', $M); // Smilies if (C_USE_SMILIES == 1) { include("./lib/smilies.lib.php3"); Check4Smilies($M,$SmiliesTbl); unset($SmiliesTbl); }; // transform ISO-8859-1 special characters if ($Latin1) { global $MsgTo; ereg("(.*)(".$MsgTo."(>)?)(.*)",$M,$Regs); if ($MsgTo != "" && ($Regs[1] == "" && $Regs[4] == "")) $Regs[4] = $M; if (!ereg("&[[:alnum:]]{1,10};",$Regs[1]) && !ereg("&[[:alnum:]]{1,10};",$Regs[4])) { for ($i = 1; $i <= 4; $i++) { if (($i != 1 && $i != 4) || $Regs[$i] == "") continue; $part = $Regs[$i]; $part = htmlentities($part); $part = str_replace("<", "<", $part); $part = str_replace(">", ">", $part); $part = str_replace("<", "<", $part); $part = str_replace(">", ">", $part); $part = str_replace(""","\"", $part); $part = ereg_replace("&(#[[:digit:]]{2,5};)", "&\\1", $part); $Regs[$i] = $part; } $M = $Regs[1].$Regs[2].$Regs[4]; } } if (isset($C) and $C != "") { // Red colors are reserved to the admin or a moderator for the current room if ((ereg('#(FF0000|fc403f|fc4b34|fa582a|f66421|f27119|ec7e11|ec117f|f21971|f62164|fa2a58|fc344b)', $C)) && !($status == "a" || $status == "m")) $C = "#000000"; $M = "".$M.""; }; $DbLink->query("INSERT INTO ".C_MSG_TBL." VALUES ($T, '$R', '".addslashes($U)."', '$Latin1', ".time().", '$Private', '".addslashes($M)."')"); } // ** Define the default color that will be used for messages ** if (isset($HTTP_COOKIE_VARS["CookieColor"])) $CookieColor = $HTTP_COOKIE_VARS["CookieColor"]; if(!isset($C)) { if(!isset($CookieColor)) { // set default color to black $C = "#000000"; } elseif (ereg('#(FF0000|fc403f|fc4b34|fa582a|f66421|f27119|ec7e11|ec117f|f21971|f62164|fa2a58|fc344b)', $CookieColor)) { // Red colors are reserved to the admin or a moderator for the current room if (!(isset($status) && ($status == "a" || $status == "m"))) $C = "#000000"; } if (!isset($C)) { $C = $CookieColor; } }; setcookie("CookieColor", $C, time() + 60*60*24*365); // cookie expires in one year // ** Test for online commands and swear words ** $IsCommand = false; $RefreshMessages = false; $IsPopup = false; $IsM = false; if (isset($M) && trim($M) != "" && ereg("^\/", $M)) include("./lib/commands.lib.php3"); if (isset($M) && ereg("^\/", $M) && !($IsCommand) && !isset($Error)) $Error = L_BAD_CMD; if (isset($M) && trim($M) != "" && (!isset($M0) || ($M != $M0)) && !($IsCommand || isset($Error))) { if (C_NO_SWEAR == 1) { include("./lib/swearing.lib.php3"); $M = checkwords($M, false); } AddMessage(stripslashes($M), $T, $R, $U, $C, ""); $RefreshMessages = true; } $DbLink->close(); // For translations with an explicit charset (not the 'x-user-defined' one) if (!isset($FontName)) $FontName = ""; ?> ">