Page 1 of 1

php problem

Posted: Sun Feb 01, 2004 2:36 pm
by timothye
i am having a problem with ..simple chatbox flash and php
here is the problem
when i type a url and it is displayed ,it works .
but what is happening is that it doubles up on the name and message
like this >>name:messageurl,link name
it should be like this
name: message & link
name: message & link
but its not
after i added this code its been action up .

Code: Select all

$msg = str_replace ("\n"," ", $message);
$msg = stripslashes ($msg);
if ($msg != ""){
$fp = fopen($chat_file, "a+");
$fw = fwrite ($fp, "<i><a href=mailto:$email>@</a> <a href=$url target=_blank>$name</a></i> $message\n<br>");for ($i = 0; $i < $comments; $i++) {fwrite ($fp, $comfile[$i]);}fclose($fp);} 
$fw = fwrite($fp, "<font color="#FF0000">$username :</font> $msg\n");
fclose($fp);} 
$lines = file($chat_file);
$a = count($lines);
$u = $a - $chat_lenght;
for($i = $a; $i >= $u ;$i--){
echo $lines[$i];
}
?>
these are the lines i added..

Code: Select all

$fw = fwrite ($fp, "<i><a href=mailto:$email>@</a> <a href=$url target=_blank>$name</a></i> $message\n<br>");for ($i = 0; $i < $comments; $i++) {fwrite ($fp, $comfile[$i]);}fclose($fp);}
thanks for any help !!
cheers

Posted: Sun Feb 01, 2004 3:13 pm
by John Cartwright
That just made me so confused :S

Posted: Sun Feb 01, 2004 3:17 pm
by timothye
the lines i added are making the problem ..
cheers for any body that can REPLY and help !
That just made me so confused :S
that doesnt make any sense at all !

Posted: Sun Feb 01, 2004 3:20 pm
by John Cartwright
What is your problem.. your explanation is confusing me


is it doing this?

name: message & link name: message & link name: message & link


instead of

name: message & link
name: message & link
name: message & link

Posted: Sun Feb 01, 2004 3:22 pm
by timothye
thats exactly what i wrote ..thanks for your help

Posted: Sun Feb 01, 2004 8:33 pm
by timothye
anyone have any ideas .what iam experiencing and how to fix this .
cheers

Posted: Sun Feb 01, 2004 9:02 pm
by William
O that pm you sent me i guess what I thaught it was isnt it hmm... Try getting id of the \n and then try if that don't work take the \n away and replace it with another <br />

Posted: Sun Feb 01, 2004 9:37 pm
by timothye
hey m8 it worked like a charm ..''<br>"
thanks again !
cheers :lol:

Posted: Sun Feb 01, 2004 9:38 pm
by William
Glad I could help!