note 103863 added to function.get-magic-quotes-gpc

From: Date: Sat, 07 May 2011 14:03:57 +0000
Subject: note 103863 added to function.get-magic-quotes-gpc
Groups: php.notes 
Request: Send a blank email to php-notes+get-179520@lists.php.net to get a copy of this message
<?php /** * return to addslahes without any problems * * @param string the posts , gets and cookies ... etc values * @autohr Yousef Ismaeil - cliprz AT gmail DOT com */ function magic_slashes ($string) { if (function_exists('get_magic_quotes_gpc')) { if (get_magic_quotes_gpc()) { $result = $string; } else { if (function_exists('addslashes')) { $result = addslashes($string); } else { $result = mysql_real_escape_string($string); } } } return $result; } ?> other way to kill slashes from posts like bottom func @Warning : bottom functions Have not been tested carefully . <?php /** * return to remove magic quotes gpc slashes and addslashes from user * * @param string * @autohr Yousef Ismaeil - cliprz AT gmail DOT com */ function kill_magic ($string) { // check magic_quotes_gpc if exists and its on if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) { // magic_quotes will be stripslahes if striped addslashes from user not MG gpc $result = stripslashes(addslashes($string)); } else { if (function_exists('addslashes')) { $result = addslashes($string); } else { $result = mysql_real_escape_string($string); } } return $result; } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 178.53.205.154 ---- Manual Page -- http://www.php.net/manual/en/function.get-magic-quotes-gpc.php Edit -- https://master.php.net/note/edit/103863 Del: integrated -- https://master.php.net/note/delete/103863/integrated Del: useless -- https://master.php.net/note/delete/103863/useless Del: bad code -- https://master.php.net/note/delete/103863/bad+code Del: spam -- https://master.php.net/note/delete/103863/spam Del: non-english -- https://master.php.net/note/delete/103863/non-english Del: in docs -- https://master.php.net/note/delete/103863/in+docs Del: other reasons-- https://master.php.net/note/delete/103863 Reject -- https://master.php.net/note/reject/103863 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#179520) next »