We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4966
    • 143 Posts
    I have this website where I am using Simpleviewer for the frontend and MaxiGallery for the back. I have a problem when I login as admin and select paintings I do not get the page with MaxiGallery but instead get the home page. When I’m no logged in I get the correct page. I have the following snippet on the page that sends me to one page or the other.

    <?php
    if (!isset ($_SESSION[’mgrValidated’])) {
    $allowed = false;
    print ("not in admin mode ");
    header("Location: http:/localhost/judy/index.php?id=67");
    } else {
    print("in admin mode ");
    header("Location: http://localhost/judy/index.php?=54");
    }
    ?>

    Is there a easier way. Isn’t there a way to not show the MaxiGallery page to the web visitors and only show it to admin under preview? I’ve been reading about permissions but still don’t understand them enough to know if that would work.

    Here is a link to the site:

    http://208.106.214.149/index.php?id=67

    thanks,
      • 22303 MODX Staff
      • 10,725 Posts
      The else is redirecting you to another page; i.e. if logged in, redirect to page with id 54.
        • 4966
        • 143 Posts
        Thanks for the response. I know what the code is suppose to be doing. The problem is the else statement sends me to the default home page and not the page with the id of 54. This is what I need help with. This needs to work or I need to find another solution.

        charlie-imac
          • 22303 MODX Staff
          • 10,725 Posts
          Is this on localhost or that IP address? Why would you hardcode those redirects to localhost/judy/index.php?id=54 ? $modx->sendRedirect($modx->makeUrl(54)) is all you need.
            • 4966
            • 143 Posts
            Big thanks. Using the ’sendRedirect’ works. I didn’t know about ’sendRedirect’.

            charlie-imac