473,396 Members | 1,875 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problem with " being replaced with \"

I am having a problem with a script that is having content posted to it (articles)
Any where in the content where there is a " or a ' this gets replaced with \' or \"

This renders all urls completly useless.

a sample is below

There\'s a common misconception that adware just displays advertisements, and so -- although a nuisance -- is harmless. Unfortunately, the opposite is true and \'harmless\' adware is far outweighed by what I term \'surreptitious\' adware --

and

<a href=\"http://www.avlplasticsurgery.com/\">

anyone know what could be causing this and a cure?
Jul 17 '06 #1
4 1330
iam_clint
1,208 Expert 1GB
the script is adding \ to replace ' and " to stop sql injections which can be a real problem. so what you need to is replace the string with "" where \ is
basicly when your inserting data into a database from a variable you want todo this because say your string looks like this
variable = ' or 1 = 1
strsql = "select * from users where user_name='variable'"
it now becomes "select * from users where user_name = '' or 1=1"
which can cause some problems... so basicly your problem is its trying to encode the post to make it harder for a sql injection.
Jul 17 '06 #2
iam_clint
1,208 Expert 1GB
BTW i believe its called character escaping if i am not mistaking
Jul 18 '06 #3
Banfa
9,065 Expert Mod 8TB
BTW i believe its called character escaping if i am not mistaking
Completely correct and it is present in a lot of languages and communications protocols, special characters (normally the delimiters for a string or message) have to be escaped to appear in the middle of a string (or message), then of course in order to get the escape character itself that also has to be escaped.
Jul 19 '06 #4
ronverdonk
4,258 Expert 4TB
But I really don't see the problem. It is a standard precaution to add slashes and when you want to get rid of them with, e.g. posted data, you just do
[PHP]$var = stripslashes($_POST['name']) [/PHP]

Ronald :cool:
Jul 21 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Vio | last post by:
Hi, I've been trying to embed (statically) wxPy alongside an embedded py interpreter on a linux/gtk box. At one point, for some reason misc.o linking reported "multiple definitions of...
1
by: Christian Schmidbauer | last post by:
Hello! I prepare my XML document like this way: ------------------------------------------------------- PrintWriter writer; Document domDocument; Element domElement; // Root tag
5
by: Mikko Rantalainen | last post by:
See example at <URL:http://www.cc.jyu.fi/~mira/moz/formtest.php>. The problem is that the label of submit button is always centered on the button regardsless of 'text-align' property in CSS....
15
by: Sander Tekelenburg | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The HTML specs speak of "replaced" and "non-replaced" elements, yet for the life of me I can't find an explanation of what "replaced" is supposed...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
11
by: Lothar Behrens | last post by:
Hi, I have selected strtok to be used in my string replacement function. But I lost the last token, if there is one. This string would be replaced select "name", "vorname", "userid",...
6
by: Jeff | last post by:
I'm writing innerHTML for a text field. Sometime the textfield has double quotes in them. value_=value_.replace(/"/g,'\\"'); var content = '<input type="text" name="'+name_+'"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.