Darn \s

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Hello everyone.  I'm having a problem with a php script that updates a
news file for my website.  Whenever I use a quote (either single or
double) and view the news page, I get the \ escape character.  My
script opens up the .html file, and write the contents of the textbox.
I have my script below.  I realize why it's happening, just can't
figure out how to fix it...

Thank you


=====my post form=====

  <title>New Post</title>
<form method="post" action="post.php" name="form1">
  <input type = "text" name = "subject"><br>
Body of post:<br>
  <textarea cols="100" rows="10" name="body"></textarea>
Your name (keep it consistant):<br>
  <input type = "text" name = "name">
Your password:<br>
  <input type = "password" name = "password">
  <input value="Submit" name="submit" type="submit"></form>

=====my updater php file=====

  <title>Posting... - Notetaker 1.0</title>


if ($_POST["password"] == "[hidden, you know :P]") {

echo "Password correct.";

// ok, first, open the old news file from news.html

$oldnewsf = fopen("./posts2005/news.html","r");

// now, read that in

$oldnews = fread($oldnewsf,filesize("./posts2005/news.html"));

$mynotesTemp = nl2br($_POST["body"]);
$mynotes = "<h3>" . $_POST["subject"] . "</h3>" . $mynotesTemp .
"<br><br>Posted by <i>" . $_POST["name"] . "</i> on " . date("l dS of F
Y h:i:s A") . "<br><hr><p><br>";

// now, make $newnews equal to our body + old, so the new message
appears on top of the old

$newnews = $mynotes . $oldnews;

// and write that WRITING OVER the old one...
// but not before closing it as i don't think it would work writing to
an open file
// and don't feel like experimenting

$newnewsf = fopen("./posts2005/news.html","w");

// Write to log file the IP, date, time

$flog = fopen("./log.html","a");
fwrite($flog, "<a href = http://www.whois.sc /" .
$_SERVER["REMOTE_ADDR"] . ">" . $_SERVER["REMOTE_ADDR"] . "</a>"  . "
accessed on ");
fwrite($flog, date("l dS of F Y h:i:s A"));
fwrite($flog, "<br>");

// End log

// Tell them what they sent

echo "<br><br><b>You wrote:</b><br><br>";
echo $mynotes;

// Provide link back to home

echo "<p><br><a href = ./index.html>Home</a>";

} else {
echo "Wrong password, dude.";




=====end code=====

Re: Darn \s

"IWP506@gmail.com" wrote:

Quoted text here. Click to load it

Try this: <http://uk.php.net/stripslashes

phil [dot] ronan @ virgin [dot] net
http://vzone.virgin.net/phil.ronan /

Site Timeline