I'm using a PHP guestbook I wrote, but I'm having a bit of a problem. When you post to it, it opens and writes to a .txt file (I don't have a mySQL account on the server it's on), and then uses include() to print it in the HTML. When it writes to the file, though, it escapes characters like returns and single quotes with '///' which looks ridiculous. I've tried a lot to get it to stop, but I'm stumped.
Thanks,
Casey Dentinger
PHP Guestbook Problem
Moderator: General Moderators
-
caseyd_dot_net
- Forum Newbie
- Posts: 4
- Joined: Wed Nov 13, 2002 9:01 pm
Here's what I'm using to write to the file:
<?php
$date = date("n\/j\/y");
$info = "
<div class='GuestBook'>
<p class='Info'>
$name
<br />
$REMOTE_ADDR
<br />
$email
<br />
$date
</p>
<br />
<br />
<p class='Message'>
$message
</p>
</div>
";
if (isset($submit) && isset($message)) {
escapeshellcmd($name, $email, $message);
$fd = fopen("post-it.txt", "a+");
fputs($fd, stripslashes($info));
fclose($fd);
}
?>
As I'm sure you could guess, all this data is passed to this by an HTML form and then printed with <?php include() ?>.
Casey Dentinger
<?php
$date = date("n\/j\/y");
$info = "
<div class='GuestBook'>
<p class='Info'>
$name
<br />
$REMOTE_ADDR
<br />
<br />
$date
</p>
<br />
<br />
<p class='Message'>
$message
</p>
</div>
";
if (isset($submit) && isset($message)) {
escapeshellcmd($name, $email, $message);
$fd = fopen("post-it.txt", "a+");
fputs($fd, stripslashes($info));
fclose($fd);
}
?>
As I'm sure you could guess, all this data is passed to this by an HTML form and then printed with <?php include() ?>.
Casey Dentinger