We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19889
    • 616 Posts
    Hello
    Hope some PHP guru can help me on this one - I’ve some AJAX scripts based on Mootools that pass some variables to PHP - in PHP I read those variables by using e.g. $_REQUEST[’varname’] or $_GET[’varname’] - no, all the sudden, my PHP functions don’t work anymore - my hosting company is telling me that they have installed some SUHOSIN patch because their Joomla sites got hacked all the time.

    I’m completely lost - how do I get my scripts to work again - is there a workaround?

    Thank you in advance for your input.
      • 5340
      • 1,624 Posts
      First of all you should not use $_GET/$_REQUEST to pass variables from a form to php script. You should only use $_POST if you are "posting" information.

      You also have to understand where your code breaks and then fix the problem

      For example it seems that the patch will not allow you to do

      include($_GET['content'] . '.php');


      If this is your case use another solution like file_get_contents();

      PS: Shouldn’t there be a log file that says what the problem is? Look for a file called suhosin.log or something similar. Work with your host on this.
        • 19889
        • 616 Posts
        I don’t know what my hosting company has changed, but I can not even the following to work anymore:
        <?php
        
        $shoutcast_url = 'http://rs3.radiostreamer.com:9330/played.html';
        
        ini_set('user_agent', 'Mozilla');
        header('Content-type: text/plain; charset=utf-8');
        
        $html = file_get_contents($shoutcast_url);
        echo $html;
        
        ?>

          • 5340
          • 1,624 Posts
          Do you receive an error?

          Add these 2 lines to your script and post the error

          error_reporting(E_ALL);
          ini_set('display_errors', '1');

            • 19889
            • 616 Posts
            no errors, nothing - added the two lines - no difference?
              • 24935
              • 160 Posts
              Suhosin limits $_POST and $_GET to 200 items. That can cause a problem if you are posting a large form or a lot of data. Read up on Suhosin and become familiar with what it does, so you can find the source of the problem.

              As for file_get contents, the PHP manual says, "A URL can be used as a filename with this function if the fopen wrappers have been enabled."
                • 19889
                • 616 Posts
                really frustrating experience so far - maybe I should change my host - by the way, here is a phpinfo http://countryradio.ch/info.php - maybe one of you sees what the issue is?
                  • 33410
                  • 14 Posts
                  Hello,

                  Best is upload a php.ini files with suhosin disabled for your site and upload in your public_html folder that will solve the issue.

                  You can even ask your hosting company to do so, as far as I am concerned I am luck my company helps me with such issue. smiley