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

From: Date: Sun, 18 Sep 2005 06:09:53 +0000
Subject: note 56877 added to function.get-magic-quotes-gpc
Groups: php.notes 
Request: Send a blank email to php-notes+get-95349@lists.php.net to get a copy of this message
A fast and easy way for getting rid of magic_quotes_gpc. Just include this piece of code in the beginning of your script and later you won't have to bother whether magic_quotes_gpc is on or off, it will be the same as off: if ( get_magic_quotes_gpc () ) { function traverse ( &$arr ) { if ( !is_array ( $arr ) ) return; foreach ( $arr as $key => $val ) is_array ( $arr[$key] ) ? traverse ( $arr[$key] ) : ( $arr[$key] = stripslashes ( $arr[$key] ) ); } $gpc = array ( &$_GET, &$_POST, &$_COOKIE ); traverse ( $gpc ); } ---- Manual Page -- http://www.php.net/manual/en/function.get-magic-quotes-gpc.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+56877 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56877&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56877&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56877&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56877&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56877&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+56877&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56877&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+56877&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#95349) next »