Time next to username to room

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

    Time next to username to room

    Hello friends! I ask for help, I can not update the next hour and minute all'username when I'm in the chat room. when you refresh the page, you also update the timetables of other messages, ie, a message written ten minutes ago .. update it with the current time. I'm trying to figure out what is wrong. I created this table
    PHP Code:
    CREATE TABLE `ibwf_chat` (
    `
    idint(99NOT NULL auto_increment,
    `
    chatterint(100NOT NULL default '0',
    `
    whoint(100NOT NULL default '0',
    `
    timesentint(50NOT NULL default '0',
    `
    msgtextvarchar(255NOT NULL default '',
    `
    datavarchar(5NOT NULL default '',
    `
    ridint(99NOT NULL default '0',
    `
    exposedchar(1NOT NULL default '0',
    PRIMARY KEY (`id`)
    ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=
    put this file chat.php
    PHP Code:
    include("config.php"); 
    include(
    "core.php"); 
    connectdb();
    $action=$_GET["action"];
    $id=$_GET["id"];
    $sid $_GET["sid"];
    $rid=$_GET["rid"];
    $rpw=$_GET["rpw"];
    $uid getuid_sid($sid);
    $uexist isuser($uid);
    $theme mysql_fetch_array(mysql_query("SELECT theme FROM ibwf_users WHERE id='".$uid."'"));
    $data date("H:i"); 
    dopo fatto questo codice
    PHP Code:
    $chatok mysql_query("INSERT INTO ibwf_chat SET  chatter='".$uid."', who='".$who."', timesent='".time()."', data='".time()."', msgtext='".$message."', rid='".$rid."';");
          
    $lstmsg mysql_query("UPDATE ibwf_rooms SET lastmsg='".time()."' WHERE id='".$rid."'"); 
    e questo
    PHP Code:
    $chatok mysql_query("INSERT INTO ibwf_chat SET  chatter='1', who='', timesent='".time()."', data='".time()."', msgtext='".$reply." @".getnick_uid($uid)."', rid='".$rid."';");
     
             }
              
    $message "";
                }
     
                echo 
    "<br/>";
                
    $chats mysql_query("SELECT chatter, who, timesent, msgtext, exposed,data FROM ibwf_chat WHERE rid='".$rid."' ORDER BY timesent DESC, id DESC");
                
    $counter=0
    e poi questo
    PHP Code:
    echo $data."<a href=\"chat.php?action=say2&amp;sid=$sid&amp;who=$chat[0]&amp;rid=$rid&amp;rpw=$rpw\">$optlink</a>:<br> ";
      echo 
    $tosay."<br/>"
    but I do not understand why the messages are not updated! Maybe it takes a function in file core.php?
    PHP Code:
    ///////////////////clear data  function cleardata(){  $timeto = 100;  $timenw = time();  $timeout = $timenw - $timeto;  $exec = mysql_query("DELETE FROM ibwf_chonline WHERE lton<'".$timeout."'");  $timeto = 300;  $timenw = time();  $timeout = $timenw - $timeto;  $exec = mysql_query("DELETE FROM ibwf_chat WHERE timesent<'".$timeout."'");  $timeto = 60*60;  $timenw = time();  $timeout = $timenw - $timeto;  $exec = mysql_query("DELETE FROM ibwf_search WHERE stime<'".$timeout."'"); 
    Thanks to those who know help me

    #2
    Your trying to post the amount of time the message was posted?
    eg:
    something else: blah blah blah
    message posted 46 seconds ago

    Code:
    $time = time();
    $seconds = $time - $chat[2];
    echo "message posted $seconds seconds ago<br/>";
    Last edited by something else; 27.08.09, 03:53.

    Comment


      #3
      Thanks, I solved .. thanks friend

      Comment

      Working...
      X