Manual, stripslashes() , , , . : PHP , . , , , escape- . Stripslashes() , , , PHP: .
PHP, , , ; :
... useful when mSQL or Postgres95 support is enabled
since ... single quote has to be escaped when it is
part of [a] ... query ...
(See php.h in PHP/FI [php-2.0.1] )
addlashes(), . O'Reilly O\'Reilly. stripslashes() . stripslashes() , , , , PHP5.3, PHP5.4 (. Manual).
, PHP, . , $_GET, JavaScript, url, :
location.href="next_page.php?name=O%27Riley"; // $_GET['name'] == O\'Riley
$_GET ['name'] addlashes(), mysqli_real_escape_string(), , :
O\\\'Riley
, . . , :
O\'Riley
stripslashes() , . JavaScript, :
location.href="http://localhost/exp/mydog.php
?content=My%20dog%20doesn\\\\\\\\\\\\\%27t%20
like%20to%20stay%20indoors."
stripslashes(), :
function removeslashes($string)
{
while( strpos( $string, "\\" ) !== FALSE ) {
$string = stripslashes( $string );
}
return $string;
}
$text = htmlentities($_GET['content']);
if (strpos($text,"\\") !== FALSE ) {
echo removeslashes( $text );
}
: stripslashes() .