Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2005
    Posts
    120
    Plugin Contributions
    0

    Default Host disabled stripslashes() What is a good way to replace/fix?

    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?

  2. #2
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Host disabled stripslashes() What is a good way to replace/fix?

    Quote Originally Posted by deadeye View Post
    Anyone with any suggestions?
    Change hosts.

    Cheers
    RodG

  3. #3
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Host disabled stripslashes() What is a good way to replace/fix?

    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.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Host disabled stripslashes() What is a good way to replace/fix?

    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.
    Code:
    preg_replace(array('/\x5C(?!\x5C)/u', '/\x5C\x5C/u'), array('','\\'), $s);
    Idea B: Create stripslashes2() like this and simply search/replace all previous calls to stripslashes with stripslashes2
    Code:
    function stripslashes2($string) {
        $string = str_replace("\\\"", "\"", $string);
        $string = str_replace("\\'", "'", $string);
        $string = str_replace("\\\\", "\\", $string);
        return $string;
    }
    AGAIN: NEITHER OF THESE HAVE BEEN VETTED FOR SECURITY OR THOROUGHNESS. USE AT YOUR OWN RISK.
    .

    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.

 

 

Similar Threads

  1. Replies: 7
    Last Post: 10 Jan 2015, 03:39 PM
  2. Replies: 5
    Last Post: 14 Apr 2010, 04:57 PM
  3. What is a good and easy way to make my site secure?
    By sfklaas in forum General Questions
    Replies: 17
    Last Post: 21 Apr 2008, 05:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg