RE: [PHP] Stripping single quotes
Darn, it still 'aint working. Ok, let's say $fldemail contains o\'[EMAIL PROTECTED] I then run these: $fldemail == stripslashes($fldemail); $fldemail == ereg_replace(',,$fldemail); And I get o\'[EMAIL PROTECTED] ... damn. Any ideas? Thanks, Matt Stone -Original Message- From: Chris Fry [mailto:[EMAIL PROTECTED]] Sent: Saturday, 28 July 2001 2:15 PM To: Matt Stone Cc: PHP list Subject: Re: [PHP] Stripping single quotes Matt, Try ereg_replace:- $fldemail == ereg_replace(',,$fldemail); Chris Matt Stone wrote: Hi all, I am trying to validate some email addresses before they are entered into the database. The problem is, some thick or malicious people are entering single quotes into their email addresses. I need to strip out all these single quotes but a little ole' str_replace doesn't seem to be working. Here it is: $fldemail == str_replace(',,$fldemail); Nice and basic :) Can anyone please enlighten me on this? Thanks in advance, Matt Stone -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Chris Fry Quillsoft Pty Ltd Specialists in Secure Internet Services and E-Commerce Solutions 10 Gray Street Kogarah NSW 2217 Australia Phone: +61 2 9553 1691 Fax: +61 2 9553 1692 Mobile: 0419 414 323 eMail: [EMAIL PROTECTED] http://www.quillsoft.com.au You can download our Public CA Certificate from:- https://ca.secureanywhere.com/htdocs/cacert.crt ** This information contains confidential information intended only for the use of the authorised recipient. If you are not an authorised recipient of this e-mail, please contact Quillsoft Pty Ltd by return e-mail. In this case, you should not read, print, re-transmit, store or act in reliance on this e-mail or any attachments, and should destroy all copies of them. This e-mail and any attachments may also contain copyright material belonging to Quillsoft Pty Ltd. The views expressed in this e-mail or attachments are the views of the author and not the views of Quillsoft Pty Ltd. You should only deal with the material contained in this e-mail if you are authorised to do so. This notice should not be removed. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Stripping single quotes
I'd have a look at those double equals signs ... I think they should be single: $fldemail = stripslashes($fldemail); $fldemail = ereg_replace(',,$fldemail); Mick On Sat, 28 Jul 2001, Matt Stone wrote: Darn, it still 'aint working. Ok, let's say $fldemail contains o\'[EMAIL PROTECTED] I then run these: $fldemail == stripslashes($fldemail); $fldemail == ereg_replace(',,$fldemail); And I get o\'[EMAIL PROTECTED] ... damn. Any ideas? Thanks, Matt Stone -Original Message- From: Chris Fry [mailto:[EMAIL PROTECTED]] Sent: Saturday, 28 July 2001 2:15 PM To: Matt Stone Cc: PHP list Subject: Re: [PHP] Stripping single quotes Matt, Try ereg_replace:- $fldemail == ereg_replace(',,$fldemail); Chris Matt Stone wrote: Hi all, I am trying to validate some email addresses before they are entered into the database. The problem is, some thick or malicious people are entering single quotes into their email addresses. I need to strip out all these single quotes but a little ole' str_replace doesn't seem to be working. Here it is: $fldemail == str_replace(',,$fldemail); Nice and basic :) Can anyone please enlighten me on this? Thanks in advance, Matt Stone -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Chris Fry Quillsoft Pty Ltd Specialists in Secure Internet Services and E-Commerce Solutions 10 Gray Street Kogarah NSW 2217 Australia Phone: +61 2 9553 1691 Fax: +61 2 9553 1692 Mobile: 0419 414 323 eMail: [EMAIL PROTECTED] http://www.quillsoft.com.au You can download our Public CA Certificate from:- https://ca.secureanywhere.com/htdocs/cacert.crt ** This information contains confidential information intended only for the use of the authorised recipient. If you are not an authorised recipient of this e-mail, please contact Quillsoft Pty Ltd by return e-mail. In this case, you should not read, print, re-transmit, store or act in reliance on this e-mail or any attachments, and should destroy all copies of them. This e-mail and any attachments may also contain copyright material belonging to Quillsoft Pty Ltd. The views expressed in this e-mail or attachments are the views of the author and not the views of Quillsoft Pty Ltd. You should only deal with the material contained in this e-mail if you are authorised to do so. This notice should not be removed. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Michael Hall mulga.com.au [EMAIL PROTECTED] ph/fax (+61 8) 8953 1442 ABN 94 885 174 814 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Stripping single quotes
Thanks for your help everyone, I feel pretty embarrassed to have made a mistake like that! :o -Original Message- From: Bojan Gajic [mailto:[EMAIL PROTECTED]] Sent: Sunday, 29 July 2001 12:44 AM To: Matt Stone Subject: Re: [PHP] Stripping single quotes you are not assigning stripslashes($fldemail) to the $fldemail, you are maching them. use '=' instead of '= =' hth, bojan Matt Stone wrote: Darn, it still 'aint working. Ok, let's say $fldemail contains o\'[EMAIL PROTECTED] I then run these: $fldemail == stripslashes($fldemail); $fldemail == ereg_replace(',,$fldemail); And I get o\'[EMAIL PROTECTED] ... damn. Any ideas? Thanks, Matt Stone -Original Message- From: Chris Fry [mailto:[EMAIL PROTECTED]] Sent: Saturday, 28 July 2001 2:15 PM To: Matt Stone Cc: PHP list Subject: Re: [PHP] Stripping single quotes Matt, Try ereg_replace:- $fldemail == ereg_replace(',,$fldemail); Chris Matt Stone wrote: Hi all, I am trying to validate some email addresses before they are entered into the database. The problem is, some thick or malicious people are entering single quotes into their email addresses. I need to strip out all these single quotes but a little ole' str_replace doesn't seem to be working. Here it is: $fldemail == str_replace(',,$fldemail); Nice and basic :) Can anyone please enlighten me on this? Thanks in advance, Matt Stone -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Chris Fry Quillsoft Pty Ltd Specialists in Secure Internet Services and E-Commerce Solutions 10 Gray Street Kogarah NSW 2217 Australia Phone: +61 2 9553 1691 Fax: +61 2 9553 1692 Mobile: 0419 414 323 eMail: [EMAIL PROTECTED] http://www.quillsoft.com.au You can download our Public CA Certificate from:- https://ca.secureanywhere.com/htdocs/cacert.crt ** This information contains confidential information intended only for the use of the authorised recipient. If you are not an authorised recipient of this e-mail, please contact Quillsoft Pty Ltd by return e-mail. In this case, you should not read, print, re-transmit, store or act in reliance on this e-mail or any attachments, and should destroy all copies of them. This e-mail and any attachments may also contain copyright material belonging to Quillsoft Pty Ltd. The views expressed in this e-mail or attachments are the views of the author and not the views of Quillsoft Pty Ltd. You should only deal with the material contained in this e-mail if you are authorised to do so. This notice should not be removed. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Stripping Single Quotes
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Elan) wrote: I have a string, "'abc'". How do I convert it to "abc" (i.e. how do I strip the embedded single quotes) with a minimum of overhead? If there's no chance that the string could also contain legit single-quotes (such as as an apoostrophe), you can simply use str_replace(). Otherwise, either str_replace() with strpos() -- to search/replace only on 2nd char and 2nd-to-last character -- or good ol' preg_replace() by itself. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Stripping Single Quotes
use the following code $vals=explode("'", "'abc'"); $your_value=$vals[0]; //I am little confused, if it is not working try index1 Elan wrote: Hi, I have a string, "'abc'". How do I convert it to "abc" (i.e. how do I strip the embedded single quotes) with a minimum of overhead? (In case you'r wondering: I created the quoted string to store it in MySQL, now I want to display the same string in a Webpage. Usually the strings I display do not have embedded single quotes, and I add the single quotes when I output the string printf("input type='text' value='%s'", $value); That works well enough for strings that don't already have embedded quotes. But when they do I want to get rid of them quickly and easily, otherwise I get ...value = ''some value'' and Netscape doesn't display the value embedded in two single quote characters). TIA, Elan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]