str_replace removing unwanted characters...
| From: | VanBuskirk, Patricia | Date: | Fri, 29 Feb 2008 19:18:26 +0000 |
| Subject: | str_replace removing unwanted characters... | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-44696@lists.php.net to get a copy of this message | ||
Someone from this list (sorry I cannot remember the name), a while back, gave me the following
function to use to get rid of unwanted characters coming in on forms:
function convert_smart_quotes($string)
{
$search = array(chr(145),
chr(146),
chr(147),
chr(148),
chr(151),
"#",
";",
"[",
"]",
"{",
"<",
">",
"=",
"URL=http://");
$replace = array("'",
"'",
'"',
'"',
"-",
"number",
",",
"",
"",
"",
"",
"",
"",
"equals",
"");
return str_replace($search, $replace, $string); }
This has been working pretty good, however every once in a while something won't go through,
such as the following text recently (between the dashed lines). It sent a confirmation email with no
order number and did not make a record in the database:
------------------------------------------------------------------------------------
Attn Jean Spence
Order to remove 644-8502, add a daytime voice mail tree to Help Desk ACD, Upgrade 644-4357
Supervisor Set. A detailed flowchart will be emailed to Jean Spence and Mark Purvis.
This ENTIRE order MUST be coordinated with Mark Purvis
1. Steps to remove 4-8502
NOTES: 4-8502 will need a LEN. OTC will do this in-house
For 1 month - a recording which states that the number has changed to 644-HELP- that's 644-4357
and then transfer the call to 4-4357
For 1 month - a recording which states that the number has changed to 644-HELP- that's
644-4357- NO transfer.
Cancel 644-8502
2. "New " VM Tree Greeting 1- Need NEW DN for this!!! (Please coordinate with Suzanne for
recordings).
3. Change call queue time
Any questions, please contact me.
Thanks!
Suzanne
------------------------------------------------------------------------------------
When I re-entered the order using the following text (between the starred lines), the order went
through:
***********************
Attn Jean Spence
Order to remove 644-8502, add a daytime voice mail tree to Help Desk ACD, Upgrade 644-4357
Supervisor Set. A detailed flowchart will be emailed to Jean Spence and Mark Purvis.
This ENTIRE order MUST be coordinated with Mark Purvis
see email for details
***********************
Also, we are getting back for example "I\'m hoping..." Somehow the slashes are
coming through in the field and in the emails. I am not even sure what is putting them in, as I
don't see that in the replace function.
Trish
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Patricia Van Buskirk
Florida State University, Office of Telecommunications
644 W. Call Street
Tallahassee, FL 32306-1120
(850) 644-9247
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~