want to add option of BOLD , ITALICS UNDERLINE , n add chat bubbles

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

    want to add option of BOLD , ITALICS UNDERLINE , n add chat bubbles

    hey friends i wanna make this two modifications in chatroom pls help me out
    1. wanna add option of BOLD , ITALICS UNDERLINE or DIFFERENT FONTS for users to select (only in chatroom)
    2. display the chat msgs in chat bubbles . this is my chat.php

    PHP Code:
    <?php
    header
    ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header("Last-Modified: " gmdate("D, d M Y H:i:s") . " GMT");     
    header("Cache-Control: no-cache, must-revalidate");            
    header("Pragma: no-cache");
    include(
    "config.php"); 
    include(
    "core.php"); 
    echo(
    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    echo 
    "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD XHTML Mobile 1.0//EN\""" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
    ?>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Chat</title>
    <meta forua="true" http-equiv="Cache-Control" content="no-cache"/>
    <meta forua="true" http-equiv="Cache-Control" content="must-revalidate"/>
    <?php
    connectdb
    ();
    $sid $_GET["sid"];
    echo 
    gettheme($sid);
    ?>
    </head>
    <body>
    <?php
    gettimebar
    ($sid);
    boxstart("Chat");
    $action=$_GET["action"];
    $id=$_GET["id"];
    $rid=$_GET["rid"];
    $rpw=$_GET["rpw"];
    $uid getuid_sid($sid);
    $uexist isuser($uid);
    if((
    islogged($sid)==false)||!$uexist){
    echo 
    "<p align=\"center\">";
    echo 
    "You are not logged in<br/>";
    echo 
    "Or Your session has been expired<br/><br/>";
    echo 
    "<a href=\"index.php\">Login</a>";
    echo 
    "</p>";
    echo 
    "</div></div></body>";
    echo 
    "</html>";
    exit();
    }
    if(
    isbanned($uid)){
    echo 
    "<p align=\"center\">";
    echo 
    "<img src=\"images/notok.gif\" alt=\"x\"/><br/>";
    echo 
    "You are <b>Banned</b><br/>";
    $banto mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='1'"));
    $remain $banto[0]- time();
    $rmsg gettimemsg($remain);
    echo 
    "Time to finish your penalty: $rmsg<br/><br/>";
    echo 
    "</p>";
    echo 
    "</div></div></body>";
    echo 
    "</html>";
    exit();
    }
    $isroom mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_rooms WHERE id='".$rid."'"));
    if(
    $isroom[0]==0){
    echo 
    "<p align=\"center\">";
    echo 
    "This room doesn't exist anymore<br/>";
    echo 
    ":P see in another room<br/><br/>";
    echo 
    "<a href=\"index.php?action=chat&amp;sid=$sid\">Chatrooms</a>";
    echo 
    "</p>";
    echo 
    "</div></div></body>";
    echo 
    "</html>";
    exit();
    }
    $passworded mysql_fetch_array(mysql_query("SELECT pass FROM ibwf_rooms WHERE id='".$rid."'"));
    if(
    $passworded[0]!=""){
    if(
    $rpw!=$passworded[0]){
    echo 
    "<p align=\"center\">";
    echo 
    "You can't enter this room<br/>";
    echo 
    ":P stay away<br/><br/>";
    echo 
    "<a href=\"index.php?action=chat&amp;sid=$sid\">Chatrooms</a>";
    echo 
    "</p>";
    echo 
    "</div></div></body>";
    echo 
    "</html>";
    exit();
    }
    }
    if(!
    canenter($rid,$sid)){
    echo 
    "<p align=\"center\">";
    echo 
    "You can't enter this room..<br/>";
    echo 
    ":P stay away<br/><br/>";
    echo 
    "<a href=\"index.php?action=chat&amp;sid=$sid\">Chatrooms</a>";
    echo 
    "</p>";
    echo 
    "</div></div></body>";
    echo 
    "</html>";
    exit();
    }
    addtochat($uid$rid);
    $timeto 7200;
    $timenw time();
    $timeout $timenw-$timeto;
    $deleted mysql_query("DELETE FROM ibwf_chat WHERE timesent<".$timeout."");
    if (
    $action==""){
    echo 
    "<p>";
    addonline($uid,"Chatrooms","");
    echo 
    "<a href=\"chat.php?time=";
    echo 
    date('dmHis');
    echo 
    "&amp;sid=$sid&amp;rid=$rid&amp;rpw=$rpw";
    echo 
    "\">refresh</a><br/>";
    echo 
    "Message:<form action=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw\" method=\"post\"><input class=\"inputText\" name=\"message\" type=\"text\" value=\"\" maxlength=\"255\"/><br/>";
    echo 
    "<input class=\"inputButton\" type=\"submit\" value=\"Send\"/>";
    echo 
    "</form>";
    $unreadinbox=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE unread='1' AND touid='".$uid."'"));
    $pmtotl=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE touid='".$uid."'"));
    $unrd="(".$unreadinbox[0]."/".$pmtotl[0].")";
    if (
    $unreadinbox[0]>0){
    echo 
    "<br/><a href=\"inbox.php?action=main&amp;sid=$sid\">Inbox$unrd</a>";
    }
    echo 
    "</p>";
    $message=$_POST["message"];
    $who $_POST["who"];
    $rinfo mysql_fetch_array(mysql_query("SELECT censord, freaky FROM ibwf_rooms WHERE id='".$rid."'"));
    if(
    trim($message) != ""){
    $chatok mysql_query("INSERT INTO ibwf_chat SET  chatter='".$uid."', who='".$who."', timesent='".time()."', msgtext='".$message."', rid='".$rid."';");
    $lstmsg mysql_query("UPDATE ibwf_rooms SET lastmsg='".time()."' WHERE id='".$rid."'");
    $hehe=mysql_fetch_array(mysql_query("SELECT chmsgs FROM ibwf_users WHERE id='".$uid."'"));
    $totl $hehe[0]+1;
    $msgstmysql_query("UPDATE ibwf_users SET chmsgs='".$totl."' WHERE id='".$uid."'");
    if(
    $rinfo[1]==2){
    $botid "c078df85ae3753d5";
    $hostname "www.pandorabots.com";
    $hostpath "/pandora/talk-xml";
    $sendData "botid=".$botid."&input=".urlencode($message)."&custid=".$custid;
    $result PostToHost($hostname$hostpath$sendData);
    $pos strpos($result"custid=\"");
    $pos strpos($result"<that>");
    if(
    $pos === false){
    $reply "";
    } else {
                
    $pos += 6;
                
    $endpos strpos($result"</that>"$pos);
                
    $reply substr($result$pos$endpos $pos);
                
    $reply mysql_escape_string($reply);
            }
            
    $chatok mysql_query("INSERT INTO ibwf_chat SET  chatter='1', who='', timesent='".time()."', msgtext='".$reply." @".getnick_uid($uid)."', rid='".$rid."';");
                   
    addonline('1',"Bot chatroom","");
    //$logit = mysql_query("INSERT INTO logs VALUES (NULL, 'IW Bot', 'IW Browser', '205.209.127.217', '', '', '', '', '', '')");
    }
              
              
    $message "";
                }
                
                echo 
    "<p>";
                
                
    $chats mysql_query("SELECT chatter, who, timesent, msgtext, exposed FROM ibwf_chat WHERE rid='".$rid."' ORDER BY timesent DESC, id DESC");
                
    $counter=0;
                while(
    $chat mysql_fetch_array($chats))
                {
                    
    $canc true;
                   
                    
                    if(
    $counter<10)
                    {
                      if(
    istrashed($chat[0])){
                            if(
    $uid!=$chat[0])
                            {
                              
    $canc false;
                            }
                      }
                    
    //////good
                    
    if(isignored($chat[0],$uid)){
                      
    $canc false;
                    }
                    
    //////////good
                    
    if($chat[0]!=$uid)
                    {
                      if(
    $chat[1]!=0)
                      {
                        if(
    $chat[1]!=$uid)
                        {
                          
    $canc false;
                        }
                      }
                    }
                    if(
    $chat[4]=='1' && ismod($uid))
                    {
                      
    $canc true;
                    }
                    if(
    $canc)
                    {
                       
    $cmid mysql_fetch_array(mysql_query("SELECT  chmood FROM ibwf_users WHERE id='".$chat[0]."'"));
                       
                       
    $iml "";
                    if((
    $cmid[0]!=0))
                    {
                      
    $mlnk mysql_fetch_array(mysql_query("SELECT img, text FROM ibwf_moods WHERE id='".$cmid[0]."'"));
                      
    $iml "<img src=\"$mlnk[0]\" alt=\"$mlnk[1]\"/>";
                    }
                      
    $chnick getnick_uid($chat[0]);
                        
    $optlink $iml.$chnick;
                      if((
    $chat[1]!=0)&&($chat[0]==$uid))
                      {
                        
    ///out
                        
    $iml "<img src=\"moods/out.gif\" alt=\"!\"/>";
                        
    $chnick getnick_uid($chat[1]);
                        
    $optlink $iml."PM to ".$chnick;
                      }
                      if(
    $chat[1]==$uid)
                      {
                        
    ///out
                        
    $iml "<img src=\"moods/in.gif\" alt=\"!\"/>";
                        
    $chnick getnick_uid($chat[0]);
                        
    $optlink $iml."PM by ".$chnick;
                      }
                        if(
    $chat[4]=='1')
                      {
                        
    ///out
                        
    $iml "<img src=\"moods/point.gif\" alt=\"!\"/>";
                        
    $chnick getnick_uid($chat[0]);
                        
    $tonick getnick_uid($chat[1]);
                        
    $optlink "$iml by ".$chnick." to ".$tonick;
                      }
                      
                      
    $dsdate("h:i:s A"$chat[2]+(12.5*60*60));
                      
    $text parsepm($chat[3], $sid);
                      
    $nos substr_count($text,"<img src=");
                      if(
    isspam($text))
                      {
                        
    $chnick getnick_uid($chat[0]);
                        echo 
    "<b>Chat system:»<i>*$chnick, please don't try to spam*</i></b><br/>";
                      }
                      else if(
    $nos>2){
                        
    $chnick getnick_uid($chat[0]);
                        echo 
    "<b>Chat system:»<i>*$chnick is greedy when it comes to smilies*</i></b><br/>";
                      }else{
                        
    $sres substr($chat[3],0,3);
                        
                        if(
    $sres == "/me")
                        {
                            
    $chco strlen($chat[3]);
                            
    $goto $chco 3;
                            
    $rest substr($chat[3],3,$goto);
                            
    $tosay parsepm($rest$sid);
                            
                            echo 
    "<b><i>*$chnick $tosay*</i></b><br/>";
                        }else{
                          
                          
    $tosay parsepm($chat[3], $sid);
                          
                          if(
    $rinfo[0]==1)
                          {
                          
    $tosay str_replace("****","f***",$tosay);
                            
    $tosay str_replace("****","sh*t",$tosay);
                            
    $tosay str_replace("dick","d**k",$tosay);
                            
    $tosay str_replace("pussy","pu**y",$tosay);
                            
    $tosay str_replace("cock","c**k",$tosay);
                            
    $tosay str_replace("ass ","@s* ",$tosay);
    }
    if(
    $rinfo[1]==1){
    $tosay htmlspecialchars($chat[3]);
    $tosay strrev($tosay);
    }
    echo 
    "<a href=\"chat.php?action=say2&amp;sid=$sid&amp;who=$chat[0]&amp;rid=$rid&amp;rpw=$rpw\">$optlink</a>»$ds<br/>";
    echo 
    $tosay."<br/>";
    }
    }
    $counter++;
    }
    }
    }
    echo 
    "</p>";
    echo 
    "<p align=\"center\">";
    $chatters=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline where rid='".$rid."'"));
    echo 
    "<br/><a href=\"chat.php?action=inside&amp;sid=$sid&amp;rid=$rid&amp;rpw=$rpw\">Who's Inside($chatters[0])</a><br/><a href=\"lists.php?action=chmood&amp;sid=$sid&amp;page=1\">»Chat mood</a><br/>";
    echo 
    "<a href=\"index.php?action=chat&amp;sid=$sid\">Chatrooms</a><br/>";
    echo 
    "</p>";
    getfooter($sid);
    }
    else if (
    $action=="say"){
    addonline($uid,"Writing Chat Message","");
    echo 
    "<p>Message:<form action=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw\" method=\"post\"><input class=\"inputText\" name=\"message\" type=\"text\" value=\"\" maxlength=\"255\"/><br/>";
    echo 
    "<input class=\"inputButton\" type=\"submit\" value=\"Post\"/>";
    echo 
    "</form><br/>";
    echo 
    "<a href=\"lists.php?action=chmood&amp;sid=$sid&amp;page=1\">»Chat mood</a><br/>";
    echo 
    "<a href=\"chat.php?action=inside&amp;sid=$sid&amp;rid=$rid&amp;rpw=$rpw\">»Who's Inside</a><br/>";
    echo 
    "<a href=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw\">«Chatroom</a></p>";
    echo 
    "<p align=\"center\"><a href=\"index.php?action=chat&amp;sid=$sid\">Chatrooms</a><br/>";
    echo 
    "</p>";
    getfooter($sid);
    }
    else if (
    $action=="say2"){
    echo 
    "<p align=\"center\">";
    $who $_GET["who"];
    $unick getnick_uid($who);
    echo 
    "<b>Private to $unick</b>";
    echo 
    "</p>";
    addonline($uid,"Writing chat message","");
    echo 
    "<p>Message:<form action=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw\" method=\"post\"><input class=\"inputText\" name=\"message\" type=\"text\" value=\" \" maxlength=\"255\"/><br/>";
    echo 
    "<input type=\"hidden\" name=\"who\" value=\"$who\"><input class=\"inputButton\" type=\"submit\" value=\"Send\"/>";
    echo 
    "<br/>";
    echo 
    "<a href=\"index.php?action=viewuser&amp;sid=$sid&amp;who=$who\">»View $unick's Profile</a><br/>";
    echo 
    "<a href=\"chat.php?action=expose&amp;sid=$sid&amp;who=$who&amp;rid=$rid&amp;rpw=$rpw\">»Expose $unick</a><br/>";
    echo 
    "<a href=\"chat.php?action=inside&amp;sid=$sid&amp;rid=$rid&amp;rpw=$rpw\">»Who's Inside</a><br/>";
    echo 
    "<a href=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw\">«Chatroom</a></p>";
    echo 
    "<p align=\"center\"><a href=\"index.php?action=chat&amp;sid=$sid\">Chatrooms</a><br/>";
    echo 
    "</p>";
    getfooter($sid);
    }
    else if (
    $action=="inside"){
    addonline($uid,"Chat inside list","");
    echo 
    "<p align=\"center\"><br/>";
    $inside=mysql_query("SELECT DISTINCT * FROM ibwf_chonline WHERE rid='".$rid."' and uid IS NOT NULL");
    while(
    $ins=mysql_fetch_array($inside)){
    $unick getnick_uid($ins[1]);
    $userl "<a href=\"chat.php?action=say2&amp;sid=$sid&amp;who=$ins[1]&amp;rid=$rid&amp;rpw=$rpw\">$unick</a>, ";
    echo 
    "$userl";
    }
    echo 
    "<br/><br/>";
    echo 
    "<a href=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw\">«Chatroom</a><br/>";
    echo 
    "<br/><a href=\"index.php?action=chat&amp;sid=$sid\">Chatrooms</a><br/>";
    echo 
    "</p>";
    getfooter($sid);
    }
    else if (
    $action=="expose")           {
    addonline($uid,"Chat inside list","");
    echo 
    "<p align=\"center\"><br/>";
    mysql_query("UPDATE ibwf_chat SET exposed='1' WHERE chatter='".$who."' AND who='".$uid."'");
    $unick getnick_uid($who);
    echo 
    "$unick messages to you are exposed to mods";
    echo 
    "<br/><br/>";
    echo 
    "<a href=\"chat.php?sid=$sid&amp;rid=$rid&amp;rpw=$rpw\">«Chatroom</a><br/>";
    echo 
    "<br/><a href=\"index.php?action=chat&amp;sid=$sid\">Chatrooms</a><br/>";
    echo 
    "</p>";
    }
    boxend();
    ?>
    </body>
    </html>

    #2
    Send via get or post like: type=bold type=italic

    PHP Code:
    if ($_GET['type'] == 'bold')
    {
       
    $text '[b]'.$text.'[/b]';
    }
    else 
    blah blah is true 
    <?php unlink('World/Europe/Romania.country'); ?>

    Comment


      #3
      a little more specific guidance bro , i want to make buttons of them

      Comment


        #4
        JS

        PHP Code:
        <script type="text/javascript">
        function 
        formatText(el,tag){
        var 
        selectedText=document.selection?document.selection.createRange().text:el.value.substring(el.selectionStart,el.selectionEnd);// IE:Moz
        var newText='<'+tag+'>'+selectedText+'</'+tag+'>';
        if(
        document.selection){//IE
        document.selection.createRange().text=newText;
        }
        else{
        //Moz
        el.value=el.value.substring(0,el.selectionStart)+newText+el.value.substring(el.selectionEnd,el.value.length);
        }
        }

        </
        script>
        </
        head>
        <
        body>
        <
        form name="myForm">
        <
        textarea name="loony" rows "12" cols "50"></textarea><br>
        <
        input type="button" value="Bold" onclick="formatText (loony,'b');" />
        <
        input type="button" value="Italic" onclick="formatText (loony,'i');" />
        <
        input type="button" value="Underline" onclick="formatText (loony,'u');" />
        </
        form
        give this ago man
        Creator of
        Epix.Mobi

        Keep an Eye on us Big things coming soon!!!!
        Need something for your site hit me up here

        http://coding-talk.com/forum/main-fo...r-your-wapsite

        Comment


          #5
          Originally posted by Loony View Post
          PHP Code:
          <script type="text/javascript">
          function 
          formatText(el,tag){
          var 
          selectedText=document.selection?document.selection.createRange().text:el.value.substring(el.selectionStart,el.selectionEnd);// IE:Moz
          var newText='<'+tag+'>'+selectedText+'</'+tag+'>';
          if(
          document.selection){//IE
          document.selection.createRange().text=newText;
          }
          else{
          //Moz
          el.value=el.value.substring(0,el.selectionStart)+newText+el.value.substring(el.selectionEnd,el.value.length);
          }
          }

          </
          script>
          </
          head>
          <
          body>
          <
          form name="myForm">
          <
          textarea name="loony" rows "12" cols "50"></textarea><br>
          <
          input type="button" value="Bold" onclick="formatText (loony,'b');" />
          <
          input type="button" value="Italic" onclick="formatText (loony,'i');" />
          <
          input type="button" value="Underline" onclick="formatText (loony,'u');" />
          </
          form
          give this ago man
          blah its for lavalair bro

          Comment


            #6
            Originally posted by mirror View Post
            blah its for lavalair bro
            that would work fine with lava


            .....

            heres php version:
            PHP Code:
            $arr = array('NORMAL','BOLD','ITALIC','UNDERLINED','SMALL','BIG');
            print 
            '<select name="type">';
            foreach (
            $arr as $val) { 
            print 
            '<option value="'.$val.'">'.$val.'</option>'

            print 
            "</select><br/>";

            ////////////////////////////////////////////

            $type $_POST['type'];
            if(
            $type=='BOLD'$message '[b]'.$message.'[/b]';
            if(
            $type=='ITALIC'$message '[i]'.$message.'[/i]';
            if(
            $type=='ITALIC'$message '[u]'.$message.'[/u]';
            if(
            $type=='SMALL'$message '[s]'.$message.'[/s]';
            if(
            $type=='BIG'$message '[big]'.$message.'[/big]'
            Last edited by something else; 08.05.12, 04:29.

            Comment


              #7
              could also do something like.

              PHP Code:
              //url.
              $message preg_replace("/\[url\](.*?)\[\/url\]/i","<a href=\"http://\\1\">\\1</a>"$message);
              //image.
              $message preg_replace("/\[img\](.*?)\[\/img\]/i","<img src=\"http://\\1\" alt=\"\\1\" />"$message);
              //email.
              $message preg_replace("/\[em\](.*?)\[\/em\]/i","<a href=\"mailto:\\1\">\\1</a>"$message);
              //bold text.
              $message preg_replace("/\[b\](.*?)\[\/b\]/i","<b>\\1</b>"$message);
              //italic text.
              $message preg_replace("/\[i\](.*?)\[\/i\]/i","<i>\\1</i>"$message);
              //underlined text.
              $messagepreg_replace("/\[u\](.*?)\[\/u\]/i","<u>\\1</u>"$message);
              //big text.
              $message preg_replace("/\[big\](.*?)\[\/big\]/i","<big>\\1</big>"$message); 
              ETC...

              edited:
              ok didnt realise wanted it in selection menu, lol
              but still pretty useful nevertheless.
              Last edited by Ghost; 08.05.12, 05:38.
              <?php
              include ('Ghost');
              if ($Post == true) {
              echo '

              sigpic
              alt='coding-talk.com!!' />';
              echo 'Sharing Is Caring!';
              } else {
              echo '

              alt='the username GHOST has been comprimised!' />';
              echo 'OMG SOMEBODY HELP ME!!';
              }
              ?>

              Comment


                #8
                Originally posted by something else View Post
                that would work fine with lava


                .....

                heres php version:
                PHP Code:
                $arr = array('NORMAL','BOLD','ITALIC','UNDERLINED','SMALL','BIG');
                print 
                '<select name="type">';
                foreach (
                $arr as $val) { 
                print 
                '<option value="'.$val.'">'.$val.'</option>'

                print 
                "</select><br/>";

                ////////////////////////////////////////////

                $type $_POST['type'];
                if(
                $type=='BOLD'$message '[b]'.$message.'[/b]';
                if(
                $type=='ITALIC'$message '[i]'.$message.'[/i]';
                if(
                $type=='ITALIC'$message '[u]'.$message.'[/u]';
                if(
                $type=='SMALL'$message '[s]'.$message.'[/s]';
                if(
                $type=='BIG'$message '[big]'.$message.'[/big]'
                works great (U USED ITALICS TWICE ) n i even now got colors working using same idea , but still this showing of messages in chat room in chat bubbles pending , any ideas where shud i start from , editing css
                Last edited by mirror; 08.05.12, 18:17.

                Comment

                Working...
                X