Just to be more clear on what i meant:

check out: http://uk.php.net/manual/en/function...quotes-gpc.php

at the bottom there are things which may help you, by checking get_magic_quotes_gpc() and then depending on what that returns run your code.