Need help with parse error. - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Need help with parse error.

kylmakorpikylmakorpi Posts: 5Member
I am trying to make a message system for my website, which works on the same basis as ShoutBox, but is simpler. Unfortunately, after writing the code, my server informed my that there was an unexpected T_STRING at line 28. Please could someone explain what exactly this is and what I am doing wrong.
[hr]
[code]<?php

extract($_POST);

if($submit){
if(!$name) die("Please enter a name.");
if(!$msg) die("Please enter a message");

$handle = fopen("messages.inc","r+");

$date = strftime("%T, %D");

$msg = str_replace(":)","<img src='img/happy.gif' />",$msg);
$msg = str_replace(":(","image",$msg);
$msg = str_replace(":#","image",$msg);
$msg = str_replace(")","image",$msg);
$msg = str_replace(":D","image",$msg);
$msg = str_replace("O)","image,$msg);

$data = $name."|".$msg."|".$date;

fwrite($handle,$data);
fclose($handle); }

?>









Name: |
Msg: |
image
image
image
image
image |
|





<?php

$msgs = file('messages.inc');
krsort($msgs);

foreach($msgs as $sbox) {
list($name,$msg,$date) = explode("|",$sbox);
echo $name.": ".$msg." - ".$date; }

?>

[/code]
[hr]
Any help will be greatly appreciated. :-)

Comments

  • DarQDarQ Posts: 1,625Member
    [b][red]This message was edited by DarQ at 2003-9-1 10:45:17[/red][/b][hr]
    [code]
    $msg = str_replace("O)","image",$msg);
    [/code]

    this is the cause of your error. Replace that line with this one.. Its the last of your str_replace part of your script.

    EDIT!!!

    you forgot the last " in that line above ;-)

    good luck
    [size=5][italic][blue]Dar[RED]Q[/RED][/blue][/italic][/size]
    url--> http://space.servehttp.com (ssh,ftp,http,stmp,imap etc etc)



  • kylmakorpikylmakorpi Posts: 5Member
    whoops! thanks a lot! i'll be more careful next time. :-o
Sign In or Register to comment.