Welcome, Guest.
Login
|
Register
Username:
Password:
Remember me:
Chatroom Online help
Please log in to post.
Watch thread
Unwatch thread
Started by
M.J kInG
07 Nov 2011 15:47
By
M.J kInG
(
1334
)
On 07 Nov 2011 15:47
i having problem with my chatroom online script in chatroom.
Like if the users stay in the chatroom for period of time then there username will not display on the top like dsipaint
Here the script
?php
include("database.php");
$comment=mysql_real_escape_string(htmlspecialchars($_POST[comment]));
session_start();
$Online =time()+30*100;
if($comment ==""){
include("database.php");
mysql_query("UPDATE users SET chatroom_online='offline' WHERE username='".$_SESSION['username']."'<'$Online'");
}
else{
session_start();
include("database.php");
$result = mysql_query("UPDATE users SET chatroom_online='Online' WHERE username='".$_SESSION['username']."'");
$result = mysql_query("SELECT * FROM users WHERE username='".$_SESSION['username']."'");
$result = mysql_query("SELECT * FROM users Where username='".$_SESSION['username']."' and chatroom='Yes'");
$result = mysql_query("SELECT * FROM users Where chatroom_online='Online' ORDER BY Online DESC LIMIT 0,100");
while($row = mysql_fetch_array($result)){
if($row['username'] =="maleck"){
echo"<div id='names'><div id=fun>maleck</div></div>";
}
else{
if($row['chatroom'] =="Yes") {
echo"<font id='names' color=red>";
echo $row['username'];
echo"</font><br>";
}
else{
echo"<div id='names'>";
echo $row['username'];
echo"</div>";
}
}
}
}
?>
<?
session_start();
?>
A true developer
By
M.J kInG
(
1334
)
On 07 Nov 2011 15:48
the time=time()+10*60 not working right for some reason
A true developer
By
PasserByGuy
(
268
)
On 10 Nov 2011 04:06
The problem with your script is that if the user refreshes the page, s/he has not posted a comment, making their status offline.
Try using sessions and not a database for this kind of stuff by the way.
Does this alter-ego make me look stupid?
By
M.J kInG
(
1334
)
On 10 Nov 2011 15:02
Ok i change it up
A true developer
Nintendo 3DS is ™ Nintendo Co. Ltd. This website is ©2009-2024 HullBreach Studios. All rights reserved. Members are responsible for their own content. No account information will be given to third-parties without your consent.