Time next to username to room

Started on the old forum in August 2009 · view the original in the archive · old links redirect here

2 replies · 396 views · started 17 years ago · 2 min read

2 participants
Leviathan73 Senior · 260 posts #1

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

CREATE TABLE `ibwf_chat` (
`id` int(99) NOT NULL auto_increment,
`chatter` int(100) NOT NULL default '0',
`who` int(100) NOT NULL default '0',
`timesent` int(50) NOT NULL default '0',
`msgtext` varchar(255) NOT NULL default '',
`data` varchar(5) NOT NULL default '',
`rid` int(99) NOT NULL default '0',
`exposed` char(1) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
 

put this file chat.php

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

$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

$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

echo $data."<a href=\"chat.php?action=say2&sid=$sid&who=$chat[0]&rid=$rid&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?

///////////////////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;(

something else Fellow · 2,296 posts #2

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

$time = time();
$seconds = $time - $chat[2];
echo "message posted $seconds seconds ago<br/>";
Leviathan73 Senior · 260 posts #3

Thanks, I solved .. thanks friend 🙂

Write your reply now; next you create a free account (or sign in) and it is posted right away. 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