try this:

  if (!($html_support))
   {
         $user_message = htmlspecialchars(stripslashes($user_message));
   }

Wagner Tomy
Web Developer
Editus S.A.
----- Original Message -----
From: "Nick K." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 07, 2001 12:11 PM
Subject: [PHP] PHP inside code problem


hi there

---------------------------------------------
if ($act = "add") //Add the message...
 {
 if (!empty($user_name) && !empty($user_ip) && !empty($user_message) &&
!empty($user_sex)) {
  if (!($html_support))
   {
         $user_message = htmlspecialchars("$user_message");
   }
  $user_message = ereg_replace("\n","<br>","$user_message");
  $userinfo =
"$user_name!กำ!กำ$user_sex!กำ!กำ$user_ip!กำ!กำ$user_message!กำ!กำ$user_date"."\n";

  $fp = fopen("$filename",'a');
  flock($fp,2);
  fwrite($fp, $userinfo);
  flock($fp,1);
  fclose($fp);
  header("Location: index.php");
  setcookie("cuser",$user_name,time()+(3600*24*365),"/","$SERVER_NAME");
  exit;
 }
}
---------------------------------------------

The code above is what I use for processing messages....
Everytime when I'm trying to use the function, htmlspecialchars(),
it'll replace " with &quot; . After that, I save the data and print out
again,
the result will add "\" after the data... ( I don't want the extra "\")
There is an example.
When I try to type in ^^" to be my new message, it suppose to show the same
thing.
However, in the saved data, it shows  !กำ!กำ^^\&quot; (!กำ!กำ is what I use
to different from different filez)
I don't want the extra "\"....
however, I tried the way in below:

I use

$user_message = eregi_replace("<","&lt;","$user_message");
$user_message = eregi_replace(">","&gt;","$user_message");

instead of the original one which is

$user_message = htmlspecialchars("$user_message");

however, when I check the saved file, it still have and extra \ before the
characters " .
god damn it....
I run this code in windows98SR2, maybe it's micro$oft's problem, is it?
plz help me.....thx dudes

                                                    ....nick







-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to