You can use a function to help you deal with magic quotes. As you may have read from the manual, if magic quotes are on, it returns a bool value of 1. So, you can use that to determine what course of action to take:
<?php
// create function
function myAddSlashes($string) {
// if magic quotes are on leave string alone
if (get_magic_quotes_gpc()) == 1 {
return ($string);
}
// else off, add slashes to string
else {
return addslashes($string);
}
}
// use loop to go through POST values
foreach($_POST as $var => $val) {
// call the myAddSlashes function
$$var = myAddSlashes($val);
}
?>
This example is for string preparation for database entry, but for your purposes, you could easily re-write it so that if magic quotes are ON, you would strip slashes, and if they were OFF, you would leave the string alone...
PS! I didn't write the myAddSlashes function but I found it here on the forums me-thinks! (give credit where credit is due...)
Hope this helps.