str_replace()? preg_replace()?
Do I replace in each files with a new line of code or do I place an overriding version of the function (if possible) in some 'functions' php file?
Anyone with any suggestions?
str_replace()? preg_replace()?
Do I replace in each files with a new line of code or do I place an overriding version of the function (if possible) in some 'functions' php file?
Anyone with any suggestions?
Seriously, a host who disables the stripslashes function doesn't know what they're doing. They probably think they're fixing a security problem, but in the end they're creating thousands. And that's probably why they're getting hacked.
Find a host who knows what they're doing.
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
Meanwhile, while you work on finding a new host, the following ideas may lead you to a temporary bandage.
These were found as user-contributed examples on php.net, and I have NOT tested them. Use at your own risk ...
Idea A: Use a preg_replace_array call:
To use, replace stripslashes($s) with the following. Be sure to alter the $s to match whatever variable was originally being sent to stripslashes.
Idea B: Create stripslashes2() like this and simply search/replace all previous calls to stripslashes with stripslashes2Code:preg_replace(array('/\x5C(?!\x5C)/u', '/\x5C\x5C/u'), array('','\\'), $s);
AGAIN: NEITHER OF THESE HAVE BEEN VETTED FOR SECURITY OR THOROUGHNESS. USE AT YOUR OWN RISK.Code:function stripslashes2($string) { $string = str_replace("\\\"", "\"", $string); $string = str_replace("\\'", "'", $string); $string = str_replace("\\\\", "\\", $string); return $string; }
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.