kirka Posted August 23, 2006 Share Posted August 23, 2006 When I run this code below, it dies when the character r or n is encountered. I only want it to die when there is a backslash and r or backslash and n together. I have tried two backlsashes and that does not work either.Does anybody know how I can fix this?Thanks,Kirkafunction checkinjection($checkstring) {if (eregi("\r",$checkstring) || eregi("\n",$checkstring)){ die("Problem Sending Email - MI"); }} Quote Link to comment Share on other sites More sharing options...
craygo Posted August 23, 2006 Share Posted August 23, 2006 I believe || is equal to or so the script is running correctly. Try replacing || with && instead.Ray Quote Link to comment Share on other sites More sharing options...
kirka Posted August 23, 2006 Author Share Posted August 23, 2006 @RayI did try this, but it did not work. The || is the logical Or operator.I think my problem is with the backslash being stripped off in the search.Thanks,Kirka Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted August 23, 2006 Share Posted August 23, 2006 Enclose your string in single quotes, not double quotes.Ken Quote Link to comment Share on other sites More sharing options...
kirka Posted August 23, 2006 Author Share Posted August 23, 2006 @KenI tried single quotes. The function still dies on a single character r or n.Thanks,Kirka Quote Link to comment Share on other sites More sharing options...
kirka Posted August 24, 2006 Author Share Posted August 24, 2006 I found a solution to my problem. It is using four backslashes before the r and n.Thanks.Kirka Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.