diff --git a/doc/doc.php b/doc/doc.php
index dec98af260c2deb856bdfe78d5f78492fe7e9d1b..133df3233f27730e95249d0e408c0e05f7476c37 100644
--- a/doc/doc.php
+++ b/doc/doc.php
@@ -23,7 +23,10 @@
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
+// The docs should be public and not require a login, so we ignore the fact we load config here without a login check.
+// @codingStandardsIgnoreStart
 require_once(__DIR__ . '/../../../../config.php');
+// @codingStandardsIgnoreEnd
 require_once(__DIR__ . '/docslib.php');
 
 /*
diff --git a/plot.php b/plot.php
index 02b5bc932a89f44852baa0b5ef2b0df4100ed762..d7db411bbcc1a3b2e80aeb3c91f6fe1b761f317c 100644
--- a/plot.php
+++ b/plot.php
@@ -24,6 +24,8 @@
 require_once(__DIR__ . '/../../../config.php');
 require_once($CFG->libdir . '/filelib.php');
 
+require_login();
+
 $filename = clean_filename(get_file_argument());
 $filenamesplit = explode('.', $filename);
 $filetype = end($filenamesplit);
diff --git a/stack/input/ajax.php b/stack/input/ajax.php
index ef6824fc2e29bff71df2182fe9503d218646182a..0785106a4bd6deef4d4cf230237531bc261fc206 100644
--- a/stack/input/ajax.php
+++ b/stack/input/ajax.php
@@ -29,9 +29,7 @@ $qaid  = required_param('qaid', PARAM_INT);
 $inputname = required_param('name', PARAM_ALPHANUMEXT);
 $inputvalue = required_param('input', PARAM_RAW);
 
-if (!isloggedin()) {
-    die;
-}
+require_login();
 
 // This should not be necessary, but the TeX filter requires it, because it uses $OUTPUT.
 $PAGE->set_context(context_system::instance());