note 103121 added to function.addslashes
| From: | cliprz at gmail dot com | Date: | Sun, 27 Mar 2011 07:08:49 +0000 |
| Subject: | note 103121 added to function.addslashes | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-178246@lists.php.net to get a copy of this message | ||
<?php
/**
* @desc add slashes if use MySQL and check if function addslashes is exits else
* return to escape string in MySQL .
* same way its return to stripslashes function
* @param string $type any string u want to insert in MySQL and display from MySQL
* @param string $type must be add to add slashes and strip to strip slashes
* @author Yousef Ismaeil - cliprz@gmail.com
*/
function PHP_slashes($string,$type='add')
{
if ($type == 'add')
{
if (get_magic_quotes_gpc())
{
return $string;
}
else
{
if (function_exists('addslashes'))
{
return addslashes($string);
}
else
{
return mysql_real_escape_string($string);
}
}
}
else if ($type == 'strip')
{
return stripslashes($string);
}
else
{
die('error in PHP_slashes (mixed,add | strip)');
}
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 178.53.239.81
----
Manual Page -- http://www.php.net/manual/en/function.addslashes.php
Edit -- https://master.php.net/note/edit/103121
Del: integrated -- https://master.php.net/note/delete/103121/integrated
Del: useless -- https://master.php.net/note/delete/103121/useless
Del: bad code -- https://master.php.net/note/delete/103121/bad+code
Del: spam -- https://master.php.net/note/delete/103121/spam
Del: non-english -- https://master.php.net/note/delete/103121/non-english
Del: in docs -- https://master.php.net/note/delete/103121/in+docs
Del: other reasons-- https://master.php.net/note/delete/103121
Reject -- https://master.php.net/note/reject/103121
Search -- https://master.php.net/manage/user-notes.php