views:

52

answers:

1

I have my input placed into mySQL through a PDO prepared statement, and have it placed in my website with PHP using htmlspecialchars() to protect against XSS. Only problem is now I get slashes, before any quotes, that are visible on the webpage to the user it only happens when I upload it to the server. Never happens on my localhost.

Why is this happening?

A: 

The server has magic quotes enabled?

Try this line in PHP to find out:

if(get_magic_quotes_gpc())
    echo "Magic quotes are enabled";
else
    echo "Magic quotes are disabled";

If they are enabled, you can use stripslashes to remove them.

Dan McGrath
Checked, Magic quotes are disabled
Cortopasta
Are you sure it is htmlspecialchars? Have you checked the output prior (or without) that function call? It could be being caused by some SQL escaping
Dan McGrath
Don't use any SQL escaping. Everything is put in the database through PDO so I don't have to
Cortopasta
Crap, you're right. Checked my db and it's in there with the slashes. How the heck did that happen :-/
Cortopasta