Page 1 of 1
Putting "" in Varables
Posted: Sat Feb 21, 2004 6:06 am
by Darkark
I'm trying to create an basic Remote File System for writing files in a directory. However, when a file is created witch has an speechmark (") in it, the Speech marks get '/' added between them. Is there any way of stoping this?
Posted: Sat Feb 21, 2004 6:47 am
by Pointybeard
Straight outta da manual, tweak to your needs

Ive written a fairly robust blog/news posting system for my site using, essentially, just that and it works well.
Code: Select all
// $document should contain an HTML document.
// This will remove HTML tags, javascript sections
// and white space. It will also convert some
// common HTML entities to their text equivalent.
$search = array ("'<script[^>]*?>.*?</script>'si", // Strip out javascript
"'<[\/\!]*?[^<>]*?>'si", // Strip out html tags
"'([\r\n])[\s]+'", // Strip out white space
"'&(quot|#34);'i", // Replace html entities
"'&(amp|#38);'i",
"'&(lt|#60);'i",
"'&(gt|#62);'i",
"'&(nbsp|#160);'i",
"'&(iexcl|#161);'i",
"'&(cent|#162);'i",
"'&(pound|#163);'i",
"'&(copy|#169);'i",
"'&#(\d+);'e"); // evaluate as php
$replace = array ("",
"",
"\\1",
""",
"&",
"<",
">",
" ",
chr(161),
chr(162),
chr(163),
chr(169),
"chr(\\1)");
$text = preg_replace ($search, $replace, $document);
-PB
Posted: Sat Feb 21, 2004 7:31 am
by d3ad1ysp0rk
stripslashes()
Posted: Sun Feb 22, 2004 1:52 am
by Pointybeard
:p that'd do it too. Very specific tho. Of course it depends on how fancy you want the whole thing.