Chat System

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    <div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>$res = mysql_query("INSERT INTO ibwf_chonline SET lton=&#39;".time()."&#39;, uid=&#39;".$uid."&#39;, rid=&#39;".$rid."&#39;");
    if($res)
    {
    $msg = getnick_uid($uid)."enter the room"; mysql_query("INSERT INTO ibwf_chat SET timesent=&#39;".time()."&#39;, userid=&#39;0&#39;, text=&#39;".$msg."&#39;");
    }
    else
    {
    //just update the chonline list
    }
    dont remember if time sent is the correct field name anyways after doing that ....in the chat room when fetching the items from ibwf_chat
    eg $sql = mysql_query("SELECT userid,timesent,text FROM ibwf_chat");
    while($item = mysql_fetch_array($sql))
    {
    if($item[0]==&#39;0&#39;)
    {
    $item[0]="chat_system";
    echo $item[0].$item[1].$item[2];
    }
    else
    {
    //print the items
    }</div>

    i got some question here..

    1. what u mean with //just update the chonline list

    2. this is my add to chat..how to edit it?

    <div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>function addtochat($uid, $rid)
    {
    $timeto = 120;
    $timenw = time();
    $timeout = $timenw - $timeto;
    $exec = mysql_query("DELETE FROM ibwf_chonline WHERE lton<&#39;".$timeout."&#39;");
    $res = mysql_query("INSERT INTO ibwf_chonline SET lton=&#39;".time()."&#39;, uid=&#39;".$uid."&#39;, rid=&#39;".$rid."&#39;");
    $res = mysql_query("INSERT INTO ibwf_chonline SET lton=&#39;".time()."&#39;, uid=&#39;".$uid."&#39;, rid=&#39;".$rid."&#39;");
    $res = mysql_query("INSERT INTO ibwf_chonline SET lton=&#39;".time()."&#39;, uid=&#39;".$uid."&#39;, rid=&#39;".$rid."&#39;");

    if(!$res)
    {
    mysql_query("UPDATE ibwf_chonline SET lton=&#39;".time()."&#39;, rid=&#39;".$rid."&#39; WHERE uid=&#39;".$uid."&#39;");
    }
    }</div>

    3. where must i put

    <div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>dont remember if time sent is the correct field name anyways after doing that ....in the chat room when fetching the items from ibwf_chat
    eg $sql = mysql_query("SELECT userid,timesent,text FROM ibwf_chat");
    while($item = mysql_fetch_array($sql))
    {
    if($item[0]==&#39;0&#39;)
    {
    $item[0]="chat_system";
    echo $item[0].$item[1].$item[2];
    }
    else
    {
    //print the items
    }</div>

    hope somebody will answer me..

    Comment


      #17
      Just need help for a last step.Hope someone willing to help me.

      Comment


        #18
        Anybody?Its that everybody here are selfish?

        Comment


          #19
          Anybody?Its that everybody here are selfish?[/b]
          Replace your addtochat function with

          Code:
          function addtochat($uid, $rid)
          {
          $timeto = 120;
          $timenw = time();
          $timeout = $timenw - $timeto;
          $exec = mysql_query("DELETE FROM ibwf_chonline WHERE lton<&#39;".$timeout."&#39;");
          $res = mysql_query("INSERT INTO ibwf_chonline SET lton=&#39;".time()."&#39;, uid=&#39;".$uid."&#39;, rid=&#39;".$rid."&#39;");
          if($res)
          {
          $msg = "/me Enter the Room";
          mysql_query("INSERT INTO ibwf_chat SET timesent=&#39;".time()."&#39;, userid=&#39;".$uid."&#39;, text=&#39;".$msg."&#39;");
          }else{
          mysql_query("UPDATE ibwf_chonline SET lton=&#39;".time()."&#39;, rid=&#39;".$rid."&#39; WHERE uid=&#39;".$uid."&#39;");
          }
          }
          Make Sure that the users are allowed to use /me tool... If not you can remove the /me in $msg variable...

          Comment


            #20
            Replace your addtochat function with

            Code:
            function addtochat($uid, $rid)
            {
            $timeto = 120;
            $timenw = time();
            $timeout = $timenw - $timeto;
            $exec = mysql_query("DELETE FROM ibwf_chonline WHERE lton<&#39;".$timeout."&#39;");
            $res = mysql_query("INSERT INTO ibwf_chonline SET lton=&#39;".time()."&#39;, uid=&#39;".$uid."&#39;, rid=&#39;".$rid."&#39;");
            if($res)
            {
            $msg = "/me Enter the Room";
            mysql_query("INSERT INTO ibwf_chat SET timesent=&#39;".time()."&#39;, userid=&#39;".$uid."&#39;, text=&#39;".$msg."&#39;");
            }else{
            mysql_query("UPDATE ibwf_chonline SET lton=&#39;".time()."&#39;, rid=&#39;".$rid."&#39; WHERE uid=&#39;".$uid."&#39;");
            }
            }
            Make Sure that the users are allowed to use /me tool... If not you can remove the /me in $msg variable...[/b]
            Not working

            Comment


              #21
              Not working[/b]

              yes its not working

              Comment


                #22
                yes its not working [/b]
                Aw Sorry here it is

                Code:
                function addtochat($uid, $rid)
                {
                $bago = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline WHERE uid=&#39;".$uid."&#39; AND rid=&#39;".$rid."&#39;"));
                if($bago[0]==0){
                $msg = "/me Enter the Room";
                mysql_query("INSERT INTO ibwf_chat SET timesent=&#39;".time()."&#39;, userid=&#39;".$uid."&#39;, text=&#39;".$msg."&#39;");
                }
                
                $timeto = 120;
                $timenw = time();
                $timeout = $timenw - $timeto;
                $exec = mysql_query("DELETE FROM ibwf_chonline WHERE lton<&#39;".$timeout."&#39;");
                $res = mysql_query("INSERT INTO ibwf_chonline SET lton=&#39;".time()."&#39;, uid=&#39;".$uid."&#39;, rid=&#39;".$rid."&#39;");
                if(!$res)
                {
                mysql_query("UPDATE ibwf_chonline SET lton=&#39;".time()."&#39;, rid=&#39;".$rid."&#39; WHERE uid=&#39;".$uid."&#39;");
                }
                }

                Comment


                  #23
                  you need to be sorry again for your wrong code
                  Code:
                  mysql_query("INSERT INTO ibwf_chat SET timesent=&#39;".time()."&#39;, userid=&#39;".$uid."&#39;, text=&#39;".$msg."&#39;");
                  there is no userid row in ibwf_chat table it would be chatter.though still this code doesnot work

                  Comment


                    #24
                    you need to be sorry again for your wrong code
                    Code:
                    mysql_query("INSERT INTO ibwf_chat SET timesent=&#39;".time()."&#39;, userid=&#39;".$uid."&#39;, text=&#39;".$msg."&#39;");
                    there is no userid row in ibwf_chat table it would be chatter.though still this code doesnot work[/b]

                    so rukiya bro. .Can u give the full, complete and working code?

                    Comment


                      #25
                      you need to be sorry again for your wrong code
                      Code:
                      mysql_query("INSERT INTO ibwf_chat SET timesent=&#39;".time()."&#39;, userid=&#39;".$uid."&#39;, text=&#39;".$msg."&#39;");
                      there is no userid row in ibwf_chat table it would be chatter.though still this code doesnot work[/b]
                      LoL tnx.. Simply replace userid by chatter if that is in your table I only copy the table structure used in first page

                      Code:
                      $res = mysql_query("INSERT INTO ibwf_chonline SET lton=&#39;".time()."&#39;, uid=&#39;".$uid."&#39;, rid=&#39;".$rid."&#39;");
                        if($res)
                        {
                            $msg = getnick_uid($uid)."enter the room";  mysql_query("INSERT INTO ibwf_chat SET timesent=&#39;".time()."&#39;, userid=&#39;0&#39;, text=&#39;".$msg."&#39;");
                      }
                      else
                      {
                      //just update the chonline list
                      }
                      dont remember if time sent is the  correct field name anyways after doing that ....in the chat room when fetching the items from ibwf_chat 
                      eg $sql = mysql_query("SELECT userid,timesent,text FROM ibwf_chat");
                      while($item = mysql_fetch_array($sql)) 
                      {
                      if($item[0]==&#39;0&#39;)
                      {
                      $item[0]="chat_system";
                      echo $item[0].$item[1].$item[2];
                      }
                      else
                      {
                      //print the items
                      }
                      this code already posted by mckeny juz use search button[/b]


                      Here it is hope it will work now
                      Code:
                      function addtochat($uid, $rid)
                      {
                      $bago = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline WHERE uid=&#39;".$uid."&#39; AND rid=&#39;".$rid."&#39;"));
                      if($bago[0]==0){
                      $msg = "/me Enter the Room";
                      mysql_query("INSERT INTO ibwf_chat SET timesent=&#39;".time()."&#39;, chatter=&#39;".$uid."&#39;, text=&#39;".$msg."&#39;");
                      }
                      
                      $timeto = 120;
                      $timenw = time();
                      $timeout = $timenw - $timeto;
                      $exec = mysql_query("DELETE FROM ibwf_chonline WHERE lton<&#39;".$timeout."&#39;");
                      $res = mysql_query("INSERT INTO ibwf_chonline SET lton=&#39;".time()."&#39;, uid=&#39;".$uid."&#39;, rid=&#39;".$rid."&#39;");
                      if(!$res)
                      {
                      mysql_query("UPDATE ibwf_chonline SET lton=&#39;".time()."&#39;, rid=&#39;".$rid."&#39; WHERE uid=&#39;".$uid."&#39;");
                      }
                      }

                      Comment


                        #26
                        LoL tnx.. Simply replace userid by chatter if that is in your table I only copy the table structure used in first page
                        Here it is hope it will work now
                        Code:
                        function addtochat($uid, $rid)
                        {
                        $bago = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline WHERE uid=&#39;".$uid."&#39; AND rid=&#39;".$rid."&#39;"));
                        if($bago[0]==0){
                        $msg = "/me Enter the Room";
                        mysql_query("INSERT INTO ibwf_chat SET timesent=&#39;".time()."&#39;, chatter=&#39;".$uid."&#39;, text=&#39;".$msg."&#39;");
                        }
                        
                        $timeto = 120;
                        $timenw = time();
                        $timeout = $timenw - $timeto;
                        $exec = mysql_query("DELETE FROM ibwf_chonline WHERE lton<&#39;".$timeout."&#39;");
                        $res = mysql_query("INSERT INTO ibwf_chonline SET lton=&#39;".time()."&#39;, uid=&#39;".$uid."&#39;, rid=&#39;".$rid."&#39;");
                        if(!$res)
                        {
                        mysql_query("UPDATE ibwf_chonline SET lton=&#39;".time()."&#39;, rid=&#39;".$rid."&#39; WHERE uid=&#39;".$uid."&#39;");
                        }
                        }
                        [/b]
                        <div class='quotetop'>QUOTE(rukiya)</div>
                        though still this code doesnot work[/b]

                        Comment


                          #27
                          Lol..The code only show "me enter the room" but not show the user nick?And how to add browser for example :

                          Chat system:
                          boyzone enter the room
                          browser : Mozilla 4.0

                          Comment


                            #28
                            is that too difficult to help others??i have edit the code that give by mckeny but still not working..


                            function addtochat($uid, $rid)
                            {
                            $timeto = 120;
                            $timenw = time();
                            $timeout = $timenw - $timeto;
                            $exec = mysql_query("DELETE FROM ibwf_chonline WHERE lton<&#39;".$timeout."&#39;");
                            $res = mysql_query("INSERT INTO ibwf_chonline SET lton=&#39;".time()."&#39;, uid=&#39;".$uid."&#39;, rid=&#39;".$rid."&#39;");
                            if(!$res)
                            {

                            $msg = getnick_uid($uid)."enter the room"; mysql_query("INSERT INTO ibwf_chat SET timesent=&#39;".time()."&#39;, id=&#39;0&#39;, msgtext=&#39;".$msg."&#39;");
                            }
                            else
                            {
                            mysql_query("UPDATE ibwf_chonline SET lton=&#39;".time()."&#39;, rid=&#39;".$rid."&#39; WHERE uid=&#39;".$uid."&#39;");
                            }
                            $sql = mysql_query("SELECT id,chatter,timesent,msgtext FROM ibwf_chat");
                            while($item = mysql_fetch_array($sql))
                            {
                            $item = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline WHERE uid=&#39;".$uid."&#39; AND rid=&#39;".$rid."&#39;"));
                            if($item[0]==0)
                            {
                            $item[0]="chat system";
                            echo $item[0].$item[1].$item[2];
                            }
                            else
                            {
                            //print the items
                            }
                            }
                            }

                            can somebody fix it?

                            Comment


                              #29
                              Ok lets finish this one. But a little advice bro as site owner you dont need to be a good coder but you must atleast understand php code

                              Here it is Replace your addtochat function with
                              Code:
                              function addtochat($uid, $rid)
                              {
                              $bago = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline WHERE uid=&#39;".$uid."&#39; AND rid=&#39;".$rid."&#39;"));
                              if($bago[0]==0){
                              $msg = "*mat Enter the Room";
                              mysql_query("INSERT INTO ibwf_chat SET timesent=&#39;".time()."&#39;, chatter=&#39;".$uid."&#39;, text=&#39;".$msg."&#39;");
                              }
                              
                              $timeto = 120;
                              $timenw = time();
                              $timeout = $timenw - $timeto;
                              $exec = mysql_query("DELETE FROM ibwf_chonline WHERE lton<&#39;".$timeout."&#39;");
                              $res = mysql_query("INSERT INTO ibwf_chonline SET lton=&#39;".time()."&#39;, uid=&#39;".$uid."&#39;, rid=&#39;".$rid."&#39;");
                              if(!$res)
                              {
                              mysql_query("UPDATE ibwf_chonline SET lton=&#39;".time()."&#39;, rid=&#39;".$rid."&#39; WHERE uid=&#39;".$uid."&#39;");
                              }
                              }
                              Find this code inside your chat.php (If you cant find this code better to post your whole chat.php code here )
                              Code:
                              if(isspam($text))
                              {
                              $chnick = getnick_uid($chat[0]);
                              echo "[b]Chat system:[i]*$chnick, please don&#39;t try to spam*[/i][/b]
                              ";
                              }
                              Replace it with
                              Code:
                              if(isspam($text) || substr($chat[3],0,4)=="*mat")
                              {
                              $chnick = getnick_uid($chat[0]);
                              if(isspam($text)){
                              echo "[b]Chat system:[i]*$chnick, please don&#39;t try to spam*[/i][/b]
                              ";
                              }else{
                              echo "[b]Chat system:[i]*$chnick, Joined the room*[/i][/b]
                              ";
                              }
                              }

                              Comment


                                #30
                                Ok lets finish this one. But a little advice bro as site owner you dont need to be a good coder but you must atleast understand php code

                                Here it is Replace your addtochat function with
                                Code:
                                function addtochat($uid, $rid)
                                {
                                $bago = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline WHERE uid=&#39;".$uid."&#39; AND rid=&#39;".$rid."&#39;"));
                                if($bago[0]==0){
                                $msg = "*mat Enter the Room";
                                mysql_query("INSERT INTO ibwf_chat SET timesent=&#39;".time()."&#39;, chatter=&#39;".$uid."&#39;, text=&#39;".$msg."&#39;");
                                }
                                
                                $timeto = 120;
                                $timenw = time();
                                $timeout = $timenw - $timeto;
                                $exec = mysql_query("DELETE FROM ibwf_chonline WHERE lton<&#39;".$timeout."&#39;");
                                $res = mysql_query("INSERT INTO ibwf_chonline SET lton=&#39;".time()."&#39;, uid=&#39;".$uid."&#39;, rid=&#39;".$rid."&#39;");
                                if(!$res)
                                {
                                mysql_query("UPDATE ibwf_chonline SET lton=&#39;".time()."&#39;, rid=&#39;".$rid."&#39; WHERE uid=&#39;".$uid."&#39;");
                                }
                                }
                                Find this code inside your chat.php (If you cant find this code better to post your whole chat.php code here )
                                Code:
                                if(isspam($text))
                                {
                                $chnick = getnick_uid($chat[0]);
                                echo "[b]Chat system:[i]*$chnick, please don&#39;t try to spam*[/i][/b]
                                ";
                                }
                                Replace it with
                                Code:
                                if(isspam($text) || substr($chat[3],0,4)=="*mat")
                                {
                                $chnick = getnick_uid($chat[0]);
                                if(isspam($text)){
                                echo "[b]Chat system:[i]*$chnick, please don&#39;t try to spam*[/i][/b]
                                ";
                                }else{
                                echo "[b]Chat system:[i]*$chnick, Joined the room*[/i][/b]
                                ";
                                }
                                }
                                [/b]
                                Code:
                                                    $chnick = getnick_uid($chat[0]);
                                                    $tonick = getnick_uid($chat[1]);
                                                    $optlink = "$iml by ".$chnick." to ".$tonick;
                                                  }
                                                  
                                                  $ds= date("H.i.s", $chat[2]);
                                                  $text = parsepm($chat[3], $sid);
                                                  $nos = substr_count($text,"<img src=");
                                                  if(isspam($text) || substr($chat[3],0,4)=="*mat")
                                {
                                $chnick = getnick_uid($chat[0]);
                                if(isspam($text)){
                                echo "[b]Chat system:[i]*$chnick, please don&#39;t try to spam*[/i][/b]
                                ";
                                }else{
                                echo "[b]Chat system:[i]*$chnick, Joined the room*[/i][/b]
                                ";
                                }
                                }
                                 else if($nos>2){
                                $chnick = getnick_uid($chat[0]);
                                                    echo "[b]Chat system:»[i]*hey! $chnick, you can only use 2 smilies per msg*[/i][/b]
                                ";
                                where do i get it wrong? ? Nothing seems to be appear. .Help

                                Comment

                                Working...
                                X