Jump to content

Slashes not being Added


abrahamgarcia27

Recommended Posts

the slashes \ should not be in the actual data in the database. they should only be in the sql query statement to indicate those characters that have special meaning that are part of the data and that are not to be interpreted as part of the query syntax.

 

how exactly are you looking at the data when you see the \ characters, because this is either a problem with php escaping your input data in addition to you escaping it or php escaping the data when you  retrieve it from the database.

 

note: this php behavior has been removed as of php5.4.

Link to comment
Share on other sites

Is this bad?

yes. because php has now changed what it does to external data, any data that is (incorrectly) stored with the \'s in it cannot be searched for and found and by unconditionally running stripslashes() on any data, it will remove an real \'s in the data (which i see from looking at your previous threads - http://forums.phpfreaks.com/topic/255193-problem-searching/ you are doing.)

 

prior to php5.4, what you should have been doing is test if php's magic_quotes_gpc is ON and if it was use stripslashes to remove the escaping php was doing, then escaping the data yourself (note: this logic will still work in php5.4 and later as the function that tests if magic_quotes_gpc is on will return a false value.)

 

the best recommendation would be to remove any extra \ characters that are stored in your database tables.

Edited by mac_gyver
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.