itz like this i done a guestbook:
messages.txt
guestbook.php
gbscript.php
but therez one problem!
and whenever i put a ' it resulted \' or when i put " it resulted in \" i mean it appears at the guestbook.php(a part where the messages.txt).well when i looked thru the messages.txt it got \' too well i dunno how to stop that heres the script i used in gbscript.php , i just want u to help me stop this annoying slashes and yea the ereg replacing function doesnt even work 🙁
heres the script!
<?php
if ($name) {
$page = "messages.txt";
$comments = ereg_replace(":wartime:","<img src=wartime.gif>",$comments);
$comments = ereg_replace(":war:","<img src=war.gif>",$comments);
$comments = ereg_replace(":armed:","<img src=armed.gif>",$comments);
$comments = ereg_replace(":ak47:","<img src=ak47.gif>",$comments);
$comments = ereg_replace(":D)","<img src=sbw.gif>",$comments);
$comments = ereg_replace(":P","<img src=razz.gif>",$comments);
$comments = ereg_replace("8)","<img src=sun.gif>",$comments);
$comments = ereg_replace("\;)","<img src=wink.gif>",$comments);
$comments = ereg_replace(":(","<img src=sad.gif>",$comments);
$comments = ereg_replace(":O","<img src=suprised.gif>",$comments);
$comments = ereg_replace(":D","<img src=laugh.gif>",$comments);
$comments = ereg_replace(":)","<img src=smile.gif>",$comments);
$comments = ereg_replace("\'","'",$comments);
$comments = ereg_replace("\n","<BR>",$comments);
$fileMessage = "<P><SPAN id=head>$topic</SPAN><BR><SPAN id=spalt>Posted on <I><FONT color=#ffff99>\n";
$fileMessage .= (date("d F Y"));
$fileMessage .= " </FONT><FONT color=#ffffff>- </FONT></I>By <FONT color=#ffff99><I>$name</I></FONT></SPAN></P><P><SPAN>\n";
$fileMessage .= "$comments</SPAN></P>\n";
if (file_exists("$page")):
$cartFile = fopen("$page","a+");
fwrite($cartFile,$fileMessage);
fclose($cartFile);
else:
$cartFile = fopen("$page","a");
fwrite($cartFile,$fileMessage);
fclose($cartFile);
endif;
header("Location: guestbook.php");
exit;
}
else {
include('guestbook.php');
echo "<SCRIPT LANGUAGE=\"Javascript\">alert('Please fill in your name...')</SCRIPT>";
exit;
}
?>