The code below is part of a class to escape strings, but should also accept an array, using array_map() to do the job. Unfortunately, passing an array results in the original, unescaped array being returned - can't figure out why? If you uncomment the echo statement, it is outputting the correct escaped string for each element of the array, so the callback is definitely happening.
public function escape_str($str)
{
if (is_array($str))
{
array_map(array('MYSQL_DB','escape_str'),$str);
}
else
{
if (get_magic_quotes_gpc()) {
$str = stripslashes($str);
}
if (!is_numeric($str)) {
$str = "'" . mysql_real_escape_string($str) . "'";
//echo $str.'<br />';
}
}
return $str;
}
Example:
$xt = array("' OR ''=''",'"abcdefg"');
print_r($db->escape_str($xt));
Outputs original array, not escaped!
Can anyone help with this? Thanks.
Not "Just Another" MMORPG - text based.
Hello,I've been learning MySQL and PHP for the last 2-3 years.Though, I've had long pauses and months without touching PHP.Now, I started at a new school this autumn, and I found that some of my old
PHP Surveys
I really would like some advice.If you have a client come to you asking for a survey to be done with 117 questions each has 4 radio button check boxes, and a overall percentage needs to be tallyed up.
Internal Server Error issues
This has been bothering me for weeks and I've been trying to solve it without asking for help, but eventually I had to give up Basically, I have a website that is based around manipulating photos with
Multiple Options for a Single Page
For this example I want to use the Handlers option which is under Fed Admin and all the related coding to the handlers option is found on the handlers.php page which includes a list of handlers with a
Comparing MySql data and arrays.
I have a mysql table set up like this:idsubjectbodyuseriddatetimetags1blog subjectblog body111|29|20099|30|AMblog,site news,techwhen displaying the data i want to be able to add
Xml parsing
I need a suggestion about parsing xml with multiply parts like pervious... i.e. different devices has a similar configuration, but how I can discern it by device? Code: <config><device
Email Processor
I have a few questions so this post will be a larger one! Sorry, but I'm a bit of a PHP newbie so be gentle with me! Awhile back I wrote out a simple forum to email processor that I used with a few
The repetition structure: the while statement not working
New programming student, have assignment as follows:
Vertical Alligning - Not working in 1 cell?
<?phpecho "<table id=\"valign\" width=\"60%\" style=\"border:1px solid #EEE;\">";echo "<tr><td
PHP Login
Hey!I got this shopcart code online, am trying to modify it but am getting an error when i try and login as an administrator.Am new to php ......so let me know if you can help Source code for