php problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
timothye
Forum Newbie
Posts: 15
Joined: Sun Feb 01, 2004 2:36 pm
Location: Sweden/Sverige/USA

php problem

Post 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
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

That just made me so confused :S
User avatar
timothye
Forum Newbie
Posts: 15
Joined: Sun Feb 01, 2004 2:36 pm
Location: Sweden/Sverige/USA

Post 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 !
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post 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
User avatar
timothye
Forum Newbie
Posts: 15
Joined: Sun Feb 01, 2004 2:36 pm
Location: Sweden/Sverige/USA

Post by timothye »

thats exactly what i wrote ..thanks for your help
User avatar
timothye
Forum Newbie
Posts: 15
Joined: Sun Feb 01, 2004 2:36 pm
Location: Sweden/Sverige/USA

Post by timothye »

anyone have any ideas .what iam experiencing and how to fix this .
cheers
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Post 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 />
User avatar
timothye
Forum Newbie
Posts: 15
Joined: Sun Feb 01, 2004 2:36 pm
Location: Sweden/Sverige/USA

Post by timothye »

hey m8 it worked like a charm ..''<br>"
thanks again !
cheers :lol:
User avatar
William
Forum Contributor
Posts: 332
Joined: Sat Oct 25, 2003 4:03 am
Location: New York City

Post by William »

Glad I could help!
Post Reply