Values being automatically escaped

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Echilon
Forum Newbie
Posts: 12
Joined: Fri Nov 25, 2005 4:11 am
Location: England
Contact:

Values being automatically escaped

Post by Echilon »

I have a local srver set up for testing, and I'm experiencing a strange problem. When I type inputs into a form, PHP is reading them and escaping some values. I need to take what the user enters and sanitize it using my own methods, but something happening before I can get hold of it. I also have an account on Dreamhost, and when I try the script there it works fine. I've grabbed Dreamhost's php.ini and compared it to mine, and everything looks to be the same.

When I enter "'@\/#, then echo it using $_POST['input1'], I get \"\'@\\/#:. I thought it might have something to do with magic quotes at first, but this happens whether they're on or off. Does anyone have any idea what could cause this? I'm running Apache with PHP 5.2.5.

Thanks
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Have you looked into the get_magic_quotes_gpc() and get_magic_quotes_runtime() functions?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
Echilon
Forum Newbie
Posts: 12
Joined: Fri Nov 25, 2005 4:11 am
Location: England
Contact:

Post by Echilon »

Thanks. It turns out XAMPP has two php.inis, I turned magic quotes off in both and it appears to be working.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

When in doubt use phpinfo() to quickly check the location of your php.ini ;)
Post Reply