i build an cms.... for a website....
but if i save the text wich the user has typed and there is an " in the php replaces me the " to an \"
the i wrote a little script to replace that...
but now php makes me out of the " an ""
heres the code...
$copytext = the text wich i want to save
[syntax=php]$a = chr(34); //assign ascii \
$b = chr(92); //assign ascii "
$c = $a.$b; //merge ascii \"
$d = """;
$e = chr(59); //assign ascii ;
$f = $d.$e; //merge
$g = chr(7); //assign ascii linefeed
$h = explode($g, $copytext); //delete linefeed
$w = str_replace($b, $f, $h); //replace \" -> "
$z = "../_base_include/";
$z .= $save;
$z .= ".txt";
$x = fopen($z , "w");
$test = $w[0];
fwrite($x, $test);
fclose($x);[/syntax]
can anyone tell me what is wrong with it ?!?
prob with replacing "
Moderator: General Moderators
why don't you use addslashes()?
http://it.php.net/manual/en/function.addslashes.php
http://it.php.net/manual/en/function.addslashes.php
Sorry
,
perhaps you are interested in "stripslashes"
http://it.php.net/manual/en/function.stripslashes.php
perhaps you are interested in "stripslashes"
http://it.php.net/manual/en/function.stripslashes.php