Hello, if you could please help me. I have a program that is like a flash chat… you make a username, login, then chat away the messages you send are got by a php file then sent to the database with html tags… in flash i have a movie clip that refreshes every 2seconds… ive checked the “Render text as HTML” button and even tried using chat.text.html = true; but it doesnt work… Heres the FLA and SWF please HELP!! its urgant!
FLA: http://68.102.62.109:8012/si/tester.fla
SWF: http://68.102.62.109:8012/si/tester.swf
also heres the php code for the chat part:
<?
$us = $_GET['username'];
$pw = $_GET['password'];
$gotRoom = $_GET['room'];
$inChat = $_GET['inChat'];
$timeOfChat = time();
$act = $_GET['action'];
$loginDB = mysql_connect("localhost:3306", "*****", "*******");
mysql_select_db("si", $loginDB); if($act == "userList"){
$result = mysql_query('select * from users_online WHERE invisible NOT LIKE 1 ORDER BY username ASC');
$numrows = mysql_num_rows($result);
$list = "userList=";
while($row = mysql_fetch_array($result)) {
if ($list != "userList=") {
$list .= ",";
}
$users_accID = $row['acc_ID'];
$user = $row['username'];
$user_member = $row['member'];
$user_type = $row['type'];
$user_invisble = $row['invisible'];
$room = $row['room'];
$list .= $users_accID . "-" . $user . "-" . $invisible . "-" . $user_member . "-" . $user_type . "-" . $user_invisible . "-" . $room;
}
$getMainStats = mysql_query("SELECT * FROM tbl_accounts WHERE username='" . $us . "'");
while($row = mysql_fetch_assoc($getMainStats)){
$account_id = $row['acc_ID'];
$getUser = $row['username'];
$userLevel = $row['userLevel'];
$member = $row['member'];
}
$postUser = mysql_query("INSERT INTO users_online (loginID, acc_ID, username, timeLoggedIn, member, type, invisible, room, inChat) VALUES
('', '" . $accound_id . "', '" . $getUser . "', '" . $timeOfChat . "', '" . $member . "', '" . $userLevel . "', '0', '" . $gotRoom . "', '" . $inChat . "')");
echo $list;
}
if($act == "sendMessage"){ //Get Vars
$room = $_GET['room'];
$user = $_GET['username'];
$timeOfChat = time();
$message = $_GET['message']; //Do stuff....
if($room !== ""){
if($msg !== ""){
//Get Last message sent into the database and see if you can even send another message yet...
$getMsg = mysql_query("SELECT * FROM messages WHERE username='$us'") or DIE ('error at $getMsg');
while($r = mysql_fetch_assoc($getMsg)){
$lastMsgTime = $r['lastMsgTime'];
$lastMessage = $r['lastMsg'];
}
if($lastMsgTime == ""){
$lastMsgTime = "50";
}
if($lastMsgTime <= $timeOfChat-2){
if($lastMessage !== $msg || $lastMessage == ""){
$getPerm = mysql_query("SELECT * FROM tbl_accounts WHERE username='$us'") or DIE ('error at $getPerm');
while($row = mysql_fetch_assoc($getPerm)){
$perms = $row['userLevel'];
$uname = $row['username'];
}
if($perms == "admin"){
$color = "DD0000";
$username = '<FONT COLOR="#' . $color . '">' . $uname . '</font>';
$msg = '<FONT COLOR="#ffffff">' . $message . '</font>';
} else if ($perms == "mod"){
$color = "ffffff";
$username = '<html><B><font color=#008000>' . $uname . '</font><B>';
$msg = '<B><font color=#' . $color . '>' . $message . '</font><B></html>';
} else if ($perms == "member"){
$color = "3d84bd";
$username = '<html><B><font color=#ffffff>' . $uname . '</font><B>';
$msg = '<B><font color=#' . $color . '>' . $message . '</font><B></html>';
} else {
$color = "ffffff";
$username = '<html><B><font color=#ffffff>' . $uname . '</font><B>';
$msg = '<B><font color=#' . $color . '>' . $message . '</font><B></html>';
}
$inputMsg = mysql_query("INSERT INTO messages (msgID, username, message, lastMessage, lastMsgTime, room) VALUES ('', '".$username."', '".$msg."', '".$msg."', '".$timeOfChat."', '".$room."')") or DIE ('error at $inputMsg');
} else {
echo "&error=flood";
}
} else {
echo "&error=too+fast";
}
} else {
echo "&error=no+msg";
}
} else {
echo "&error=not+in+room";
}
}
if($act == "getMessages"){
//get vars
$room = $_GET['room'];
if($room !== ""){
$expireTime = time() - 120;
$delMessages = mysql_query("DELETE FROM messages where lastMsgTime <= '" . $expireTime . "'") or DIE ("error at delMessages");
//query the thing fer the room
$getMessages = mysql_query("SELECT * FROM messages WHERE room='$room'") or DIE ("error @ getMessages");
$msgAmount = mysql_num_rows($getMessages);
$msgs = "&messages=";
while($row = mysql_fetch_assoc($getMessages)){
$msgID = $row['msgID'];
$username = $row['username'];
$message = $row['message'];
$lastMsg = $row['lastMessage'];
$lastMsgTime = $row['lastMsgTime'];
$roomName = $row['room'];
$msgs .= $username. ": " . $message . "<BR>";
}
echo $msgs;
} }
?>