I'm having a problem with the shoutbox I'm working on. In firefox, it works ok. At one point, the php page listed an error, but not anymore. I'm not sure if I fixed it or not. Either way, the message displays in the index page as it should. But in internet explorer, the php script just keeps refreshing and resending. It sends the correct message, but then keeps sending ":" . The index page never loads. I have to stop the process and then manually go back to the index page to see the original message and then a bunch of colons. I'm assuming it has to be something to do with the refresh tag at the bottom (maybe???), but I'm very new to php so I'm not sure how to fix it.
Also does anyone know how to set up BBcodes using the same form I'm using with the smileys? I'd rather not allow html codes directly. I'm not quite sure of the syntax to convert BBcodes into HTML codes or how to disable html codes.
<?php
$name = $_REQUEST['name'];
$message = $_REQUEST['message'];
//BBcodes and smileys
$code = array(
'/:\)/',
'/:\(/',
'/:P/',
'/:D/',
'/:S/',
'/>:O/',
'/:O/',
'/;\)/',
);
$image = array(
'<img src="smileys/smile.gif">',
'<img src="smileys/sad.gif">',
'<img src="smileys/tongue.gif">',
'<img src="smileys/bigsmile.gif">',
'<img src="smileys/confused.gif">',
'<img src="smileys/mad.gif">',
'<img src="smileys/shocked.gif">',
'<img src="smileys/wink.gif">',
);
$formatted = preg_replace($code, $image, $message);
$tag = "<font face=\"verdana\" color=\"#ADFF00\" size=\"-1\"><b>$name:</b> $formatted </font><br>\r\n";
$read = fopen("msg.txt", "r");
$contents = fread($read, filesize('msg.txt'));
fclose($read);
$write = fopen("msg.txt", "w");
fwrite($write, "$tag $contents");
fclose($write);
print "<meta http-equiv=\"refresh\" content=\"0;index.php\">";
?>