Solved

Keep getting backslashes added through GET

Posted on 2007-03-20
3
276 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
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

This article discusses four methods for overlaying images in a container on a web page
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will learn how to dynamically set the form action using jQuery.

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now