Magic quotes are a bug, therefore I recommend
if (ini_get('magic_quotes_gpc')) {
throw new Exception("Magic quotes are a bug and should never be enabled");
}
At the top of every page (or rather, in a common include file, say where you connect to the db)
Mark