View file index.php

File size: 52.35Kb
<?php
  /////////////////////////////////////////////////////////////////////////////////////////////////
  //                                                                                             //
  //  GumChat                                                                                    //
  //  Current Version : 2.0                                                                    //
  //  Author : GUMSLONE                                                                          //
  //  You are not allowed to redistribute or modify this script                                  //
  //  Copyright (c) 2008 GumSlone. All rights reserved.                                          //
  //  Additional scripts can be found at http://www.wapforum.org.uk                              //
  //  15.11.2008                                                                                 //
  /////////////////////////////////////////////////////////////////////////////////////////////////
  ///////////////////////////////////////////////////////////////////////////
  // CONFIGURATION STARTS HERE
  ///////////////////////////////////////////////////////////////////////////
if( is_array($_REQUEST) )
    {
        while( list($k, $v) = each($_REQUEST) )
        {
            if( is_array($_REQUEST[$k]) )
            {
                while( list($k2, $v2) = each($_REQUEST[$k]) )
                {
                    $$k[$k2] = addslashes($v2);
                }
                @reset($_REQUEST[$k]);
            }
            else
            {
                $$k = addslashes($v);
            }
        }
        @reset($_REQUEST);
    }  
  //0 means server time
  $TimeZone = "0";
  // hours* 60 mins* 60secs DONT TOUCH!
  $New_Time = time() + ($TimeZone * 60 * 60);
  //DONT TOUCH!
  $_time = date("H:i", $New_Time);
  //chatroom refreshtime
  $_refresh = 200;
  //means chatroom size of 15 messages
  $_room_size = 20;
  $home_page_url = "http://rdxjatt.com";
  $home_page_title = "rdxjatt.CoM";

  //up to which text message should be smilies visible, from this text messages the smilies will be shown as a text not as an image
  $smilies_decode =15;

  $waittime_sec = 5;
  /* Set this to a minimum wait time between posts (in sec) */

  //DONT TOUCH!
  $encoding = "ISO-8859-1";
  /////////////[Change language or menu]////////////////////////////////
  $lang_user_in_chat = "users in chat";
  $lang_enter = "- Enter -";
  $lang_nickname = "Your Nickname:";
  $lang_gender = "Gender:";
  $lang_male = "Male";
  $lang_female = "Female";
  $lang_age = "Age: ";
  $lang_show_smilies = "Show smilies? ";
  $lang_yes = "YES";
  $lang_no = "NO";
  $lang_nick_color = "Nickname color:";
  $lang_select_chatroom = "Select Chatroom";
  $lang_users = "Users in";
  $lang_chatrooms = "Chatrooms";
  $lang_smilies = "Smilies";
  $lang_next = "Next &#187;";
  $lang_prev = "&#171; Prev";
  $lang_chat = "Back to Chatroom";
  $lang_say = "Say";
  $lang_refresh = "Refresh";
  $lang_message = "Message:";
  $lang_ok = "OK";
  $lang_jump = "Jump";
  $lang_change_chatroom = "Change Chatroom";
  $lang_who_is_online = "Who's Inside";
  $lang_autorefresh = "Autorefresh mode";
  $lang_manual_autorefresh = "Manual refresh mode";
  $lang_loading = "Loading...<br/>please wait";
  $lang_exit = "Logout";
  //$BestTopMobi_id="30357";  //your besttop.mobi id, register your site at http://besttop.mobi to get an id. or just leave 0
  $config_keypass = 'gHe'; //change the value to any value you want or just leave this, its not important
  ///////////////////////////////////////////////////////////////////////////
  // CONFIGURATION ENDS HERE
  ///////////////////////////////////////////////////////////////////////////



  /////////////[DO NOT EDIT AFTER THIS LINE]////////////////////////////////
  $nick = nick_replace($nick);
  $nick = substr(trim($nick), 0, 15);
  global $nick;  
  if(isset($gum_ss)){
  
  $gum_ss_data=xoft_decode($gum_ss, $config_keypass);
  list($gum,$nick,$room,$C,$sm,$G,$A,$RF) = explode("|", $gum_ss_data);
  

  }
  $link_gum_ss=xoft_encode($gum.'|'.$nick.'|'.$room.'|'.$C.'|'.$sm.'|'.$G.'|'.$A.'|'.$RF, $config_keypass);


 
  ///////////IF Nickname is shorter than 3 chars retur an error message and let the user relogin//////////
  if ($nick != '' && strlen($nick) < 3) {
      $gum = "";
      $login_error_message .= '<i>Nickname is to short, it has to be longer than 3 chars, also avoid special chars in nickname. Allowed chars: A-Z, a-z, 0-9, - _ @</i><br/>';
  }
  $G = nick_replace(substr(trim($G), 0, 1));

  $A = nick_replace(substr(trim($A), 0, 2));

  $room = replace($room);

  header('Content-Type: application/xhtml+xml; charset=iso-8859-1');
  header("Cache-Control: no-cache, must-revalidate");
  header("Pragma: no-cache");
  echo '<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="no-cache" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache" />
<link rel="shortcut icon" href="favicon.ico" />';
?>

