Hi,
For some reason, only a couple of my scripts are having a weird problem where they automatically add slashes to any post variable (but not get variables). The funny thing is, magic_quotes_gpc and magic_quotes_runtime are off in my php.ini and phpinfo.php indicates off for both. Why does it only affect post variables but not get variables? Why is it only affecting my php classes, but not my test scripts?
Any ideas would be appreciated.
Thanks
Slashes appear in POST vars even with magic_quotes_gpc = off
Moderator: General Moderators
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: Slashes appear in POST vars even with magic_quotes_gpc = off
Do the variables containt special characters such as apostophes?
Take a look at stripslashes()
Take a look at stripslashes()
Re: Slashes appear in POST vars even with magic_quotes_gpc = off
Yes they have apostrophes and I wanted to use stripslashes. The weird part is that my scripts just started having slashes in post vars out of the blue.
So the last thing I want to do is modify hundreds of lines and then have to revert. Would you know why the scripts would just start adding slashes to just post vars? I do interact with a database, and I use mysql_real_escape_string but even before I use it, there's slashes just on the post vars.
So the last thing I want to do is modify hundreds of lines and then have to revert. Would you know why the scripts would just start adding slashes to just post vars? I do interact with a database, and I use mysql_real_escape_string but even before I use it, there's slashes just on the post vars.
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: Slashes appear in POST vars even with magic_quotes_gpc = off
Do the slashes keep on adding (mutiply) each time you post from your form?
Re: Slashes appear in POST vars even with magic_quotes_gpc = off
in your script run
If the result is 1 you definitely have magic_quotes turned on somehow
Is this happening on a local machine or a remote server? and it it's on a remote, is it a shared account?
Code: Select all
var_dump( get_magic_quotes_gpc() );
Is this happening on a local machine or a remote server? and it it's on a remote, is it a shared account?
Re: Slashes appear in POST vars even with magic_quotes_gpc = off
The get_magic_quotes function returns 0. Yes, it adds more slashes everytime you submit the form. It only happens in some scripts. Suppose I add a form to one of my scripts and just dump the post variables (print $_POST['test']
, they'll have slashes in them. But if I create a new file in the same directory with the same form, I don't have this problem. LOL. I never enabled magic quotes in any script I write, so it's weird!