RE: [PHP] Still need help with ereg

From: Date: Fri, 18 Apr 2003 05:31:45 +0000
Subject: RE: [PHP] Still need help with ereg
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-144380@lists.php.net to get a copy of this message
when people want to display data that's been quoted they use stripslashes as you mentioned... as far as the \ question: you could just strip the \ out of the text once the regex is done...otherwise, are you sure you need to \' the ' in the regex? perhaps that's why you're getting \ as well...haven't tested this, so not sure... jack > -----Original Message----- > From: C.R. [mailto:odcs@rogers.com] > Sent: Friday, April 18, 2003 12:42 AM > To: Jack Dempsey; PHP General > Subject: Re: [PHP] Still need help with ereg > > > OK, so just to be clear - this is more for dealing with MySql. If a user > entered Joe"Blow and I had a query that said "insert into data $name", it > may think the first quote is the end of the statement and miss Blow - or > just screw the whole insert. When you want to redisplay the data - using > stripslashes should get rid of this problem? One other note on > this. In my > ereg statement I have something like ereg(^[A-Z\']*$); this would allow > uppercase letters and apostrophe's which is what I want - but it > also allows > the \ which I don't want. So how can I get it to allow the ' and > not the \. > > Thanks > > ----- Original Message ----- > From: "Jack Dempsey" <dempsejn@georgetown.edu> > To: "C.R." <odcs@rogers.com>; "PHP General" > <php-general@lists.php.net> > Sent: Thursday, April 17, 2003 10:44 PM > Subject: RE: [PHP] Still need help with ereg > > > > magic quotes lets php escape your quotes for you. > > > > take the usual circumstance of a user submitting data to a php > script, and > > that script entering it into a database. > > if the user has quotes in the data, it could create an error in the SQL > > command...so, magic quotes automatically escapes these > > quotes or apostrophes for you on submitting the data to a page... > > > > so, you submit a form with this text: > > > > > > it's not over till it's over > > > > > > if you have magic_quotes on, without doing anything, php will escape the > > quotes, so your data will be: > > > > it\'s not over till it\'s over > > > > this is nice when you're usually going to be taking data and throwing it > > into a database, but if you're not expecting it, it could > > catch you unaware... > > > > hope this helps, > > jack > > > > > > > > > -----Original Message----- > > > From: C.R. [mailto:odcs@rogers.com] > > > Sent: Thursday, April 17, 2003 7:06 PM > > > To: PHP Windows; PHP General > > > Subject: [PHP] Still need help with ereg > > > > > > > > > I am trying to create a validation script using ereg and I'm > having some > > > problems. I think part of this is due to not quite understanding what > the > > > purpose of magic quotes is - actually this whole idea things > > > being escaped > > > with slashes confuses me. Could someone explain in plain english what > all > > > this means. Also, what is the satandard - should get_magic_quotes > > > be set on > > > or off in the php.ini and what are the advantages or disadvantages. > > > > > > Thanks > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#144380) next »