How Limit Smiles On Chat?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How Limit Smiles On Chat?

    ..................................................
    Last edited by Guest; 10.08.17, 00:35.

    #2
    <div class='quotetop'>QUOTE (kesaz @ Mar 2 2009, 05:39 PM) <{POST_SNAPBACK}></div>
    need some help limit smiles per message, like anti flood, any help? [/b]
    else if($nos>1){
    $chnick = getnick_uid($chat[0]);
    $sim = getsimbol($chat[0]);
    echo "$sim*$chnick, try to limited to only one emotion to the message!
    ";

    Comment


      #3
      pmpl,

      First you will need to infrom the users what script you are using..
      Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
      Visit: WapMasterz Coming Back Soon!
      _______
      SCRIPTS FOR SALE BY SUBZERO
      Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
      FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
      _______
      Info & Tips
      php.net
      w3schools.com

      Comment


        #4
        <div class='quotetop'>QUOTE (valentin2br @ Mar 2 2009, 05:11 PM) <{POST_SNAPBACK}></div>
        else if($nos>1){
        $chnick = getnick_uid($chat[0]);
        $sim = getsimbol($chat[0]);
        echo "$sim*$chnick, try to limited to only one emotion to the message!
        ";[/b]
        is this for lava chat? thanks :D

        Comment


          #5
          use this function:

          Code:
          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 != &#39;.&#39; && $file != &#39;..&#39;) {
                                if (preg_match("/\." . $smilie[0] . "\./i", $str))
                                    $smilie_count++;
                                if ($smilie_count < 4)
                                    $str = preg_replace(&#39;(\.&#39; . $smilie[0] . &#39;\.)&#39;, &#39;[img]&#39; . $dir . $file . &#39;[/img]&#39;, $str, 1);
                                //$str = str_replace(&#39;.&#39;.$smilie[0].&#39;.&#39;, &#39;[img]&#39;.$dir.$file.&#39;[/img]&#39;, $str);
                                elseif ($smilie_count > 3)
                                    break;
                            }
                        }
                        closedir($dh);
                    }
                }
                return $str;
            }
          Add it somewhere in the end to the script before ?>,

          and then replace

          Code:
           if($sm==1){
                     $udata[2]=str_replace(".angel.","<img src=\"smilies/angel.gif\" alt=\".angel.\"/>",$udata[2]);
                     $udata[2]=str_replace(".angry.","<img src=\"smilies/angry.gif\" alt=\".angry.\"/>",$udata[2]);
                     $udata[2]=str_replace(".baringteeth.","<img src=\"smilies/baringteeth.gif\" alt=\".baringteeth.\"/>",$udata[2]);
                     $udata[2]=str_replace(".confused.","<img src=\"smilies/confused.gif\" alt=\".confused.\"/>",$udata[2]);
                     $udata[2]=str_replace(".devil.","<img src=\"smilies/devil.gif\" alt=\".devil.\"/>",$udata[2]);
                     $udata[2]=str_replace(".embaressed.","<img src=\"smilies/embaressed.gif\" alt=\".embaressed.\"/>",$udata[2]);
                     $udata[2]=str_replace(".nerd.","<img src=\"smilies/nerd.gif\" alt=\".nerd.\"/>",$udata[2]);
                     $udata[2]=str_replace(".omg.","<img src=\"smilies/omg.gif\" alt=\".omg.\"/>",$udata[2]);
                     $udata[2]=str_replace(".party.","<img src=\"smilies/party.gif\" alt=\".party.\"/>",$udata[2]);
                     $udata[2]=str_replace(".regular.","<img src=\"smilies/regular.gif\" alt=\".regular.\"/>",$udata[2]);
                     $udata[2]=str_replace(".sarcastic.","<img src=\"smilies/sarcastic.gif\" alt=\".sarcastic.\"/>",$udata[2]);
                     $udata[2]=str_replace(".secret.","<img src=\"smilies/secret.gif\" alt=\".secret.\"/>",$udata[2]);
                     $udata[2]=str_replace(".shades.","<img src=\"smilies/shades.gif\" alt=\".shades.\"/>",$udata[2]);
                     $udata[2]=str_replace(".sick.","<img src=\"smilies/sick.gif\" alt=\".sick.\"/>",$udata[2]);
                     $udata[2]=str_replace(".speedy.","<img src=\"smilies/speedy.gif\" alt=\".speedy.\"/>",$udata[2]);
                     $udata[2]=str_replace(".teeth.","<img src=\"smilies/teeth.gif\" alt=\".teeth.\"/>",$udata[2]);
                     $udata[2]=str_replace(".thinking.","<img src=\"smilies/thinking.gif\" alt=\".thinking.\"/>",$udata[2]);
                     $udata[2]=str_replace(".tongue.","<img src=\"smilies/tongue.gif\" alt=\".tongue.\"/>",$udata[2]);
                     $udata[2]=str_replace(".whatchutalkingabout.","<img src=\"smilies/whatchutalkingabout.gif\" alt=\".whatchutalkingabout.\"/>",$udata[2]);
                     $udata[2]=str_replace(".wink.","<img src=\"smilies/wink.gif\" alt=\".wink.\"/>",$udata[2]);
                     $udata[2]=str_replace(".zipit.","<img src=\"smilies/zipit.gif\" alt=\".zipit.\"/>",$udata[2]);
                     $udata[2]=str_replace(".angelic.","<img src=\"smilies/angelic.gif\" alt=\".angelic.\"/>",$udata[2]);
                     $udata[2]=str_replace(".annoyed.","<img src=\"smilies/annoyed.gif\" alt=\".annoyed.\"/>",$udata[2]);
                     $udata[2]=str_replace(".blah.","<img src=\"smilies/tongue.gif\" alt=\".blah.\"/>",$udata[2]);
                     $udata[2]=str_replace(".bored.","<img src=\"smilies/bored.gif\" alt=\".bored.\"/>",$udata[2]);
                     $udata[2]=str_replace(".brooding.","<img src=\"smilies/brooding.gif\" alt=\".brooding.\"/>",$udata[2]);
                     $udata[2]=str_replace(".cheerful.","<img src=\"smilies/cheerful.gif\" alt=\".cheerful.\"/>",$udata[2]);
                     $udata[2]=str_replace(".content.","<img src=\"smilies/content.gif\" alt=\".content.\"/>",$udata[2]);
                     $udata[2]=str_replace(".cussing.","<img src=\"smilies/cussing.gif\" alt=\".cussing.\"/>",$udata[2]);
                     $udata[2]=str_replace(".devlish.","<img src=\"smilies/devlish.gif\" alt=\".devlish.\"/>",$udata[2]);
                     $udata[2]=str_replace(".dozey.","<img src=\"smilies/dozey.gif\" alt=\".dozey.\"/>",$udata[2]);
                     $udata[2]=str_replace(".dunce.","<img src=\"smilies/dunce.gif\" alt=\".dunce.\"/>",$udata[2]);
                     $udata[2]=str_replace(".embarassed.","<img src=\"smilies/embarassed.gif\" alt=\".embarassed.\"/>",$udata[2]);
                     $udata[2]=str_replace(".frustrated.","<img src=\"smilies/frustrated.gif\" alt=\".frustrated.\"/>",$udata[2]);
                     $udata[2]=str_replace(".gloomy.","<img src=\"smilies/gloomy.gif\" alt=\".gloomy.\"/>",$udata[2]);
                     $udata[2]=str_replace(".goofy.","<img src=\"smilies/goofy.gif\" alt=\".goofy.\"/>",$udata[2]);
                     $udata[2]=str_replace(".happy.","<img src=\"smilies/happy.gif\" alt=\".happy.\"/>",$udata[2]);
                     $udata[2]=str_replace(".horny.","<img src=\"smilies/horny.gif\" alt=\".horny.\"/>",$udata[2]);
                     $udata[2]=str_replace(".Icky.","<img src=\"smilies/Icky.gif\" alt=\".Icky.\"/>",$udata[2]);
                     $udata[2]=str_replace(".irritated.","<img src=\"smilies/irritated.gif\" alt=\".irritated.\"/>",$udata[2]);
                     $udata[2]=str_replace(".loved.","<img src=\"smilies/loved.gif\" alt=\".loved.\"/>",$udata[2]);
                     $udata[2]=str_replace(".mellow.","<img src=\"smilies/mellow.gif\" alt=\".mellow.\"/>",$udata[2]);
                     $udata[2]=str_replace(".nerdy.","<img src=\"smilies/nerdy.gif\" alt=\".nerdy.\"/>",$udata[2]);
                     $udata[2]=str_replace(".pissy.","<img src=\"smilies/pissy.gif\" alt=\".pissy.\"/>",$udata[2]);
                     $udata[2]=str_replace(".sad.","<img src=\"smilies/sad.gif\" alt=\".sad.\"/>",$udata[2]);
                     $udata[2]=str_replace(".shy.","<img src=\"smilies/shy.gif\" alt=\".shy.\"/>",$udata[2]);
                     $udata[2]=str_replace(".sleepy.","<img src=\"smilies/sleepy.gif\" alt=\".sleepy.\"/>",$udata[2]);
                     $udata[2]=str_replace(".smartass.","<img src=\"smilies/smartass.gif\" alt=\".smartass.\"/>",$udata[2]);
                     $udata[2]=str_replace(".sneaky.","<img src=\"smilies/sneaky.gif\" alt=\".sneaky.\"/>",$udata[2]);
                     $udata[2]=str_replace(".unsure.","<img src=\"smilies/unsure.gif\" alt=\".unsure.\"/>",$udata[2]);
                     }
          by this code
          Code:
          if($sm==1) $udata[2]=ReplaceTextToSmilies($udata[2]);
          Advertise your mobile site for FREE with AdTwirl

          Comment


            #6
            <div class='quotetop'>QUOTE (uNrEaL @ Mar 2 2009, 08:16 PM) <{POST_SNAPBACK}></div>
            is this for lava chat? thanks :D[/b]
            depends on...
            but for sure you can also place it in lava
            Advertise your mobile site for FREE with AdTwirl

            Comment


              #7
              <div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'><?
              /////////////////////////////////////////////////////////////////////////////////////////////////
              // //
              // GumChat //
              // Current Version : 1.05 //
              // Author : GUMSLONE //
              // You you can redistribute it and/or modify this script but please always put author&#39;s name //
              // Copyright © 2005 GumSlone. All rights reserved. //
              // Additional scripts can be found at http://www.wapforum.org.uk //
              // 30.12.2005 //
              /////////////////////////////////////////////////////////////////////////////////////////////////

              ///////////////////////////////////////////////////////////////////////////
              // CONFIGURATION STARTS HERE
              ///////////////////////////////////////////////////////////////////////////

              $TimeZone="0"; //0 means server time

              $New_Time = time() + ($TimeZone * 60 * 60);// hours* 60 mins* 60secs DONT TOUCH!

              $_time=date("H:i",$New_Time); //DONT TOUCH!

              $_refresh=200; //chatroom refreshtime

              $_room_size=15; //means chatroom size of 15 messages

              $home_page_url="http://2wap.net";

              $home_page_title="2wap.net";

              $encoding="UTF-8"; //DONT TOUCH!
              //$encoding="UTF-8"; //dlja Russkogo (Kirilica) its for russian language

              $_translit="0"; //Its only for russians!!! Do not change! Dlja perewoda s translita w russkij postawte mesto "0" edinicu "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_select_chatroom="Select Chatroom";

              $lang_users="Users in";

              $lang_chatrooms="Chatrooms";

              $lang_smilies="Smilies";

              $lang_next="Next »";

              $lang_prev="« Prev";

              $lang_chat="Back to Chatroom";

              $lang_say="Say";

              $lang_refresh="Refresh";

              $lang_message="Message:";

              $lang_ok="OK";

              $lang_change_chatroom="Change Chatroom";

              $lang_who_is_online="Who&#39;s Inside";

              $lang_loading="Loading...
              please wait";

              $lang_exit="Logout";


              ///////////////////////////////////////////////////////////////////////////
              // CONFIGURATION ENDS HERE
              ///////////////////////////////////////////////////////////////////////////

              /////////////[DO NOT EDIT AFTER THIS LINE]////////////////////////////////


              header("Content-type: text/vnd.wap.wml; charset=$encoding");
              header("Cache-Control: no-store, no-cache, must-revalidate");
              print "<?xml version=\"1.0\"?>";
              echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"". " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
              ?>




              <wml>
              <?php
              if ($nick&&$room) {
              $daten="online/on$room";
              $time = time();
              $user = explode (&#39;/&#39;, $HTTP_USER_AGENT);
              $ip = ("!$nick!$user[0]!$REMOTE_ADDR!$G!$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 "<card id=\"GumChat\" title=\"GumChat $_time\">";
              echo "<p align=\"center\">";
              echo "<img src=\"logo.gif\" alt=\"GumChat\"/>
              ";
              $n = 0;
              $files = &#39;&#39;;
              if ($handle = opendir("rooms/"))
              {
              while (false !== ($file = readdir($handle)))
              {
              if($file != &#39;.&#39; && $file != &#39;..&#39; && $file != &#39;files&#39;&& $file != &#39;cgi-bin&#39;&& $file != &#39;chat&#39;)
              {
              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 "$total $lang_user_in_chat!
              ";
              echo "$lang_nickname <input name=\"us\" maxlength=\"20\"/>
              ";
              echo $lang_gender.&#39;
              <select name="g" multiple="false">
              <option value="m">&#39;.$lang_male.&#39;</option>
              <option value="f">&#39;.$lang_female.&#39;</option>
              </select>
              &#39;;
              echo"$lang_age<input name=\"a\" maxlength=\"2\" format=\"NN\" size=\"2\"/>
              ";
              echo $lang_show_smilies.&#39;
              <select name="sm" multiple="false">
              <option value="1">&#39;.$lang_yes.&#39;</option>
              <option value="0">&#39;.$lang_no.&#39;</option>
              </select>
              &#39;;
              echo "<anchor title=\"Enter\">$lang_enter";
              echo "<go href=\"".$_SERVER["PHP_SELF"]."?gum=rooms&amp;nick=$(us)&amp;sm=$(sm)&amp;G=$(g )&amp;A=$(a)\" method=\"post\">";
              echo "<postfield name=\"userreg\" value=\"\$us\"/>";
              echo "</go>";
              echo "</anchor>";
              echo "

              <a href=\"$home_page_url\">$home_page_title</a>";
              echo "
              © GumSlone</p>";
              echo "</card>";
              }


              if ($gum=="rooms") {
              echo "<card id=\"ChatRooms\" title=\"$lang_chatrooms ($_time)\">";
              echo "<do type=\"options\" name=\"2wap\" label=\"2WAP.NET\"><go href=\"http://2wap.net/index.php\" method=\"get\"/></do>";
              echo "<p align=\"center\">";
              $nick = ereg_replace(" ", "_", $nick);
              if(preg_match("/[^\da-zA-Z-@#!_]+/", $nick)||$nick=="") $error=&#39;Not suported chars in Nickname!
              &#39;;
              if(empty($error)){
              echo "$lang_select_chatroom
              ";
              $n = 0;
              $files = &#39;&#39;;
              if ($handle = opendir("rooms/"))
              {
              while (false !== ($file = readdir($handle)))
              {
              if($file != &#39;.&#39; && $file != &#39;..&#39; && $file != &#39;files&#39;&& $file != &#39;cgi-bin&#39;&& $file != &#39;chat&#39;)
              {
              if($n >= 0 && $n < 20){
              $onfile=file("online/on$file");
              $counts=count($onfile);
              $total=$total+$counts;
              $n++;
              echo "<a href=\"".$_SERVER["PHP_SELF"]."?gum=croom&amp;nick=$nick&amp;sm=$sm&amp;G=$G&am p;A=$A&amp;room=$file\">$file [$counts]</a>
              ";
              }
              }
              }
              closedir($handle);
              }
              }else
              echo $error."<anchor>Back<prev/></anchor>
              ";
              echo "
              $total $lang_users $n $lang_chatrooms!";
              echo "
              © GumSlone</p>";
              echo "</card>";
              }


              if ($gum=="add") {
              $mess = eregi_replace(&#39; &#39;, &#39; &#39;, $mess);
              if($nick==""||$nick==" ")
              echo &#39;<card id="card0" title="..." ontimer="index.php"><timer value="10"/>&#39;;
              elseif($mess==""||$mess==" ")
              echo "<card id=\"card0\" title=\"loading...\" ontimer=\"".$_SERVER["PHP_SELF"]."?gum=croom&amp;nick=$nick&amp;sm=$sm&amp;G=$G&am p;A=$A&amp;room=$room\"><timer value=\"10\"/>";
              else{
              echo "<card id=\"card0\" title=\"loading...\" ontimer=\"".$_SERVER["PHP_SELF"]."?gum=croom&amp;nick=$nick&amp;sm=$sm&amp;G=$G&am p;A=$A&amp;room=$room\"><timer value=\"10\"/>";
              echo "<do type=\"options\" name=\"refresh\" label=\"Chatroom\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=croom&amp;nick=$nick&amp;sm=$sm&amp;G=$G&am p;A=$A&amp;room=$room&amp;r=".$New_Time."\" method=\"get\"/></do>";
              echo "<do type=\"options\" name=\"2wap\" label=\"2WAP.NET\"><go href=\"http://2wap.net/index.php\" method=\"get\"/></do>";
              echo "<p align=\"center\">$lang_loading</p>";
              $xfile = @file("rooms/$room");
              $check = explode("&&",$xfile[0]);
              $check2 = explode("&&",$xfile[1]);
              if("$mess"!="$check[2]"&&"$mess"!="$check2[2]"){
              $nick = ereg_replace(" ", "_", $nick);
              $nick=substr(trim($nick),0,20);
              $text = "&&$nick $_time&&$mess&&";

              $text = stripslashes($text);
              $text = ereg_replace("\n", " ", $text);
              $text = ereg_replace("\r", "", $text);
              $text = ereg_replace("~", "-", $text);
              $text = str_replace(&#39;$&#39;, &#39;$$&#39;, $text);
              $text = ereg_replace("have a nice day", "censored", $text);
              $text = ereg_replace("have a nice day", "censored", $text);
              $text = ereg_replace("nazi", "censored", $text);
              $text = ereg_replace("Nazi", "censored", $text);
              $text = ereg_replace("NAZI", "censored", $text);
              $text = ereg_replace("FUK", "censored", $text);
              $text = ereg_replace("Fuk", "censored", $text);
              $text = ereg_replace("fuk", "censored", $text);
              $text = ereg_replace("Hitler", "Ich bin ein Arschloch", $text);
              $text = ereg_replace("hitler", "Ich bin ein Arschloch", $text);
              $text = ereg_replace("have a nice day", "censored", $text);
              $text = ereg_replace("f.u.c.k", "censored", $text);
              $text = ereg_replace("Bitch", "censored", $text);
              $text = ereg_replace("bitch", "censored", $text);
              $text = ereg_replace("have a nice day", "censored", $text);
              $text = ereg_replace("have a nice day", "censored", $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);
              }
              }
              echo "</card>";
              }


              if ($gum=="croom") {
              $onxfile = @file("online/on$room");
              $countonl= count($onxfile);
              echo "<card id=\"card0\" title=\"$room in $countonl ($_time)\" ontimer=\"".$_SERVER["PHP_SELF"]."?gum=croom&amp;nick=$nick&amp;sm=$sm&amp;G=$G&am p;A=$A&amp;room=$room&amp;r=";
              echo $New_Time;
              echo "\"><timer value=\"$_refresh\"/>";
              echo "<do type=\"options\" name=\"say\" label=\"$lang_say\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=say&amp;nick=$nick&amp;sm=$sm&amp;G=$G&amp; A=$A&amp;room=$room&amp;r=".$New_Time."\" method=\"get\"/></do>";
              echo "<do type=\"options\" name=\"refresh\" label=\"$lang_refresh\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=croom&amp;nick=$nick&amp;sm=$sm&amp;G=$G&am p;A=$A&amp;room=$room&amp;r=".$New_Time."\" method=\"get\"/></do>";
              echo "<do type=\"options\" name=\"whowhere\" label=\"$lang_who_is_online\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=online&amp;nick=$nick&amp;sm=$sm&amp;G=$G&a mp;A=$A&amp;room=$room\" method=\"get\"/></do>";
              echo "<do type=\"options\" name=\"changeroom\" label=\"$lang_change_chatroom\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=rooms&amp;nick=$nick&amp;sm=$sm&amp;G=$G&am p;A=$A\" method=\"get\"/></do>";
              echo "<do type=\"options\" name=\"smilies\" label=\"$lang_smilies\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=smilies&amp;nick=$nick&amp;sm=$sm&amp;G=$G& amp;A=$A&amp;room=$room\" method=\"get\"/></do>";
              echo "<do type=\"options\" name=\"2wap\" label=\"2WAP.NET\"><go href=\"http://2wap.net/index.php\" method=\"get\"/></do>";
              echo "<p align=\"left\">";
              echo "<a href=\"".$_SERVER["PHP_SELF"]."?gum=say&amp;nick=$nick&amp;sm=$sm&amp;G=$G&amp; A=$A&amp;room=$room&amp;r=";
              echo $New_Time;
              echo "\">$lang_say</a> ";
              echo " <a href=\"".$_SERVER["PHP_SELF"]."?gum=croom&amp;nick=$nick&amp;sm=$sm&amp;G=$G&am p;A=$A&amp;room=$room&amp;r=";
              echo $New_Time;
              echo "\">$lang_refresh</a>
              ";

              $fp = FOpen("rooms/$room", "r");
              while ($radka = FGetS($fp, 512))
              {
              $udata = explode("&&",$radka);
              $udata[2]=htmlspecialchars($udata[2]);
              $udata[2] = eregi_replace(&#39((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)&#39;,&#39;\\1&#39;, $udata[2]);
              $udata[2] = eregi_replace(&#39[[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)&#39;,&#39;\\1\\2&#39;, $udata[2]);

              if($sm==1) $udata[2]=ReplaceTextToSmilies($udata[2]);
              /*
              if($sm==1){
              $udata[2]=str_replace(".angel.","<img src=\"smilies/angel.gif\" alt=\".angel.\"/>",$udata[2]);
              $udata[2]=str_replace(".angry.","<img src=\"smilies/angry.gif\" alt=\".angry.\"/>",$udata[2]);
              $udata[2]=str_replace(".baringteeth.","<img src=\"smilies/baringteeth.gif\" alt=\".baringteeth.\"/>",$udata[2]);
              $udata[2]=str_replace(".confused.","<img src=\"smilies/confused.gif\" alt=\".confused.\"/>",$udata[2]);
              $udata[2]=str_replace(".devil.","<img src=\"smilies/devil.gif\" alt=\".devil.\"/>",$udata[2]);
              $udata[2]=str_replace(".embaressed.","<img src=\"smilies/embaressed.gif\" alt=\".embaressed.\"/>",$udata[2]);
              $udata[2]=str_replace(".nerd.","<img src=\"smilies/nerd.gif\" alt=\".nerd.\"/>",$udata[2]);
              $udata[2]=str_replace(".omg.","<img src=\"smilies/omg.gif\" alt=\".omg.\"/>",$udata[2]);
              $udata[2]=str_replace(".party.","<img src=\"smilies/party.gif\" alt=\".party.\"/>",$udata[2]);
              $udata[2]=str_replace(".regular.","<img src=\"smilies/regular.gif\" alt=\".regular.\"/>",$udata[2]);
              $udata[2]=str_replace(".sarcastic.","<img src=\"smilies/sarcastic.gif\" alt=\".sarcastic.\"/>",$udata[2]);
              $udata[2]=str_replace(".secret.","<img src=\"smilies/secret.gif\" alt=\".secret.\"/>",$udata[2]);
              $udata[2]=str_replace(".shades.","<img src=\"smilies/shades.gif\" alt=\".shades.\"/>",$udata[2]);
              $udata[2]=str_replace(".sick.","<img src=\"smilies/sick.gif\" alt=\".sick.\"/>",$udata[2]);
              $udata[2]=str_replace(".speedy.","<img src=\"smilies/speedy.gif\" alt=\".speedy.\"/>",$udata[2]);
              $udata[2]=str_replace(".teeth.","<img src=\"smilies/teeth.gif\" alt=\".teeth.\"/>",$udata[2]);
              $udata[2]=str_replace(".thinking.","<img src=\"smilies/thinking.gif\" alt=\".thinking.\"/>",$udata[2]);
              $udata[2]=str_replace(".tongue.","<img src=\"smilies/tongue.gif\" alt=\".tongue.\"/>",$udata[2]);
              $udata[2]=str_replace(".whatchutalkingabout.","<img src=\"smilies/whatchutalkingabout.gif\" alt=\".whatchutalkingabout.\"/>",$udata[2]);
              $udata[2]=str_replace(".wink.","<img src=\"smilies/wink.gif\" alt=\".wink.\"/>",$udata[2]);
              $udata[2]=str_replace(".zipit.","<img src=\"smilies/zipit.gif\" alt=\".zipit.\"/>",$udata[2]);
              $udata[2]=str_replace(".angelic.","<img src=\"smilies/angelic.gif\" alt=\".angelic.\"/>",$udata[2]);
              $udata[2]=str_replace(".annoyed.","<img src=\"smilies/annoyed.gif\" alt=\".annoyed.\"/>",$udata[2]);
              $udata[2]=str_replace(".blah.","<img src=\"smilies/tongue.gif\" alt=\".blah.\"/>",$udata[2]);
              $udata[2]=str_replace(".bored.","<img src=\"smilies/bored.gif\" alt=\".bored.\"/>",$udata[2]);
              $udata[2]=str_replace(".brooding.","<img src=\"smilies/brooding.gif\" alt=\".brooding.\"/>",$udata[2]);
              $udata[2]=str_replace(".cheerful.","<img src=\"smilies/cheerful.gif\" alt=\".cheerful.\"/>",$udata[2]);
              $udata[2]=str_replace(".content.","<img src=\"smilies/content.gif\" alt=\".content.\"/>",$udata[2]);
              $udata[2]=str_replace(".cussing.","<img src=\"smilies/cussing.gif\" alt=\".cussing.\"/>",$udata[2]);
              $udata[2]=str_replace(".devlish.","<img src=\"smilies/devlish.gif\" alt=\".devlish.\"/>",$udata[2]);
              $udata[2]=str_replace(".dozey.","<img src=\"smilies/dozey.gif\" alt=\".dozey.\"/>",$udata[2]);
              $udata[2]=str_replace(".dunce.","<img src=\"smilies/dunce.gif\" alt=\".dunce.\"/>",$udata[2]);
              $udata[2]=str_replace(".embarassed.","<img src=\"smilies/embarassed.gif\" alt=\".embarassed.\"/>",$udata[2]);
              $udata[2]=str_replace(".frustrated.","<img src=\"smilies/frustrated.gif\" alt=\".frustrated.\"/>",$udata[2]);
              $udata[2]=str_replace(".gloomy.","<img src=\"smilies/gloomy.gif\" alt=\".gloomy.\"/>",$udata[2]);
              $udata[2]=str_replace(".goofy.","<img src=\"smilies/goofy.gif\" alt=\".goofy.\"/>",$udata[2]);
              $udata[2]=str_replace(".happy.","<img src=\"smilies/happy.gif\" alt=\".happy.\"/>",$udata[2]);
              $udata[2]=str_replace(".horny.","<img src=\"smilies/horny.gif\" alt=\".horny.\"/>",$udata[2]);
              $udata[2]=str_replace(".Icky.","<img src=\"smilies/Icky.gif\" alt=\".Icky.\"/>",$udata[2]);
              $udata[2]=str_replace(".irritated.","<img src=\"smilies/irritated.gif\" alt=\".irritated.\"/>",$udata[2]);
              $udata[2]=str_replace(".loved.","<img src=\"smilies/loved.gif\" alt=\".loved.\"/>",$udata[2]);
              $udata[2]=str_replace(".mellow.","<img src=\"smilies/mellow.gif\" alt=\".mellow.\"/>",$udata[2]);
              $udata[2]=str_replace(".nerdy.","<img src=\"smilies/nerdy.gif\" alt=\".nerdy.\"/>",$udata[2]);
              $udata[2]=str_replace(".pissy.","<img src=\"smilies/pissy.gif\" alt=\".pissy.\"/>",$udata[2]);
              $udata[2]=str_replace(".sad.","<img src=\"smilies/sad.gif\" alt=\".sad.\"/>",$udata[2]);
              $udata[2]=str_replace(".shy.","<img src=\"smilies/shy.gif\" alt=\".shy.\"/>",$udata[2]);
              $udata[2]=str_replace(".sleepy.","<img src=\"smilies/sleepy.gif\" alt=\".sleepy.\"/>",$udata[2]);
              $udata[2]=str_replace(".smartass.","<img src=\"smilies/smartass.gif\" alt=\".smartass.\"/>",$udata[2]);
              $udata[2]=str_replace(".sneaky.","<img src=\"smilies/sneaky.gif\" alt=\".sneaky.\"/>",$udata[2]);
              $udata[2]=str_replace(".unsure.","<img src=\"smilies/unsure.gif\" alt=\".unsure.\"/>",$udata[2]);
              } */
              if($_translit==1){
              $tran = array(
              "A"=>"?","a"=>"?","B"=>"?","b"=>"?","V"=>"?",
              "v"=>"?","G"=>"?","g"=>"?","D"=>"?","d"=>"?",
              "E"=>"?","e"=>"?","yo"=>"?","Zh"=>"?","zh"=>"? ",
              "Z"=>"?","z"=>"?","I"=>"?","i"=>"?","J"=>"?",
              "j"=>"?","K"=>"?","k"=>"?","L"=>"?","l"=>"?",
              "M"=>"?","m"=>"?","N"=>"?","n"=>"?","O"=>"?",
              "o"=>"?","P"=>"?","p"=>"?","R"=>"?","r"=>"?",
              "S"=>"?","s"=>"?","T"=>"?","t"=>"?","U"=>"?",
              "u"=>"?","F"=>"?","f"=>"?","H"=>"?","h"=>"?",
              "C"=>"?","c"=>"?","Ch"=>"?","ch"=>"?","Sh"=>"? ",
              "sh"=>"?","Sch"=>"?","sch"=>"?","&#39;&#39;"=> "?",
              "Y"=>"?","y"=>"?","&#39;"=>"?","Ye"=>"?",
              "ye"=>"?","Yu"=>"?","yu"=>"?","Ya"=>"?","ya"=> "?",
              "Yo"=>"?"
              );

              function latrus($str) {
              global $tran;
              return strtr($str,$tran);
              }
              $udata[2]=latrus($udata[2]);
              }
              echo"".htmlspecialchars($udata[1])." »
              ".$udata[2]."

              ";
              }
              FClose($fp);


              echo "<a href=\"".$_SERVER["PHP_SELF"]."?gum=say&amp;nick=$nick&amp;sm=$sm&amp;G=$G&amp; A=$A&amp;room=$room&amp;r=";
              echo $New_Time;
              echo "\">$lang_say</a> ";
              echo " <a href=\"".$_SERVER["PHP_SELF"]."?gum=croom&amp;nick=$nick&amp;sm=$sm&amp;G=$G&am p;A=$A&amp;room=$room&amp;r=";
              echo $New_Time;
              echo "\">$lang_refresh</a>
              ";
              echo "<a href=\"".$_SERVER["PHP_SELF"]."?gum=online&amp;nick=$nick&amp;sm=$sm&amp;G=$G&a mp;A=$A&amp;room=$room\">$lang_who_is_online</a>
              ";
              echo "<a href=\"".$_SERVER["PHP_SELF"]."?gum=rooms&amp;nick=$nick&amp;sm=$sm&amp;G=$G&am p;A=$A\">$lang_change_chatroom</a>
              ";
              echo "<a href=\"".$_SERVER["PHP_SELF"]."?gum=smilies&amp;nick=$nick&amp;sm=$sm&amp;G=$G& amp;A=$A&amp;room=$room\">$lang_smilies</a>
              ";
              echo "<a href=\"".$_SERVER["PHP_SELF"]."\">$lang_exit</a>
              ";
              echo "
              © GumSlone</p>";
              echo "</card>";
              }
              if ($gum=="say") {
              echo "<card id=\"Say\" title=\"$lang_say ($_time)\">";
              echo "<onevent type=\"onenterforward\">\n";
              echo " <refresh>\n";
              echo " <setvar name=\"mess\" value=\"\"/>\n";
              echo " </refresh>\n";
              echo "</onevent>\n";
              echo "<do type=\"options\" name=\"refresh\" label=\"Chatroom\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=croom&amp;nick=$nick&amp;sm=$sm&amp;G=$G&am p;A=$A&amp;room=$room&amp;r=".$New_Time."\" method=\"get\"/></do>";
              echo "<do type=\"options\" name=\"2wap\" label=\"2WAP.NET\"><go href=\"http://2wap.net/index.php\" method=\"get\"/></do>";
              echo "<p align=\"left\">";

              echo "$lang_message <input name=\"mess\" maxlength=\"200\"/>
              ";
              echo "<anchor title=\"Say\">$lang_say";
              echo "<go href=\"".$_SERVER["PHP_SELF"]."?gum=add&amp;nick=$nick&amp;sm=$sm&amp;G=$G&amp; A=$A&amp;room=$room\" method=\"post\">";
              echo "<postfield name=\"mess\" value=\"\$mess\"/>";
              echo "</go>";
              echo "</anchor>";
              echo "
              <a href=\"".$_SERVER["PHP_SELF"]."?gum=croom&amp;nick=$nick&amp;sm=$sm&amp;G=$G&am p;A=$A&amp;room=$room\">$lang_chat</a>";
              echo "
              © GumSlone</p>";
              echo "</card>";
              }

              if ($gum=="smilies") {
              echo "<card id=\"Smilies\" title=\"$lang_smilies ($_time)\">";
              echo "<do type=\"options\" name=\"refresh\" label=\"$lang_chat\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=croom&amp;nick=$nick&amp;sm=$sm&amp;G=$G&am p;A=$A&amp;room=$room&amp;r=".$New_Time."\" method=\"get\"/></do>";
              echo "<do type=\"options\" name=\"2wap\" label=\"2WAP.NET\"><go href=\"http://2wap.net/index.php\" method=\"get\"/></do>";
              echo "<p align=\"left\">";
              $xfile = @file("smile.txt");
              $xfile = array_reverse($xfile);
              $p = 5;
              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=smilies&amp;nick=$nick&amp;sm=$sm&amp;G=$G& amp;A=$A&amp;room=$room&amp;npage=".($npage-1)."\">$lang_prev</a>";
              if ($npages > 1 and $npage<$npages) $gline_next = "<a href=\"".$_SERVER["PHP_SELF"]."?gum=smilies&amp;nick=$nick&amp;sm=$sm&amp;G=$G& amp;A=$A&amp;room=$room&amp;npage=".($npage+1)."\" >$lang_next</a>";
              for ($i = $first-1; $i >= $second-1; $i--) {
              $ii = $i;
              $ii++;
              $user = explode (&#39;||&#39;, $xfile[$i]);
              print "<img src=\"smilies/$user[1].gif\" alt=\"$user[1]\"/> .$user[2].
              ";
              }
              print"
              ";
              if ($npages>1)
              print $gline_rew."| ".$gline_next;
              echo "
              <a href=\"".$_SERVER["PHP_SELF"]."?gum=croom&amp;nick=$nick&amp;sm=$sm&amp;G=$G&am p;A=$A&amp;room=$room\">$lang_chat</a>";
              echo "
              © GumSlone</p>";
              echo "</card>";
              }

              if ($gum=="online") {
              echo "<card id=\"Online\" title=\"$lang_who_is_online ($_time)\">";
              echo "<do type=\"options\" name=\"refresh\" label=\"$lang_chat\"><go href=\"".$_SERVER["PHP_SELF"]."?gum=croom&amp;nick=$nick&amp;sm=$sm&amp;G=$G&am p;A=$A&amp;room=$room&amp;r=".$New_Time."\" method=\"get\"/></do>";
              echo "<do type=\"options\" name=\"2wap\" label=\"2WAP.NET\"><go href=\"http://2wap.net/index.php\" method=\"get\"/></do>";
              echo "<p align=\"left\">";
              $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=online&amp;nick=$nick&amp;sm=$sm&amp;G=$G&a mp;A=$A&amp;room=$room&amp;npage=".($npage-1)."\">$lang_prev</a>";
              if ($npages > 1 and $npage<$npages) $gline_next = "<a href=\"".$_SERVER["PHP_SELF"]."?gum=online&amp;nick=$nick&amp;sm=$sm&amp;G=$G&a mp;A=$A&amp;room=$room&amp;npage=".($npage+1)."\"> $lang_next</a>";
              $nn=1;
              for ($i = $first-1; $i >= $second-1; $i--) {
              $udata = explode("!",$xfile[$i]);
              if($udata[4]==m) $gender=$lang_male;
              if($udata[4]==f) $gender=$lang_female;

              print $nn++." $udata[1] $gender ($udata[5]) $udata[2]
              ";
              }
              print"
              ";
              if ($npages>1)
              print $gline_rew."| ".$gline_next;
              echo "
              <a href=\"".$_SERVER["PHP_SELF"]."?gum=croom&amp;nick=$nick&amp;sm=$sm&amp;G=$G&am p;A=$A&amp;room=$room\">$lang_chat</a>";
              echo "
              © GumSlone</p>";
              echo "</card>";
              }

              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 != &#39;.&#39; && $file != &#39;..&#39;) {
              if (preg_match("/\." . $smilie[0] . "\./i", $str))
              $smilie_count++;
              if ($smilie_count < 4)
              $str = preg_replace(&#39\.&#39; . $smilie[0] . &#39;\.)&#39;, &#39;[img]&#39; . $dir . $file . &#39;[/img]&#39;, $str, 1);
              //$str = str_replace(&#39;.&#39;.$smilie[0].&#39;.&#39;, &#39;[img]&#39;.$dir.$file.&#39;[/img]&#39;, $str);
              elseif ($smilie_count > 3)
              break;
              }
              }
              closedir($dh);
              }
              }
              return $str;
              }
              ///////////////////////////////////////////////////////////////////////////
              // END OF SCRIPT ENJOY!
              ///////////////////////////////////////////////////////////////////////////
              ?>

              </wml></div>

              try it :P

              Comment


                #8
                <div class='quotetop'>QUOTE (kesaz @ Mar 3 2009, 12:39 PM) <{POST_SNAPBACK}></div>
                Gumslone thanks for help, can you check my code again I have Fatal error: Call to undefined function replacetexttosmilies() in C:\xampp\htdocs\chat\index.php on line 326[/b]
                if you do everything correctly what i told you in my post above yoll not receive this error.
                Advertise your mobile site for FREE with AdTwirl

                Comment


                  #9
                  that be gumslone the maker of the script lol
                  Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
                  Visit: WapMasterz Coming Back Soon!
                  _______
                  SCRIPTS FOR SALE BY SUBZERO
                  Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
                  FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
                  _______
                  Info & Tips
                  php.net
                  w3schools.com

                  Comment


                    #10
                    <div class='quotetop'>QUOTE (uNrEaL @ Mar 2 2009, 09:16 PM) <{POST_SNAPBACK}></div>
                    is this for lava chat? thanks :D[/b]
                    yes is for lava

                    Comment


                      #11
                      <div class='quotetop'>QUOTE (kesaz @ Mar 3 2009, 10:29 PM) <{POST_SNAPBACK}></div>
                      ok now work fine, but this function not support different smiles names like this :- ) ,:- P ,:- (, ;- ) :sad: .Thanks all who help me![/b]
                      for this type of smilies you have to add an extra code
                      Advertise your mobile site for FREE with AdTwirl

                      Comment


                        #12
                        just a little note who&#39;s running any sort of bbcode based script really

                        me and a few others have been working on a bbcode parsing engine for torrent sites. basically it allows you to save the bbcode as html rather than bbcode so you save time on php str_replace&#39;s. Now our parser is quite advanced, i had to borrow some code ideas from someone whom i regard as a php guru in order to get the bbcode editor working so when editing you can go back to bbcode then resave as html (its a bit complicated to explain)

                        now if your using a chat where u only delete messages or u do nothing admin wise (i.e. you dont edit users messages) then you&#39;ve got it easy. All you need to do is do the st_replaces once before inserting the message into a db or file and your good to go. Its pretty obvious that parsing bbcode on every page load is gonna be higher than parsing it once, but we run a couple of tests before doing the mini project and if i rem correctly we saw a massive 70% page load time increase on a large sample data (that was just PHP parsing though, we didnt use any browser page load timers which are inaccurate)

                        Now for most this probably doesnt bother you but ive got a couple of PM&#39;s asking me how to optimise MySQL, most frequently about index&#39;s. Well such a change in code if your using a db driven chat/forum/whatever will produce better optimisation than any indexing you can add. and even if ur using a file based version the optimisation increase u would get from such a chance would be just as good

                        just my 2 cents

                        Comment


                          #13
                          <div class='quotetop'>QUOTE (djlee @ Mar 5 2009, 04:25 PM) <{POST_SNAPBACK}></div>
                          just a little note who&#39;s running any sort of bbcode based script really

                          me and a few others have been working on a bbcode parsing engine for torrent sites. basically it allows you to save the bbcode as html rather than bbcode so you save time on php str_replace&#39;s. Now our parser is quite advanced, i had to borrow some code ideas from someone whom i regard as a php guru in order to get the bbcode editor working so when editing you can go back to bbcode then resave as html (its a bit complicated to explain)

                          now if your using a chat where u only delete messages or u do nothing admin wise (i.e. you dont edit users messages) then you&#39;ve got it easy. All you need to do is do the st_replaces once before inserting the message into a db or file and your good to go. Its pretty obvious that parsing bbcode on every page load is gonna be higher than parsing it once, but we run a couple of tests before doing the mini project and if i rem correctly we saw a massive 70% page load time increase on a large sample data (that was just PHP parsing though, we didnt use any browser page load timers which are inaccurate)

                          Now for most this probably doesnt bother you but ive got a couple of PM&#39;s asking me how to optimise MySQL, most frequently about index&#39;s. Well such a change in code if your using a db driven chat/forum/whatever will produce better optimisation than any indexing you can add. and even if ur using a file based version the optimisation increase u would get from such a chance would be just as good

                          just my 2 cents [/b]
                          but what youll do if you have a forum site with many smilies and you have parsed the bbcodes before insertion to the db and after some time you remove the smilies you dont like, so youll have many forum posts with empty images, this will cause a long page load. Or youll create and extra parse code which will check if the image file exists, this will also cause a long execution time of your script

                          Also if you give your users an option to disable bbcodes, then youll need to parse all posts/messages and remove the html tags from them,
                          so it depends on which way is better for your site, sometimes is better to parse before insertion to db and sometimes not.
                          Advertise your mobile site for FREE with AdTwirl

                          Comment


                            #14
                            can you do what forchatzone, limit pm's ???

                            any php code will work on any source, you just need to integrate it properly, theres hardly any php code anywhere on the net that is setup specific

                            Comment


                              #15
                              @Gumslone, use smarty to render page quickly.

                              Comment

                              Working...
                              X