Re: Issues with backslashes and GET data

From: Date: Wed, 12 Oct 2005 14:18:04 +0000
Subject: Re: Issues with backslashes and GET data
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-223961@lists.php.net to get a copy of this message
Martin Selway wrote:
A servername may contain a backslash e.g. Server1\SQL1. When this data is returned from the URL e.g. $server = $_GET['server']; The name is returned as Server1\\SQL1, so the search fails.
Sounds like magic_quotes_gpc is enabled. Disable it.
I've tried using a regular expression to remove one of the backslashes: $server = ereg_replace("\\", "\", $server);
There is a function called stripslashes() that does this. Also, you should not use a regular expression function when matching literal strings. Regular expressions are for matching patterns. Use something like str_replace(). Hope that helps. Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/

« previous php.general (#223961) next »