prob with replacing "
Posted: Sat Aug 02, 2003 9:58 am
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 ?!?
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 ?!?