note 94681 added to function.addslashes

From: Date: Wed, 18 Nov 2009 10:04:45 +0000
Subject: note 94681 added to function.addslashes
Groups: php.notes 
Request: Send a blank email to php-notes+get-163021@lists.php.net to get a copy of this message
Modifying aditya's code to take care of magic_quotes settings automatically. I hope the following code in config file or something, which gets executed before any post variables are processed will give excellent security irrespective of PHP settings. if (!get_magic_quotes_gpc()) { //create array to temporarily grab variables $input_arr = array(); //grabs the $_POST variables and adds slashes foreach ($_POST as $key => $input_arr) { $_POST[$key] = addslashes($input_arr); } } ---- Server IP: 69.147.83.197 Probable Submitter: 116.68.124.161 ---- Manual Page -- http://www.php.net/manual/en/function.addslashes.php Edit -- https://master.php.net/note/edit/94681 Del: integrated -- https://master.php.net/note/delete/94681/integrated Del: useless -- https://master.php.net/note/delete/94681/useless Del: bad code -- https://master.php.net/note/delete/94681/bad+code Del: spam -- https://master.php.net/note/delete/94681/spam Del: non-english -- https://master.php.net/note/delete/94681/non-english Del: in docs -- https://master.php.net/note/delete/94681/in+docs Del: other reasons-- https://master.php.net/note/delete/94681 Reject -- https://master.php.net/note/reject/94681 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#163021) next »