note 83450 added to function.mysql-real-escape-string

From: Date: Tue, 27 May 2008 05:26:15 +0000
Subject: note 83450 added to function.mysql-real-escape-string
Groups: php.notes 
Request: Send a blank email to php-notes+get-139833@lists.php.net to get a copy of this message
really a handy function for sql injection. extra checking for magic quotes enabled or not. if it is not enabled then add slashes.. also for real escape it will strip slash the value and do real escaping... /* real escaping or addslashes after checking magic quotes enable or not... for security measure of sql injection or sql hijeking.. created by : Md. Shahadat Hossain Khan Razon (razonklnbd@hotmail.com) created date : 20080527 last modified date : 20080527 */ function sqlSafeString($p_val, $p_real_escaping_enabled = true) { if(true == $p_real_escaping_enabled) $f_val = mysql_real_escape_string((get_magic_quotes_gpc() == yes ? stripslashes($p_val) : $p_val)); else $f_val=(get_magic_quotes_gpc() == yes ? $p_val : addslashes($p_val)); return $f_val; } ---- Server IP: 69.147.83.197 Probable Submitter: 202.59.136.14 ---- Manual Page -- http://www.php.net/manual/en/function.mysql-real-escape-string.php Edit -- https://master.php.net/note/edit/83450 Del: integrated -- https://master.php.net/note/delete/83450/integrated Del: useless -- https://master.php.net/note/delete/83450/useless Del: bad code -- https://master.php.net/note/delete/83450/bad+code Del: spam -- https://master.php.net/note/delete/83450/spam Del: non-english -- https://master.php.net/note/delete/83450/non-english Del: in docs -- https://master.php.net/note/delete/83450/in+docs Del: other reasons-- https://master.php.net/note/delete/83450 Reject -- https://master.php.net/note/reject/83450 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#139833) next »