Forum Moderators: coopster
What I'm trying to do is escape any characters that will cause errors in the linux shell, because the program makes use of the shell_exec function.
I've figured on the following characters being exited:
. + *? [ ^ ] ( $ ) ' " \ NUL & Using more than one function will cause conflicts (i.e. addslashes() mixed with quotemeta() causes problems). To solve this, I've decided to use addcslashes and specify each of the above characters. Because I have characters in the list that will mess up even the function, I don't know how to tell the function that I want them exited other than with their ASCII codes, but I'm not sure how to enter ASCII codes. I have the codes for the desired characters, just don't know how to put the function.
Would it be like this?
addcslashes("$var", "\0\34\36\38\39\etc...");
addcslashes($var, "\000\042\044\046\047");the leading zero(s) could be dropped and you'll get the same result
[asciitable.com...]
Note:
The manual states to use the ord() function to get the ASCII value for a character, however when I tested this on a WAMP setup, addcslashes did not work until I used the octal value...anyone else have insight here...?