From 88e90d7e5080ef9eeedb2aa3ea6186380a8344d6 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Wed, 16 Feb 2022 16:56:28 +0000 Subject: [PATCH] [Visitor] Started the basic code structure of the controller The visitor controller will handle allowing the public to see a logbook and some of its data. --- application/controllers/Visitor.php | 47 +++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 application/controllers/Visitor.php diff --git a/application/controllers/Visitor.php b/application/controllers/Visitor.php new file mode 100644 index 00000000..da37e7bd --- /dev/null +++ b/application/controllers/Visitor.php @@ -0,0 +1,47 @@ +$method(); + } + else { + $this->index($method); + } + } + + /* + This is the default function that is called when the user visits the root of the public controller + */ + public function index($public_slug = NULL) + { + + // If environment is set to development then show the debug toolbar + if(ENVIRONMENT == 'development') { + $this->output->enable_profiler(TRUE); + } + + // Check slug passed and is valid + if ($this->security->xss_clean($public_slug, TRUE) === FALSE) + { + // file failed the XSS test# + log_message('error', '[Visitor] XSS Attack detected on public_slug '. $public_slug); + show_404('Unknown Public Page.'); + } else { + // Checked slug passed and clean + log_message('info', '[Visitor] public_slug '. $public_slug .' loaded'); + + echo $public_slug = $this->security->xss_clean($public_slug); + + // Check if the slug is contained in the station_logbooks table + + } + } + +} \ No newline at end of file