Jump to content

[SOLVED] Post data automatically escaped?


Jesper

Recommended Posts

Hi everyone,

 

For a couple of days now I've been trying to work out a way to insert data in a MySQL database while preventing from SQL-injection. Something that's really strange tho, is this:

$data=$_POST["val"];

echo $data;

When I enter a single quote (') in the input field, it for some reason echo's \', instead of just '. That's really weird, it seems like the post data is automatically escaped.

 

Does anyone know why this is, and how to fix it?

 

 

Thanks,

 

Jesper

Link to comment
https://forums.phpfreaks.com/topic/155733-solved-post-data-automatically-escaped/
Share on other sites

That's it! Thanks a lot mate!

 

I'm now using get_magic_quotes_gpc() and stripslashes, however, as the function will be removed from PHP 6.0.0, would there be another way around this, as this is a script for clients and I don't want them to have it not work once PHP6 comes.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.