Solved

Keep getting backslashes added through GET

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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…

920 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

14 Experts available now in Live!

Get 1:1 Help Now