Re: Kill Magic Quotes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dave M G wrote:
PHP List,
I found this solution after a web search. I can't attribute the author, but would like to if I could.

I have a routine like this:

if (isset($_POST['choice'])) {
if (get_magic_quotes_gpc() ){
  stripslashes_arrays( $_POST );
}
$choice = $_POST['choice'];
}
else {
$choice = 'unknown';
}

and this is the function

# strips slashes to a multi dimensional array, by reference
function stripslashes_arrays(&$array) {
if ( is_array($array) ) {
  $keys = array_keys($array);
  foreach ( $keys as $key ) {
    if ( is_array($array[$key]) ) {
      stripslashes_arrays($array[$key]);
    }
    else {
      $array[$key] = stripslashes($array[$key]);
    }
  }
}
}



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux