How To Add This Function In Chat.php

Started on the old forum in February 2008 · view the original in the archive · old links redirect here

20 replies · 2,170 views · started 18 years ago · 1 min read

9 participants
SiLeNce Developer · 138 posts #1

Please help me how to make the function

Chat System> 19:29am

methos enterd

who know how to add this function ??

special example from

http://www.methos.co.za

alesh Lead · 604 posts #2

Easy! When u enter in chat room click SAY then type "Silence enter in the room" and click SUBMIT! and there u have...lol

eeeeerrr....

cortez Junior · 27 posts #3

lol he want wen chatter r enter in chat its show enter

amylee Principal · 1,092 posts #4

all hes done is edited the chat system its easy to do just mess about with the $who function

SiLeNce Developer · 138 posts #5

Easy! When u enter in chat room click SAY then type "Silence enter in the room" and click SUBMIT! and there u have...lol

haha alesh .. you make me laugh External image (may be gone) ..

urm amy ..

you have the function ??

can teach me how ?

mcKeny Developer · 130 posts #7

edit this part in core in the add to chat function

  $res = mysql_query("INSERT INTO ibwf_chonline SET lton='".time()."', uid='".$uid."', rid='".$rid."'");
  if($res)
  {
      $msg = getnick_uid($uid)."enter the room";  mysql_query("INSERT INTO ibwf_chat SET timesent='".time()."', userid='0', text='".$msg."'");
}
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]=='0')
{
$item[0]="chat_system";
echo $item[0].$item[1].$item[2];
}
else
{
//print the items
}

that work a 100 percent when i use to use the lava script

R.M.C

PHP Adovocate B)

Guest #8

do an sql check to see if the user is already in the room if not then the part that enter the user in the sql put what information you want to send to the chat room

SiLeNce Developer · 138 posts #9

$res = mysql_query("INSERT INTO ibwf_chonline SET lton='".time()."', uid='".$uid."', rid='".$rid."'"); if($res) { $msg = getnick_uid($uid)."enter the room"; mysql_query("INSERT INTO ibwf_chat SET timesent='".time()."', userid='0', text='".$msg."'"); } else { //just update the chonline list }

you mean what code to put

//just update the chonline list

??

can give the example ??

and

$sql = mysql_query("SELECT userid,timesent,text FROM ibwf_chat"); while($item = mysql_fetch_array($sql)) { if($item[0]=='0') { $item[0]="chat_system"; echo $item[0].$item[1].$item[2]; } else { //print the items }

put where ?

SiLeNce Developer · 138 posts #10

here my addtochat

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

Guest #11

Someone can tell exactly how this function, To say when a user enters the room to chat Therefore gave several examples, and I could not use any,, Help please

(Lavalair)

Guest #12

function addtochat($uid, $rid) { $timeto = 120; $timenw = time(); $timeout = $timenw - $timeto; $exec = mysql_query("DELETE FROM ibwf_chonline WHERE lton<'".$timeout."'"); $res = mysql_query("INSERT INTO ibwf_chonline SET lton='".time()."', uid='".$uid."', rid='".$rid."'"); if($res) { $msg = getnick_uid($uid)."enter the room"; mysql_query("INSERT INTO ibwf_chat SET timesent='".time()."', userid='0', text='".$msg."'"); } }

mate is nt working wen i ryt cht msg its hide

Guest #14

This topic gave me many new ideas! External image (may be gone) Now you can also add "user left chatroom!" kinda stuff. And even you can add "user is trashed" "user is banned" Oh and my favorite function "user has been kicked" And now you can add, Invite user option. ANd can also Add invite user to private chat option. And maybe you can also add a function like mig33, where users can Vote to kick a user out of the chatroom! lol why am i sharing all these ideas hehe

alexism Developer · 136 posts #16

so where is the solution??u all r talking rubbish..!!

mcKeny Developer · 130 posts #19

hmmm rukiya has done what i said and its working at his site

options ,  refresh 
Inbox(1 /1) 

chat_system » 20.58.52 
mc_keny enters the room 
Who's Inside(1) 
Chatrooms 
Home

the vote to kick user is easy... after a person start the kick i insert the user in a table call mc_kick and set kick time to 1 then check in the table WHERE useR has been kicked once if yes the chat system says a kick war has been started by mc_keny need 4 more vote,...untill its equal to 5 .. chat system says learner has been kicked out the room...php is so easy if you got interest and is determin to
learn ...pride is what thought me php i got so many pride i hate the idea of asking for help....i prefer stay a hour on the one error untill i solve it .. External image (may be gone) now i code anything as long as its possible. .

R.M.C

PHP Adovocate B)

alexism Developer · 136 posts #20

where is the code?this? :

$res = mysql_query("INSERT INTO ibwf_chonline SET lton='".time()."', uid='".$uid."', rid='".$rid."'"); if($res) { $msg = getnick_uid($uid)."enter the room"; mysql_query("INSERT INTO ibwf_chat SET timesent='".time()."', userid='0', text='".$msg."'"); } 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]=='0') { $item[0]="chat_system"; echo $item[0].$item[1].$item[2]; } else { //print the items }

i have put in my addtochat function :

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

if(!$res) { mysql_query("UPDATE ibwf_chonline SET lton='".time()."', rid='".$rid."' WHERE uid='".$uid."'"); } }

become this :

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

if($res) { $msg = getnick_uid($uid)."enter the room"; mysql_query("INSERT INTO ibwf_chat SET timesent='".time()."', userid='0', text='".$msg."'"); } 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]=='0') { $item[0]="chat_system"; echo $item[0].$item[1].$item[2]; } else { //print the items }

and i got this!!

Parse error: syntax error, unexpected T_STRING in /home/xxxxxx/public_html/web/core.php on line 713

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close