#!/bin/sh

# Catch main script
if [ "${SCRIPT_NAME#/*/}" = "index.shtml" ]; then
  . /opt/captive_portal/usr/libexec/core
elif [ "${SCRIPT_NAME#/*/}" = "ban.shtml" ]; then
  . /opt/captive_portal/usr/libexec/core_bp
else
  export CP_PAGE_NAME="$SCRIPT_NAME"
fi

# Forward request to standard SSI handler
/opt/captive_portal/usr/sbin/ssi-cgi "$DOCUMENT_ROOT$CP_PAGE_NAME"
