Solved

Keep getting backslashes added through GET

Posted on 2007-03-20
3
303 Views
Last Modified: 2013-11-19
Hi
I am running PHP v 5.2.0 and now when I pass something through GET that has a quote mark in it I get an escape backslash if I then pass that on again I get another backslash added
ie
.php?id=1&t=entertainment&ttl=The%20Sorcerer's%20Apprentice
there's a quote (apostrophe)  between the word Sorcerer and the s

The next time I pass it on I get
php?id=1&t=entertainment&ttl=The%20Sorcerer\'s%20Apprentice
It has added a backslash but in the page it shows 2 backslashes
How can I get rid of this quirk???
Thanks in advance
0
Comment
Question by:TonyHull
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 24

Accepted Solution

by:
glcummins earned 200 total points
ID: 18757321
Check your php.ini file for lines that look like:

magic_quotes_*

and change them to 'Off'

Magic Quotes automatically tries to escape input to your script, which is usually an annoyance. For more information, see http://us3.php.net/magic_quotes
0
 
LVL 9

Assisted Solution

by:richdiesal
richdiesal earned 150 total points
ID: 18757333
It sounds like you have magic_quotes_gpc set to On in your php.ini.  You could just turn this off.

If you don't want to do that, the stripslashes() function will also get rid of slashes.
0
 
LVL 48

Assisted Solution

by:hernst42
hernst42 earned 150 total points
ID: 18757342
Check your php.ini-settings for magic_quotes_gpc. If that option is turned on (typical to prevent SQL-injections). Every time you access $_GET/$_POST you will need to use stripslashes($_POST['varname']);
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to count occurrences of each item in an array.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question