<!-- GumChat by GumSlone Version 2.0  (c) 2008 All rights reserved. -->
<!-- Additional scripts can be found at http://www.wapforum.org.uk -->
<?php
  if ($nick && $room) {
      $daten = 'online/on' . $room;
      $time = time();
      $user = explode('/', $_SERVER['HTTP_USER_AGENT']);
      $user[0] = ereg_replace(' ', '_', $user[0]);
      $ip = (trim($nick) . ' ' . trim($user[0]) . ' ' . trim($G) . ' ' . trim($A));
      $ablaufzeit = $time - 250;
      $pruefung = @file($daten);

      while (list($line_num, $line) = @each($pruefung)) {
          $zeiten = explode(":", $line);

          if ($zeiten[0] <= $ablaufzeit) {
              $fp = fopen($daten, "r");
              $contents = fread($fp, filesize($daten));
              fclose($fp);
              $line = quotemeta($line);
              $string2 = "";
              $replace = ereg_replace($line, $string2, $contents);
              $fh = fopen($daten, "w");
              @flock($fp, 2);
              fputs($fh, $replace);
              @flock($fp, 3);

              fclose($fh);
          }
      }

      $ippruefung = @file($daten);

      while (list($line_num, $line) = @each($ippruefung)) {
          $ips = explode(":", $line);

          if ($ips[1] == $ip) {
              $fp = fopen($daten, "r");

              $contents = fread($fp, filesize($daten));

              fclose($fp);

              $line = quotemeta($line);

              $string2 = "";

              $replace = ereg_replace($line, $string2, $contents);

              $fh = fopen($daten, "w");

              @flock($fp, 2);

              fputs($fh, $replace);

              @flock($fp, 3);

              fclose($fh);
          }
      }

      $fp = fopen($daten, "a+");

      flock($fp, 2);

      fputs($fp, "$time:$ip:\n");

      flock($fp, 3);

      fclose($fp);
  }


  if ($gum == "") 
{ echo '<title>Chat143.com Live chat ' . $_time . '</title>
              <style type="text/css">
              body {
font-size: small;
font-family: Arial;
font-family : Verdana, Arial, Helvetica, sans-serif;
color: #464D57;
margin: 2px;
padding: 2px;
}
a, a:active  {color: #006FA4;}
a:visited {color: #3A5992;}
a:hover {color: #990000;}
.left {text-align: left; }
.center {text-align: center;}
hr {height:1px;border:none;background-color:#00729e;color:#00729e;}
input {font-family: Verdana;font-size: small;}
select {font-family: Verdana;font-size: small;}
textarea {font-family: Verdana;font-size: small;}
.title {
  background: #08c  url(http://w2c.in/themes/bar.gif) repeat-x;
	color: #FFF;
	padding: 2px;
	margin: 0px;
	font-weight: bold;
	text-align: center;
	height: 18px;
	padding: 0 0 0 2px;
	border: 1px solid #5C5C5C;
}
.shout_bg { background-color: #ECF7DB; border: 1px solid #DADADA;margin: 0px; }
div.header { padding: 5px; margin: 0px; font-weight: bold; text-align: center; background-color: #FFCCFF; border-bottom: 1px solid #b1cade}
div.footer   { padding: 1px; background-color: #87CEFA;  border: 1px dotted #AFCDDC}
.darkbg {padding-bottom : 2px;padding-top : 2px;background : #ebebeb;}
.odd{background-color:#FFF;padding-left:4px;}
.even{background-color:#F5F5F5;padding-left:4px;}
.odd,.even,.norm{vertical-align:middle;margin:2px 0;padding:2px 0 2px 2px;}
.keys{ font-weight: bold; background: #404040; color: #ffffff; }
.ul {text-decoration: underline}
.green {color: #00CE34; }
.red {color: red; }
.yellow {color: yellow; }
.sky {color: #006FA4;}
.gray {color:#727272;}
.blue {color: blue;}
.pink {color:#FF00FF;}
div.divide
{
background-color : #F5F5F5;
}
.style1 {color: #CC0066}
</style>
            </head>
           <body>';
      echo '';
      echo '';
      echo '<div class="header"><strong>Chat143.com</strong></div>
<center><img src="http://mastichat.webatu.com/chat/chat/chat143.png" width="180" lenth="165" alt="" /> </center>
<br />WelCome To <strong>Chat143.com</strong> You Can Invite Your Friends Here To Chat With You,Meet New Friends And More Fun Stuff<br /><br />
<div class="divide"><img src="http://www.imspice.com/ico/user.gif" alt="download"/>  Enjoy Chat With New Friends </div>'

;
		  include 'admob.php';
			echo '<br/>';
			include 'admob1.php';
      echo $login_error_message;

      $n = 0;
      $files = '';

      if ($handle = opendir('rooms/')) {
          while (false !== ($file = readdir($handle))) {
              if ($file != '.' && $file != '..' && $file != 'files' && $file != 'cgi-bin' && $file != 'chat') {
                  if ($n >= 0 && $n < 20) {
                      $onfile = file('online/on' . $file);

                      $counts = count($onfile);

                      if ($counts < 2) {
                          $gumdata = explode(':', $onfile[0]);

                          $ablaufzeit = time() - 250;

                          if ($gumdata[0] <= $ablaufzeit) {
                              $fp = fopen('online/on' . $file, "w+");

                              $counts = 0;
                          }
                      }

                      $total = $total + $counts;
                      $n++;
                  }
              }
          }

          closedir($handle);
      }

      echo '<p>' . $total . ' ' . $lang_user_in_chat . '!</p>';
      echo "<form action=\"" . $_SERVER["PHP_SELF"] . "\" method=\"get\">
        <div>" . $lang_nickname . "<br/>
        <input type=\"hidden\" name=\"WLC\" value=\"1\"/>
        <input type=\"hidden\" name=\"gum\" value=\"rooms\"/>
        <input name=\"nick\" value=\"\"/><br/>";
      echo $lang_gender . '
        <select name="G">
        <option value="m">' . $lang_male . '</option>
        <option value="f">' . $lang_female . '</option>
        </select><br/>';
      echo $lang_age . " <input title=\"age\" name=\"A\" size=\"4\" style=\"-wap-input-format: '*N'\" value=\"\"/><br/>";
      echo $lang_show_smilies . '
        <select name="sm">
        <option value="1">' . $lang_yes . '</option>
        <option value="0">' . $lang_no . '</option>
        </select><br/>';
      echo $lang_nick_color . '<br/><select name="C">
       
	    <option value="000000">Black</option>
        <option value="ff0000">Red</option>
        <option value="00ffff">Turquoise</option>
        <option value="808080">Dark Grey</option>
        <option value="ff8040">Orange</option>
        <option value="804000">Brown</option>
        <option value="00ff00">Green</option>
        <option value="ffff00">Yellow</option>
        <option value="ff00ff">Pink</option>        
        <option value="800000">Burgundy</option>	        
        <option value="0000ff">Blue</option>	
        <option value="DC143C">Crimson</option>
        <option value="0000a0">Dark Blue</option>	
        <option value="B8860B">DarkGoldenRod</option>
        <option value="008000">Dark Green</option>
        <option value="9932CC">DarkOrchid</option>
        <option value="00BFFF">DeepSkyBlue</option>
        <option value="408080">Grass Green</option>
        <option value="F0E68C">Khaki</option>
        <option value="DA70D6">Orchid</option>
        <option value="D2B48C">Tan</option>
        <option value="736F6E">Gray</option>
        <option value="250517">Gray2</option>
        <option value="4C787E">Cadet Blue</option>
        <option value="463E41">Dim Gray</option>
        <option value="4863A0">Steel Blue</option>
        <option value="8D38C9">Violet</option>
        <option value="728FCE">Light Steel Blue</option>
        <option value="737CA1">Slate Blue</option>
        <option value="800517">Firebrick</option>
        <option value="8E35EF">Purple</option>
        <option value="B93B8F">Plum</option>
        <option value="E3E4FA">Lavender</option>
        <option value="00FFFF">Cyan</option>
        <option value="D4A017">Gold</option>
        <option value="8A4117">Sienna</option>
        <option value="F76541">Coral</option>
        <option value="FFF8C6">Lemon Chiffon</option>
        </select><br/>';
      echo "<input type=\"submit\" value=\"" . $lang_enter . "\"/>
        </div>
        </form>";

      echo '<a href="http://Chat143.com">Home</a>';
      echo'<br/><div class="footer" style="text-align: center;">&#169; Chat143.com <br/>All Rights Reserved !</div>';

      echo'<br/>';
    }
  if ($gum == "rooms")
    {
      echo '<title>' . $lang_chatrooms . ' (' . $_time . ')</title>
              <style type="text/css">
              body {
font-size: small;
font-family: Arial;
font-family : Verdana, Arial, Helvetica, sans-serif;
color: #464D57;
margin: 2px;
padding: 2px;
}
a, a:active  {color: #006FA4;}
a:visited {color: #3A5992;}
a:hover {color: #990000;}
.left {text-align: left; }
.center {text-align: center;}
hr {height:1px;border:none;background-color:#00729e;color:#00729e;}
input {font-family: Verdana;font-size: small;}
select {font-family: Verdana;font-size: small;}
textarea {font-family: Verdana;font-size: small;}
.title {
  background: #08c  url(http://w2c.in/themes/bar.gif) repeat-x;
	color: #FFF;
	padding: 2px;
	margin: 0px;
	font-weight: bold;
	text-align: center;
	height: 18px;
	padding: 0 0 0 2px;
	border: 1px solid #5C5C5C;
}
.shout_bg { background-color: #ECF7DB; border: 1px solid #DADADA;margin: 0px; }
div.header { padding: 5px; margin: 0px; font-weight: bold; text-align: center; background-color: #FFCCFF; border-bottom: 1px solid #b1cade}
div.footer   { padding: 1px; background-color: #87CEFA;  border: 1px dotted #AFCDDC}
.darkbg {padding-bottom : 2px;padding-top : 2px;background : #ebebeb;}
.odd{background-color:#FFF;padding-left:4px;}
.even{background-color:#F5F5F5;padding-left:4px;}
.odd,.even,.norm{vertical-align:middle;margin:2px 0;padding:2px 0 2px 2px;}
.keys{ font-weight: bold; background: #404040; color: #ffffff; }
.ul {text-decoration: underline}
.green {color: #00CE34; }
.red {color: red; }
.yellow {color: yellow; }
.sky {color: #006FA4;}
.gray {color:#727272;}
.blue {color: blue;}
.pink {color:#FF00FF;}
div.divide
{
background-color : #F5F5F5;
}
.style1 {color: #CC0066}
</style>
            </head>
           <body>';
      $nick = ereg_replace(" ", "_", $nick);
      if (preg_match("/[^\da-zA-Z-@_]+/", $nick) || $nick == "")
          $error = 'Not suported chars in Nickname!<br/>';
      if (empty($error))
        {
          echo '<div class="header"><strong> Chat143.com </strong></div><br />';
          if ($WLC)
              echo 'Welcome to chat ' . $nick . '<br/><img src="http://www.imspice.com/ico/select.gif" alt="sel"/>';
          echo $lang_select_chatroom . '<br/>';
					include 'mobtonic.php';
          echo '';
          $n = 0;
          $files = '';
          if ($handle = opendir('rooms/'))
            {
              $I = 0;
              while (false !== ($file = readdir($handle)))
                {
                  if ($file != '.' && $file != '..' && $file != 'files' && $file != 'cgi-bin' && $file != 'chat')
                    {
                      if ($n >= 0 && $n < 20)
                        {
                          $I++;
                          $geting_class = ($I / 2) - floor($I / 2);
                          if ($geting_class == 0)
                            {
                              $Class = '';
                            }
                          else
                            {
                              $Class = ' class="divide"';
                            }
                          $onfile = file('online/on' . $file);
                          $counts = count($onfile);
                          $total = $total + $counts;
                          $n++;
                          echo '<br /><div' . $Class . '><a href="' . $_SERVER["PHP_SELF"] . '?gum_ss=' . xoft_encode('croom|' . $nick . '|' . $file . '|' . $C . '|' . $sm . '|' . $G . '|' . $A . '|1', $config_keypass) . '">' . $file . ' (' . $counts . ')</a></div>';
                        }
                    }
                }
              closedir($handle);
            }
        }
      else
          echo '<p>' . $error . 'Press back button!<br/><a href="' . $_SERVER["PHP_SELF"] . '">Login here again</a></p>';
      echo '<p>' . $total . ' ' . $lang_users . ' ' . $n . ' ' . $lang_chatrooms . '!<br/>';

     echo '<a href="http://Chat143.com">Home</a> <br/>';
      echo '<a href="' . $_SERVER["PHP_SELF"] . '">' . $lang_exit . '</a><br/>';
			include 'admob.php';
			echo '<br/>';
			include 'mobtonic.php';
      echo '<div class="footer" style="text-align: center;">&#169; Chat143.com <br/>All Rights Reserved !</div></p>';
    }

  if ($gum == "croom")
    {
      $rand_key = @rand(53256, 16326239);
      if ($RF == 1)
          echo '<meta http-equiv="refresh" content="30;url=' . $_SERVER["PHP_SELF"] . '?gum_ss=' . $link_gum_ss . '&amp;r=' . $rand_key . '"/>';
      $onxfile = @file('online/on' . $room);
      $countonl = count($onxfile);
      echo '<title>' . $room . ' in ' . $countonl . ' (' . $_time . ')</title>
              <style type="text/css">
              body {
font-size: small;
font-family: Arial;
font-family : Verdana, Arial, Helvetica, sans-serif;
color: #464D57;
margin: 2px;
padding: 2px;
}
a, a:active  {color: #006FA4;}
a:visited {color: #3A5992;}
a:hover {color: #990000;}
.left {text-align: left; }
.center {text-align: center;}
hr {height:1px;border:none;background-color:#00729e;color:#00729e;}
input {font-family: Verdana;font-size: small;}
select {font-family: Verdana;font-size: small;}
textarea {font-family: Verdana;font-size: small;}
.title {
  background: #08c  url(http://w2c.in/themes/bar.gif) repeat-x;
	color: #FFF;
	padding: 2px;
	margin: 0px;
	font-weight: bold;
	text-align: center;
	height: 18px;
	padding: 0 0 0 2px;
	border: 1px solid #5C5C5C;
}
.shout_bg { background-color: #ECF7DB; border: 1px solid #DADADA;margin: 0px; }
div.header { padding: 5px; margin: 0px; font-weight: bold; text-align: center; background-color: #FFCCFF; border-bottom: 1px solid #b1cade}
div.footer   { padding: 1px; background-color: #87CEFA;  border: 1px dotted #AFCDDC}
.darkbg {padding-bottom : 2px;padding-top : 2px;background : #ebebeb;}
.odd{background-color:#FFF;padding-left:4px;}
.even{background-color:#F5F5F5;padding-left:4px;}
.odd,.even,.norm{vertical-align:middle;margin:2px 0;padding:2px 0 2px 2px;}
.keys{ font-weight: bold; background: #404040; color: #ffffff; }
.ul {text-decoration: underline}
.green {color: #00CE34; }
.red {color: red; }
.yellow {color: yellow; }
.sky {color: #006FA4;}
.gray {color:#727272;}
.blue {color: blue;}
.pink {color:#FF00FF;}
div.divide
{
background-color : #F5F5F5;
}
.style1 {color: #CC0066}
</style>
            </head>
           <body>';
        echo '<div class="header"><strong> Chat143.com </strong></div>';

include 'mobtonic.php';
      if ($RF != 1)
        {
          echo "<form id=\"ms" . $rand_key . "\" action=\"" . $_SERVER["PHP_SELF"] . "\" method=\"post\">
<div>
<textarea name=\"mess\" rows=\"1\" cols=\"40\"></textarea>
<input type=\"hidden\" name=\"gum_ss\" value=\"$link_gum_ss\"/>
<input type=\"hidden\" name=\"antiflood\" value=\"$rand_key\"/>
<input type=\"submit\" value=\"" . $lang_say . "\"/>
</div>
</form>";
          echo '<p><a id="say"></a>';
          echo '<a href="' . $_SERVER["PHP_SELF"] . '?gum_ss=' . $link_gum_ss . '&amp;r=';
          echo $New_Time;
          echo '">' . $lang_refresh . '</a> ';
          echo '<a href="#menu">Menu</a></p>';
        }
      else
        {
          echo '<p><img src="./timer.gif" alt="" /> <a href="' . $_SERVER["PHP_SELF"] . '?gum_ss=' . xoft_encode('say|' . $nick . '|' . $room . '|' . $C . '|' . $sm . '|' . $G . '|' . $A . '|1', $config_keypass) . '">' . $lang_say . '</a> ';
          echo '<a href="' . $_SERVER["PHP_SELF"] . '?gum_ss=' . $link_gum_ss . '&amp;r=';
          echo $New_Time;
          echo '">' . $lang_refresh . '</a> ';
          echo '<a href="#menu">Menu</a></p>';
        }
      ////////////////////////////////////////
      if ($_POST["mess"] != "")
        {
          $mess = replace($_POST["mess"]);
          $mess = filterFlood($mess);
          $mess = filterBadWords($mess);
          $C = color_check($C);
          $mess = trim(substr($mess, 0, 160));
          $_mudata = explode(" ", $mess);
          $count_spaces = count($_mudata);
          $count_chars = strlen($mess);
          if ($count_chars < 3 && !empty($mess))
            {
              $chat_error_message .= '<i>The message is to short, it has to be longer than 4 chars</i><br/>';
            }
          $text = $C . "&&$nick $_time&&$mess&&" . $antiflood;
          if ($count_spaces < 3 && $count_chars > 30)
              $FOUND = 1;
          if ($count_spaces < 5 && $count_chars > 40)
              $FOUND = 1;
        }
      //////////////////////////////////////////////
      if ($mess != "" && !$chat_error_message)
        {
          $udata = explode("&&", $text);
          $udata[2] = htmlspecialchars($udata[2]);
          $udata[2] = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '', $udata[2]);
          $udata[2] = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '', $udata[2]);
          if ($sm == 1)
              $udata[2] = ReplaceTextToSmilies($udata[2]);
          echo '<div><span style="color : #' . $udata[0] . '; font-weight : bold;">' . htmlspecialchars($udata[1]) . ' &#187;</span> ' . $udata[2] . '</div>';
        }
      else
          echo $chat_error_message;
      $fp = fopen('rooms/' . $room, "r");
      $smilies_decode_num = 1;
      $I = 0;
      $mini_found = 1;
      while ($radka = fgets($fp, 512))
        {
          $udata = explode("&&", $radka);
          if ($udata[2] != "")
            {
              $I++;
              $geting_class = ($I / 2) - floor($I / 2);
              if ($geting_class == 0)
                {
                  $Class = '';
                }
              else
                {
                  $Class = ' class="divide"';
                }
              ////////////////////////ANTIFLOOOOOOOOOOOOOOOOOD////////////////////
              if (isset($mess))
                {
                  if ($udata[3] == $antiflood)
                    {
                      $FOUND = 1;
                    }
                  if (trim($udata[2]) == trim($mess))
                    {
                      $FOUND = 1;
                    }

                  if ($FOUND != 1)
                    {
                      $checktext_1 = preg_replace('/[^[:alnum:]\^]/', '', strtolower($udata[2]));
                      $checktext_2 = preg_replace('/[^[:alnum:]\^]/', '', strtolower($mess));
                      if(is_numeric($checktext_2)) $FOUND = 1;
                      $count_checktext_1 = strlen($checktext_1);
                      $count_checktext_2 = strlen($checktext_2);
                      $rand_start_1 = rand(1, $count_checktext_1 - 6);
                      $rand_start_2 = rand(1, $count_checktext_2 - 6);
                      for ($n = 1; $n <= $count_checktext_1; $n++)
                        {
                          if (substr($checktext_1, $rand_start_1, 6) == substr($checktext_2, $n, 6))
                            {
                              $FOUND = 1;
                              break;
                            }
                          if (substr($checktext_2, $rand_start_2, 6) == substr($checktext_1, $n, 6))
                            {
                              $FOUND = 1;
                              break;
                            }
                        }

                      if ($FOUND != 1)
                        {
                          for ($n = $count_checktext_1; $n >= 1; $n--)
                            {
                              if (substr($checktext_1, $rand_start_1, 6) == substr($checktext_2, $n, 6))
                                {
                                  $FOUND = 1;
                                  break;
                                }
                              if (substr($checktext_2, $rand_start_2, 6) == substr($checktext_1, $n, 6))
                                {
                                  $FOUND = 1;
                                  break;
                                }
                            }
                        }
                    }


                  if (substr($udata[1], 0, 2) == substr($nick, 0, 2))
                    {
                      if (substr($checktext_1, 0, 2) == substr($checktext_2, 0, 2) && $checktext_1 < 6)
                          $mini_found++;
                      elseif ( substr($checktext_1, $count_checktext_1 - 2, 2) == substr($checktext_2, $count_checktext_2 - 2, 2) && $count_chars < 6)
                          $mini_found++;
                      elseif ($count_checktext_1 == $count_checktext_2)
                          $mini_found++;
                      else
                          $nick_found++;
                    }
                    else $random_nicks++;


                  $count_mess_chars = strlen($mess);
                  if (!isset($FOUND) && $count_mess_chars > 30)
                    {

                      $message_middle = ceil($count_mess_chars / 2);
                      preg_match_all("/" . substr(strtolower($mess), ($message_middle - 5), 4) . "/i", strtolower($mess), $treffer);
                      $matches = count($treffer[0]);
                      if ($matches > 2)
                          $FOUND = 1;
                      if (!isset($FOUND))
                        {
                          preg_match_all("/" . substr(strtolower($mess), ($message_middle - 7), 4) . "/i", strtolower($mess), $treffer);
                          $matches = count($treffer[0]);
                          if ($matches > 2)
                              $FOUND = 1;
                          if (!isset($FOUND))
                            {
                              preg_match_all("/" . substr(strtolower($mess), ($message_middle + 1), 4) . "/i", strtolower($mess), $treffer);
                              $matches = count($treffer[0]);
                              if ($matches > 2)
                                  $FOUND = 1;
                            }
                        }
                    }

                }

              if ($mini_found > 2)
                      $FOUND = 1;
              if ($random_nicks > 5 && $nick_found > 6)
                      $FOUND = 1;
              else if ($random_nicks <= 5 && $nick_found > 7)
                      $FOUND = 1;

              /////////////////////////END OF ANTIFLOOD CHECK////////////////////
              $udata[2] = htmlspecialchars($udata[2]);
              $udata[2] = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '', $udata[2]);
              $udata[2] = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '', $udata[2]);
              // $udata[2] = filterBadWords($udata[2]);
              if ($sm == 1 && $smilies_decode_num <= $smilies_decode)
                  $udata[2] = ReplaceTextToSmilies($udata[2]);
              $smilies_decode_num++;
              $udata[1] = ereg_replace("_", " ", $udata[1]);
              echo '<div' . $Class . '><span style="color : #' . $udata[0] . '; font-weight : bold;">' . htmlspecialchars($udata[1]) . ' &#187;</span> ' . $udata[2] . '</div>';
            }
        }
      fclose($fp);
      /////////////////////WRITING A TEXT MESSAGE TO the FILE///////////////////////////
      if (!$FOUND && $count_chars > 3 && $nick != "" && !$chat_error_message)
        {
          $text = stripslashes($text);
          $text = strip_tags($text);
          $text = preg_replace("(\r\n|\n|\r)", "", $text);
          //$text = ereg_replace("_", " ", $text);
          if (file_exists('rooms/' . $room))
            {
              $zpravy = file('rooms/' . $room);
            }
          $fp = fopen('rooms/' . $room, "w");
          fputs($fp, $text . "\n");
          for ($i = 0; $i < $_room_size; $i++)
            {
              fputs($fp, $zpravy[$i]);
            }
          fclose($fp);
        }
      /////////////////////END OF WRITING A TEXT MESSAGE TO the FILE///////////////////////////


      echo '<p><a id="menu"></a>';
      if ($RF != 1)
          echo '<a href="#say">' . $lang_say . '</a> ';
      else
          echo '<a href="' . $_SERVER["PHP_SELF"] . '?gum_ss=' . xoft_encode('say|' . $nick . '|' . $room . '|' . $C . '|' . $sm . '|' . $G . '|' . $A . '|1', $config_keypass) . '">' . $lang_say . '</a>  | ';
      echo '<a href="' . $_SERVER["PHP_SELF"] . '?gum_ss=' . $link_gum_ss . '&amp;r=';
      echo $New_Time;
      echo '">' . $lang_refresh . '</a><br/>';
      echo '<a href="' . $_SERVER["PHP_SELF"] . '?gum_ss=' . xoft_encode('online|' . $nick . '|' . $room . '|' . $C . '|' . $sm . '|' . $G . '|' . $A . '|' . $RF, $config_keypass) . '">' . $lang_who_is_online . '</a><br/>';
      if ($RF == 1)
          echo '<a href="' . $_SERVER["PHP_SELF"] . '?gum_ss=' . xoft_encode('croom|' . $nick . '|' . $room . '|' . $C . '|' . $sm . '|' . $G . '|' . $A . '|0', $config_keypass) . '">' . $lang_manual_autorefresh . '</a><br/>';
      else
          echo '<a href="' . $_SERVER["PHP_SELF"] . '?gum_ss=' . xoft_encode('croom|' . $nick . '|' . $room . '|' . $C . '|' . $sm . '|' . $G . '|' . $A . '|1', $config_keypass) . '">' . $lang_autorefresh . '</a><br/>';
      echo '<a href="' . $_SERVER["PHP_SELF"] . '?gum_ss=' . xoft_encode('rooms|' . $nick . '||' . $C . '|' . $sm . '|' . $G . '|' . $A . '|' . $RF, $config_keypass) . '">' . $lang_change_chatroom . '</a><br/>';
      echo '<a href="' . $_SERVER["PHP_SELF"] . '?gum_ss=' . xoft_encode('smilies|' . $nick . '|' . $room . '|' . $C . '|' . $sm . '|' . $G . '|' . $A . '|' . $RF, $config_keypass) . '">' . $lang_smilies . '</a> | ';
      echo '<a href="http://riskyjatt.com">Home</a><br/>';
      echo '<a href="' . $_SERVER["PHP_SELF"] . '">' . $lang_exit . '</a><br/>';
			include 'mobtonic.php';
      echo '<div class="footer" style="text-align: center;">&#169; Chat143.com <br/>All Rights Reserved !</div></p>';
    }
  if ($gum == "say")
    {
      echo '<title>' . $lang_smilies . ' (' . $_time . ')</title>
              <style type="text/css">
              body {
font-size: small;
font-family: Arial;
font-family : Verdana, Arial, Helvetica, sans-serif;
color: #464D57;
margin: 2px;
padding: 2px;
}
a, a:active  {color: #006FA4;}
a:visited {color: #3A5992;}
a:hover {color: #990000;}
.left {text-align: left; }
.center {text-align: center;}
hr {height:1px;border:none;background-color:#00729e;color:#00729e;}
input {font-family: Verdana;font-size: small;}
select {font-family: Verdana;font-size: small;}
textarea {font-family: Verdana;font-size: small;}
.title {
  background: #08c  url(http://w2c.in/themes/bar.gif) repeat-x;
	color: #FFF;
	padding: 2px;
	margin: 0px;
	font-weight: bold;
	text-align: center;
	height: 18px;
	padding: 0 0 0 2px;
	border: 1px solid #5C5C5C;
}
.shout_bg { background-color: #ECF7DB; border: 1px solid #DADADA;margin: 0px; }
div.header { padding: 5px; margin: 0px; font-weight: bold; text-align: center; background-color: #FFCCFF; border-bottom: 1px solid #b1cade}
div.footer   { padding: 1px; background-color: #87CEFA;  border: 1px dotted #AFCDDC}
.darkbg {padding-bottom : 2px;padding-top : 2px;background : #ebebeb;}
.odd{background-color:#FFF;padding-left:4px;}
.even{background-color:#F5F5F5;padding-left:4px;}
.odd,.even,.norm{vertical-align:middle;margin:2px 0;padding:2px 0 2px 2px;}
.keys{ font-weight: bold; background: #404040; color: #ffffff; }
.ul {text-decoration: underline}
.green {color: #00CE34; }
.red {color: red; }
.yellow {color: yellow; }
.sky {color: #006FA4;}
.gray {color:#727272;}
.blue {color: blue;}
.pink {color:#FF00FF;}
div.divide
{
background-color : #F5F5F5;
}
.style1 {color: #CC0066}
  </style>          </head>
           <body>';
       echo '<div class="header"><strong> Chat143.com </strong></div>';

    include 'mobtonic.php';
      echo "<form id=\"ms" . $New_Time . "\" action=\"" . $_SERVER["PHP_SELF"] . "\" method=\"post\">
<div>
<textarea name=\"mess\" rows=\"2\" cols=\"40\"></textarea><br/>
<input type=\"hidden\" name=\"gum_ss\" value=\"" . xoft_encode('croom|' . $nick . '|' . $room . '|' . $C . '|' . $sm . '|' . $G . '|' . $A . '|1', $config_keypass) . "\"/>
<input type=\"hidden\" name=\"antiflood\" value=\"$rand_key\"/>
<input type=\"submit\" value=\"" . $lang_say . "\"/>
</div>
</form>";
      echo '<p>';
      echo '<a href="' . $_SERVER["PHP_SELF"] . '?gum_ss=' . xoft_encode('croom|' . $nick . '|' . $room . '|' . $C . '|' . $sm . '|' . $G . '|' . $A . '|1', $config_keypass) . '">' . $lang_chat . '</a><br/>';
      echo '<a href="' . $_SERVER["PHP_SELF"] . '?gum_ss=' . xoft_encode('rooms|' . $nick . '||' . $C . '|' . $sm . '|' . $G . '|' . $A . '|1', $config_keypass) . '">' . $lang_change_chatroom . '</a><br/>';

      include 'mobtonic.php';
      echo '<div class="footer" style="text-align: center;">&#169; Chat143.com <br/>All Rights Reserved !</div></p>';
    }
  if ($gum == "smilies")
    {
      echo '<title>' . $lang_smilies . ' (' . $_time . ')</title>
              <style type="text/css">
              body {
font-size: small;
font-family: Arial;
font-family : Verdana, Arial, Helvetica, sans-serif;
color: #464D57;
margin: 2px;
padding: 2px;
}
a, a:active  {color: #006FA4;}
a:visited {color: #3A5992;}
a:hover {color: #990000;}
.left {text-align: left; }
.center {text-align: center;}
hr {height:1px;border:none;background-color:#00729e;color:#00729e;}
input {font-family: Verdana;font-size: small;}
select {font-family: Verdana;font-size: small;}
textarea {font-family: Verdana;font-size: small;}
.title {
  background: #08c  url(http://w2c.in/themes/bar.gif) repeat-x;
	color: #FFF;
	padding: 2px;
	margin: 0px;
	font-weight: bold;
	text-align: center;
	height: 18px;
	padding: 0 0 0 2px;
	border: 1px solid #5C5C5C;
}
.shout_bg { background-color: #ECF7DB; border: 1px solid #DADADA;margin: 0px; }
div.header { padding: 5px; margin: 0px; font-weight: bold; text-align: center; background-color: #FFCCFF; border-bottom: 1px solid #b1cade}
div.footer   { padding: 1px; background-color: #87CEFA;  border: 1px dotted #AFCDDC}
.darkbg {padding-bottom : 2px;padding-top : 2px;background : #ebebeb;}
.odd{background-color:#FFF;padding-left:4px;}
.even{background-color:#F5F5F5;padding-left:4px;}
.odd,.even,.norm{vertical-align:middle;margin:2px 0;padding:2px 0 2px 2px;}
.keys{ font-weight: bold; background: #404040; color: #ffffff; }
.ul {text-decoration: underline}
.green {color: #00CE34; }
.red {color: red; }
.yellow {color: yellow; }
.sky {color: #006FA4;}
.gray {color:#727272;}
.blue {color: blue;}
.pink {color:#FF00FF;}
div.divide
{
background-color : #F5F5F5;
}
.style1 {color: #CC0066}
</style>
            </head>
           <body>';
      echo '<div class="header"><strong> Chat143.com </strong></div>';

       include 'mobtonic.php';
      echo '<p>';

      $conf["items_per_page"] = 5;
      if (isset($npage))
          $page = $npage - 1;
      if (!isset($page))
          $page = 0;
      if ($page < 0)
          $page = 0;

      $total = 0;
      if (!($dp = opendir('./smilies/')))
          die('Cannot open ./smilies/');
      $file_array = array();
      while ($file = readdir($dp))
        {
          if (substr($file, 0, 1) != '.' and $file != '..' and $file != 'index.php')
            {
              $file_array[] = $file;
            }
        }
      $file_count = count($file_array);
      sort($file_array);

      if ($file_count > 0)
        {
          $first_record = $page * $conf["items_per_page"];
          $last_record = $first_record + $conf["items_per_page"];

          while (list($fileIndexValue, $file_name) = each($file_array))
            {
              if (($fileIndexValue >= $first_record) and ($fileIndexValue < $last_record))
                {
                  $smilie = explode('.', $file_name);
                  echo '<img src="smilies/' . $file_name . '" alt=".' . $user[0] . '."/> .' . $smilie[0] . '.<br/>';
                }
            }

          if (($file_count > 0) and ($last_record < $file_count))
            {
              // next button
              $next_page = $page + 1;
              echo '<br/><a href="' . $_SERVER["PHP_SELF"] . '?gum_ss=' . $link_gum_ss . '&amp;page=' . $next_page . '">' . $lang_next . '</a><br/>';
            }
          if (($file_count > 0) and ($page != 0))
            {
              // previous button
              $prev_page = $page - 1;
              echo '<br/><a href="' . $_SERVER["PHP_SELF"] . '?gum_ss=' . $link_gum_ss . '&amp;page=' . $prev_page . '">' . $lang_prev . '</a><br/>';
            }
        }
      closedir($dp);
      echo '<b>' . $file_count . '</b> ' . $lang_smilies . '<br/>';
      $pages = ceil($file_count / $conf["items_per_page"]);
      echo 'Page <b>' . ($page + 1) . '</b> of ' . $pages . '</p>';
      echo "<form action=\"" . $_SERVER["PHP_SELF"] . "\">
<div>Jump to Page:
<input type=\"hidden\" name=\"gum_ss\" value=\"$link_gum_ss\"/>
<input title=\"page\" name=\"npage\" size=\"4\" style=\"-wap-input-format: '*N'\" value=\"\"/>
<input type=\"submit\" value=\"" . $lang_jump . "\"/>
</div>
</form>";
      echo '<p><a href="' . $_SERVER["PHP_SELF"] . '?gum_ss=' . xoft_encode('croom|' . $nick . '|' . $room . '|' . $C . '|' . $sm . '|' . $G . '|' . $A . '|1', $config_keypass) . '">' . $lang_chat . '</a><br/>';
      echo '<a href="' . $_SERVER["PHP_SELF"] . '?gum_ss=' . xoft_encode('rooms|' . $nick . '||' . $C . '|' . $sm . '|' . $G . '|' . $A . '|1', $config_keypass) . '">' . $lang_change_chatroom . '</a><br/>';
   include 'mobtonic.php';
      echo '<div class="footer" style="text-align: center;">&#169; Chat143.com <br/>All Rights Reserved !</div></p>';
    }
  if ($gum == "online")
    {
      echo '<title>' . $lang_who_is_online . ' (' . $_time . ')</title>
              <style type="text/css">
             body {
font-size: small;
font-family: Arial;
font-family : Verdana, Arial, Helvetica, sans-serif;
color: #464D57;
margin: 2px;
padding: 2px;
}
a, a:active  {color: #006FA4;}
a:visited {color: #3A5992;}
a:hover {color: #990000;}
.left {text-align: left; }
.center {text-align: center;}
hr {height:1px;border:none;background-color:#00729e;color:#00729e;}
input {font-family: Verdana;font-size: small;}
select {font-family: Verdana;font-size: small;}
textarea {font-family: Verdana;font-size: small;}
.title {
  background: #08c  url(http://w2c.in/themes/bar.gif) repeat-x;
	color: #FFF;
	padding: 2px;
	margin: 0px;
	font-weight: bold;
	text-align: center;
	height: 18px;
	padding: 0 0 0 2px;
	border: 1px solid #5C5C5C;
}
.shout_bg { background-color: #ECF7DB; border: 1px solid #DADADA;margin: 0px; }
div.header { padding: 5px; margin: 0px; font-weight: bold; text-align: center; background-color: #FFCCFF; border-bottom: 1px solid #b1cade}
div.footer   { padding: 1px; background-color: #87CEFA;  border: 1px dotted #AFCDDC}
.darkbg {padding-bottom : 2px;padding-top : 2px;background : #ebebeb;}
.odd{background-color:#FFF;padding-left:4px;}
.even{background-color:#F5F5F5;padding-left:4px;}
.odd,.even,.norm{vertical-align:middle;margin:2px 0;padding:2px 0 2px 2px;}
.keys{ font-weight: bold; background: #404040; color: #ffffff; }
.ul {text-decoration: underline}
.green {color: #00CE34; }
.red {color: red; }
.yellow {color: yellow; }
.sky {color: #006FA4;}
.gray {color:#727272;}
.blue {color: blue;}
.pink {color:#FF00FF;}
div.divide
{
background-color : #F5F5F5;
}
.style1 {color: #CC0066}
</style>
            </head>
           <body>';
       echo '<div class="header"><strong> Chat143.com </strong></div>';

include 'mobtonic.php';
      echo '<p>' . $lang_who_is_online . '</p>';
      $xfile = @file('online/on' . $room);
      $xfile = array_reverse($xfile);
      $p = 25;
      if ($npage == "")
        {
          $npage = 1;
        }
      $countfile = count($xfile);
      $first = $countfile - ($p * ($npage - 1));
      $second = $countfile - ($p * $npage) + 1;
      if ($second < 1)
        {
          $second = 1;
        }
      $npages = ceil($countfile / $p);
      if ($npage <= $npages and $npage > 1)
          $gline_rew = '<a href="' . $_SERVER["PHP_SELF"] . '?gum_ss=' . $link_gum_ss . '&amp;npage=' . ($npage - 1) . '">' . $lang_prev . '</a>';
      if ($npages > 1 and $npage < $npages)
          $gline_next = '<a href="' . $_SERVER["PHP_SELF"] . '?gum_ss=' . $link_gum_ss . '&amp;npage=' . ($npage + 1) . '">' . $lang_next . '</a>';
      if ($npage == 1)
          $nn = 1;
      else
          $nn = (($npage - 1) * $p) + 1;
      $I = 0;
      for ($i = $first - 1; $i >= $second - 1; $i--)
        {
          $I++;
          $geting_class = ($I / 2) - floor($I / 2);
          if ($geting_class == 0)
            {
              $Class = '';
            }
          else
            {
              $Class = ' class="divide"';
            }
          $xdata = explode(':', $xfile[$i]);
          $udata = explode(' ', $xdata[1]);
          if ($udata[2] == m)
              $gender = $lang_male;
          if ($udata[2] == f)
              $gender = $lang_female;
          echo '<div' . $Class . '>' . $nn++ . '. <span class="nick">' . $udata[0] . '</span> ' . $gender . ' (' . $udata[3] . ') ' . $udata[1] . '</div>';
        }
      echo '<p>';
      if ($npages > 1)
          echo $gline_rew . '| ' . $gline_next;

      echo '<br/><a href="' . $_SERVER["PHP_SELF"] . '?gum_ss=' . xoft_encode('croom|' . $nick . '|' . $room . '|' . $C . '|' . $sm . '|' . $G . '|' . $A . '|1', $config_keypass) . '">' . $lang_chat . '</a><br/>';
      echo '<a href="' . $_SERVER["PHP_SELF"] . '?gum_ss=' . xoft_encode('rooms|' . $nick . '||' . $C . '|' . $sm . '|' . $G . '|' . $A . '|1', $config_keypass) . '">' . $lang_change_chatroom . '</a><br/>';
include 'mobtonic.php';
      echo '<div class="footer" style="text-align: center;">&#169; Chat143.com <br/>All Rights Reserved !</div></p>';
    }
  echo '</body>
</html>';

  function filterBadWords($str)
    {
      // words to filter, you can add here some more
      // replace filtered words with
      $badwords = array("2-wap", "htp", " dot ", "http", ">", "\.c0m", "\.in","\lun", "\.fudi", "\.chod", "\.chut", "\.bhen", "%>", "\.di", "\.mobi", "\.net", "\.ru", "\.org", "\.wen", "\.com", "\.web.tr", "dhoomworld", "Chatworld", "Mobichat", "Desiclub", "Friendsgarage", "Friendsgarage", "Loverslane", "Mixit", "Mxit", "Prodigits", "Leeinc", "Eaglesnest", "Wap2chat", "Bdsaint", "Hitler", "Nazi", "Chod", "Wichser");
      $replacements = array("???", "***");
      for ($i = 0; $i < sizeof($badwords); $i++)
        {
          srand((double)microtime() * 1000000);
          $rand_key = (rand() % sizeof($replacements));
          $str = eregi_replace($badwords[$i], $replacements[$rand_key], $str);
        }
      return $str;
    }
  function filterFlood($str)
    {
      // words to filter, you can add here some more
      $text = str_replace('~~', '', $text);
      $text = str_replace('@@', '', $text);
      $text = str_replace('-', ' - ', $text);
      $text = str_replace('___', '_', $text);
      $text = str_replace('__', '_', $text);
      $text = str_replace(" . ..", " .", $text);
      $text = str_replace(".. . ", ". ", $text);
      $text = str_replace(" . . ", " ", $text);
      $text = str_replace(" . ", " ", $text);
      $text = str_replace("...", "..", $text);
      $text = str_replace("   ", " ", $text);
      $text = str_replace("  ", " ", $text);
      $text = str_replace('??', "", $text);
      $text = str_replace('**', "", $text);
      $text = str_replace('* *', "", $text);
      $text = str_replace('? ?', "", $text);
      //[:punct:]
      $text = str_replace("\\", "", $text);
      $_number = preg_replace('/[^[:digit:]\^]/','',$text);
     if(strlen($_number) > 4) $text = preg_replace('/\d/', '', $text);
      // replace filtered words with
      $badwords = array("jdt", "gmg", "tpt", "jmt", "jmj", "mpw", "jwp", "twt", "gjg", "jdj", "tjd", "djd", "dtd", "gdg", "pjp", "kdk", "dtj", "www", "pjg", "gwg", "pdp", "kmk", "wvw", "gaga", "tjt", "mjm", "wpw", "@@", "momo", "mwm", "mvm", "gmg");
      $replacements = array("");
      for ($i = 0; $i < sizeof($badwords); $i++)
        {
          srand((double)microtime() * 1000000);
          $rand_key = (rand() % sizeof($replacements));
          $str = eregi_replace($badwords[$i], $replacements[$rand_key], $str);
        }
      return $str;
    }

  function ReplaceTextToSmilies($str)
    {
      $dir = "smilies/";
      if (is_dir($dir))
        {
          if ($dh = opendir($dir))
            {
              $smilie_count = 0;
              while (($file = readdir($dh)) !== false)
                {
                  $smilie = explode(".", $file);
                  if ($file != '.' && $file != '..')
                    {
                      if (preg_match("/\." . $smilie[0] . "\./i", $str))
                          $smilie_count++;
                      if ($smilie_count < 4)
                        {
                          $str = preg_replace('(\.' . $smilie[0] . '\.)', '<img src="' . $dir . $file . '" alt="' . $smilie[0] . '" />', $str, 1);
                        }
                      elseif ($smilie_count > 3)
                          break;
                    }
                }
              closedir($dh);
            }
        }
      return $str;
    }


  function replace($text)
    {
      $text = trim($text);
      $text = strip_tags($text);
      $text = stripslashes($text);
      $text = preg_replace("(\r\n|\n|\r)", "", $text);
      $text = str_replace('(www)', '', $text);
      $text = preg_replace('/[^[:space:][:alnum:]\@\.\:\,\-\+\!\?\'\_\"\(\)\]\[\=\}\{\%\*\~\#\<\>\^]/', '', $text);
      $text = str_replace("\$", "*", $text);
      return $text;
    }
  function nick_replace($text)
    {
      $text = trim($text);
      $text = str_replace(" ", "_", $text);
      $text = str_replace("__", "_", $text);
      $text = str_replace("--", "-", $text);
      $text = preg_replace("(\r\n|\n|\r)", "", $text);
      $text = preg_replace('/[^[:alnum:]\_\@\-\^]/', '', $text);
      return $text;
    }
  function color_check($color)
    {
      if (!preg_match('/(000000|ff0000|00ffff|808080|ff8040|804000|00ff00|ffff00|ff00ff|408080|008000|800000|0000a0)/i', $color))
          return '009b00';
      else
          return $color;
    }
  //////////////////DECODE URLS/////////

  function xoft_encode($plain_data, $config_keypass)
    {
      $key_length = 0;
      $all_bin_chars = "";
      $cipher_data = "";
      for ($i = 0; $i < strlen($plain_data); $i++)
        {
          $p = substr($plain_data, $i, 1);
          $k = substr($config_keypass, $key_length, 1);
          $key_length++;
          if ($key_length >= strlen($config_keypass))
            {
              $key_length = 0;
            }
          $dec_chars = ord($p) ^ ord($k);
          $dec_chars = $dec_chars + strlen($config_keypass);
          $bin_chars = decbin($dec_chars);
          while (strlen($bin_chars) < 8)
            {
              $bin_chars = "0" . $bin_chars;
            }
          $all_bin_chars = $all_bin_chars . $bin_chars;
        }
      $m = 0;
      for ($j = 0; $j < strlen($all_bin_chars); $j = $j + 4)
        {
          $four_bit = substr($all_bin_chars, $j, 4);
          $four_bit_dec = bindec($four_bit);
          $decimal_value = $four_bit_dec * 4 + $m;
          $base64_value = dec_to_base64($decimal_value);
          $cipher_data = $cipher_data . $base64_value;
          $m++;
          if ($m > 3)
            {
              $m = 0;
            }
        }
      return $cipher_data;
    }
  ///////////////////////////////////////////////
  function xoft_decode($cipher_data, $config_keypass)
    {
      $m = 0;
      $all_bin_chars = "";
      for ($i = 0; $i < strlen($cipher_data); $i++)
        {
          $c = substr($cipher_data, $i, 1);
          $decimal_value = base64_to_dec($c);
          $decimal_value = ($decimal_value - $m) / 4;
          $four_bit = decbin($decimal_value);
          while (strlen($four_bit) < 4)
            {
              $four_bit = "0" . $four_bit;
            }
          $all_bin_chars = $all_bin_chars . $four_bit;
          $m++;
          if ($m > 3)
            {
              $m = 0;
            }
        }
      $key_length = 0;
      $plain_data = "";
      for ($j = 0; $j < strlen($all_bin_chars); $j = $j + 8)
        {
          $c = substr($all_bin_chars, $j, 8);
          $k = substr($config_keypass, $key_length, 1);
          $dec_chars = bindec($c);
          $dec_chars = $dec_chars - strlen($config_keypass);
          $c = chr($dec_chars);
          $key_length++;
          if ($key_length >= strlen($config_keypass))
            {
              $key_length = 0;
            }
          $dec_chars = ord($c) ^ ord($k);
          $p = chr($dec_chars);
          $plain_data = $plain_data . $p;
        }
      return $plain_data;
    }
  /////////////////////////////////////
  function base64_to_dec($str)
    {
      $str = strtr($str, array("=" => "64", "/" => "63", "+" => "62", "9" => "61", "8" => "60", "7" => "59", "6" => "58", "5" => "57", "4" => "56", "3" => "55", "2" => "54", "1" => "53", "0" => "52", "z" => "51", "y" => "50", "x" => "49", "w" => "48", "v" => "47", "u" => "46", "t" => "45", "s" => "44", "r" => "43", "q" => "42", "p" => "41", "o" => "40", "n" => "39", "m" => "38", "l" => "37", "k" => "36", "j" => "35", "i" => "34", "h" => "33", "g" => "32", "f" => "31", "e" => "30", "d" => "29", "c" => "28", "b" => "27", "a" => "26", "Z" => "25", "Y" => "24", "X" => "23", "W" => "22", "V" => "21", "U" => "20", "T" => "19", "S" => "18", "R" => "17", "Q" => "16", "P" => "15", "O" => "14", "N" => "13", "M" => "12", "L" => "11", "K" => "10", "J" => "9", "I" => "8", "H" => "7", "G" => "6", "F" => "5", "E" => "4", "D" => "3", "C" => "2", "B" => "1", "A" => "0"));
      return $str;
    }
  /////////////////////////////////////
  function dec_to_base64($str)
    {
      $str = strtr($str, array("64" => "=", "63" => "/", "62" => "+", "61" => "9", "60" => "8", "59" => "7", "58" => "6", "57" => "5", "56" => "4", "55" => "3", "54" => "2", "53" => "1", "52" => "0", "51" => "z", "50" => "y", "49" => "x", "48" => "w", "47" => "v", "46" => "u", "45" => "t", "44" => "s", "43" => "r", "42" => "q", "41" => "p", "40" => "o", "39" => "n", "38" => "m", "37" => "l", "36" => "k", "35" => "j", "34" => "i", "33" => "h", "32" => "g", "31" => "f", "30" => "e", "29" => "d", "28" => "c", "27" => "b", "26" => "a", "25" => "Z", "24" => "Y", "23" => "X", "22" => "W", "21" => "V", "20" => "U", "19" => "T", "18" => "S", "17" => "R", "16" => "Q", "15" => "P", "14" => "O", "13" => "N", "12" => "M", "11" => "L", "10" => "K", "9" => "J", "8" => "I", "7" => "H", "6" => "G", "5" => "F", "4" => "E", "3" => "D", "2" => "C", "1" => "B", "0" => "A"));
      return $str;
    }
  ///////////////////////////////////////////////////////////////////////////
  // END OF SCRIPT ENJOY!
  ///////////////////////////////////////////////////////////////////////////
?>