We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11927
    • 105 Posts
    When I try to modify and save some of the snippets that I have, instead of saving it, it shows the page that I have setup as the "Unauthorized page" where the snippet should show up after saving. Like it is an iFrame.

    I am logged in as the administrator, so I should be able to modify everything.

    It lets me save other snippets, but it seems to not let me modify certain other snippets.

    Is the snippet too long?

    Does that mean my site has been hacked?
      You may or may not want to use the code I write. It's probably all against the syntax rules of php and MODx. smiley

      Carpet Cleaning
      • 20413
      • 2,877 Posts
      - Check that your chosen lang file match the collation of your database
      e.g. you are using the utf8 one if you use utf8 for db charset and collation.
      - Does this happens only in firefox? http://www.belafontecode.com/fix-modx-csrf-error-in-firefox/
      - Try disable plugins you use one by one.
      - Clear browser cookies and cache and the cache in MODx.

      And see http://modxcms.com/forums/index.php/topic,11800.msg79283.html#msg79283
        @hawproductions | http://mrhaw.com/

        Infograph: MODX Advanced Install in 7 steps:
        http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

        Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
        http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
        • 11927
        • 105 Posts
        Does Unicode (UTF-8) - utf-8 == utf8_general_ci?

        Modx is set to - Unicode (UTF-8) - utf-8
        MySQL charset: UTF-8 Unicode (utf8)
        phpMyAdmin DB Collation - utf8_general_ci
        the modx DB Collation - utf8_unicode_ci


        Web Server:
        PHP version and how it’s running (suexec, mod_php, CGI, etc.) - 5.2.13
        Apache or IIS version - Apache - version?
        Operating System and version - Linux CentOS

        Database:
        MySQL version - Localhost via UNIX socket 5.1.30
        MySQL client version: 4.1.22
        List of any tables over 1MB in size - manager_log

        MODx:
        Version - 0.9.6.2
        Any changes you’ve made - I haven’t changed anything except added another database to MySQL called ’blah_test’. I exported another database, not modx, changed the name in the sql file to have the ’_test’ appended to it, and then imported it into phpMyAdmin. Other than that I haven’t made any serious changes. I did change the admin password a couple times though.
        Any snippets you’re running on the page that is not working properly - They’re working, just not letting me save them. Some I CAN save though.
        Any plugins you’re running - I just disabled all of them, same problem.

        Browser/Client:
        Browser name and version - IE 7.0.5730.11
        Operating System and version - Win XP SP2


        It does the same thing in Firefox and Safari.

        I tried clearing the cache and cookies in both IE and modx, but still had the same issue. I cleared everything and shut down IE, didn’t fix it.
          You may or may not want to use the code I write. It's probably all against the syntax rules of php and MODx. smiley

          Carpet Cleaning
          • 11927
          • 105 Posts
          This site has been functioning fine for almost a year, until yesterday, so would creating the new database mess-up some of the snippets? Or would changing the admin password a few times change some of the snippets?
            You may or may not want to use the code I write. It's probably all against the syntax rules of php and MODx. smiley

            Carpet Cleaning
            • 11927
            • 105 Posts
            I also, when looking around for all the information about modx, found this ’System Event’.

            I’m 99% sure I didn’t see this error, but may have.


            « MODx Parse Error »
            MODx encountered the following error while attempting to parse the requested resource:
            « PHP Parse Error »

            PHP error debug
            Error: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known
            Error type/ Nr.: Warning - 2
            File: /blah/public_html/class.smtp.php
            Line: 105
            Line 105 source: $tval); # give up after ? secs

            Parser timing
            MySQL: 0.0033 s (5 Requests)
            PHP: 42.3261 s
            Total: 42.3295 s
              You may or may not want to use the code I write. It's probably all against the syntax rules of php and MODx. smiley

              Carpet Cleaning
              • 11927
              • 105 Posts
              Is it something in the snippet itself?

              I tryed duplicate one of the snippets that won’t let me save it and it wouldn’t let me save the duplicate.
              But I could duplicate a different one that would let me save it.
                You may or may not want to use the code I write. It's probably all against the syntax rules of php and MODx. smiley

                Carpet Cleaning
                • 20413
                • 2,877 Posts
                Quote from: heavensbest at May 07, 2010, 10:05 AM

                Does Unicode (UTF-8) - utf-8 == utf8_general_ci?

                Make sure MODx DB + all tables + all rows + all records are in utf8_unicode_ci
                or better utf8_general_ci. But NOT mixed.
                http://stackoverflow.com/questions/2344118/utf-8-general-bin-unicode

                You are using a super old MODx version. If you upgrade your MODx, you’ll get thousands of bugfixes and security improvments. Not only in the MODx core but also for addons.

                But what I would do is backup the existing site and install it on a local server as xampp. Try finding a version before PHP 5.3.0. If the site works nice, it’s probably your host changed something.
                  @hawproductions | http://mrhaw.com/

                  Infograph: MODX Advanced Install in 7 steps:
                  http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

                  Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
                  http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
                  • 22303 MODX Staff
                  • 10,725 Posts
                    • 11927
                    • 105 Posts
                    So, that was fun. I guess my host or something changed something because what used to be save-able (sp?) in modx, is now not.

                    This is why certain snippets wouldn’t save:

                    <?php
                    $query = "SELECT * 
                    	FROM `table`  
                    	WHERE `id` = '1200' 
                    	AND `id_2` = (SELECT `id_2` FROM `table_2` WHERE `id_a` = 'fun'   LIMIT 1) 
                    	AND `id_3` = (SELECT `id_3` FROM `table_2` WHERE `id_b` = 'stuff' LIMIT 1)";
                    ?>
                    



                    Yep, that was it. A nested query. So in order to make it work I had to do this.


                    <?php
                    
                    $hold_sql_1 = "SELECT `id_2` FROM `table_2` WHERE `id_a` = 'fun'   LIMIT 1";
                    $hold_sql_2 = "SELECT `id_3` FROM `table_2` WHERE `id_b` = 'stuff' LIMIT 1";
                    
                    $query = "SELECT * 
                    	FROM `table`  
                    	WHERE `id` = '1200' 
                    	AND `id_2` = ($hold_sql_1) 
                    	AND `id_3` = ($hold_sql_2)";
                    ?>
                    



                    So is there a proper way to do a nested query like this that won’t cause me to go crazy?

                    I really appreciate your help. I may yet try the modifications to the .htaccess file. I just don’t want to creat a security risk.

                    Won’t updating to a newer version of modx messup how modules and other things work? I really would like to, but have a hard time fixing a working site. But then again, if I can prevent it from being hacked, then it would be worth it.
                      You may or may not want to use the code I write. It&#39;s probably all against the syntax rules of php and MODx. smiley

                      Carpet Cleaning
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      Won’t updating to a newer version of modx messup how modules and other things work?
                      When updating MODx across several versions, I avoid uploading the new snippets and when running the installer I clear the checkboxes for them. I’ve never had a problem with updating modules and plugins, so I go ahead and upload and install those, as long as none of them were customized (which I avoid doing; make a copy with a different name and customize that instead). Then later I go through the snippets one at a time to see if there is really any benefit to upgrading them. Usually I just leave them (although I do make sure that there are no "snippet.template.php" type files that are used for copy/pasting into the Manager’s snippet content, either deleting them or renaming them so they aren’t executable any more).
                        Studying MODX in the desert - http://sottwell.com
                        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                        Join the Slack Community - http://modx.org