Reply to Re: Slashes in Forms

Your name:

Reply:


Posted by Mara Guida on 10/23/12 11:34

StevePBurgess@gmail.com wrote:
> Ok. I have checked the magic quotes is on.

Can't you turn it off?

> A PHP script processes [the POST data]. If there any errors the input
> is urlencoded and returned to the webpage

urlencoded? spaces shown as "+"?

<snip>
> Any thoughts?


This works for me, both with magic_quotes_gpc Off or On

========
<?php
if (get_magic_quotes_gpc()) {
function magic_UNquote($txt) {
return stripslashes($txt);
}
} else {
function magic_UNquote($txt) {
return $txt;
}
}
echo '$_POST[\'txt\'] = [', $_POST['txt'], "]<br />\n<br />\n";
$val = (isset($_POST['txt']) && ($_POST['txt'] !=
''))?(magic_UNquote($_POST['txt'])):('three quotes: """; three single
quotes: \'\'\'; three slashes: ///; three backslashes: \\\\\\; and
nothing more!');
$val = str_replace('"', '&quot;', $val);
echo '$val = [', $val, "]<br />\n<br />\n";
?>
<form action="" method="post">
<input type="text" name="txt" size="120" value="<?php echo $val; ?>"
/><input type="submit" />
</form>
========

HTH

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация