#!/bin/sh if [ "$REQUEST_METHOD" = "POST" ]; then read QUERY_STRING if [ -n "$QUERY_STRING" ]; then IFS=\&;set ${QUERY_STRING%%[^%&=+-:@-_a-z~]*};unset IFS;eval $* fi fi if [ "$dau" = "yes" -a "$accept" = "yes" ]; then accept=no fi test -z "$accept" && accept=no test -z "$dau" && dau=no # prepare stuff . /usr/lib/dhcpsplash/functions.sh mac=$(splash_getmac "$REMOTE_ADDR") ## uris # url function need netparam! splash_agreement_url() { mode=$(splash_getvar ff_dhcpsplash_ag) if [ "$mode" = "url" ]; then url=$(splash_getvar ff_dhcpsplash_agurl) test -z "$url" && splash_getvar ff_dhcpsplash_agurldefault echo "$url" | sed " s//$SADR/ s//$(splash_ifmac wifi)/ s//$REMOTE_ADDR/ s//$mac/" else splash_getvar ff_dhcpsplash_agurldefault fi } splash_welcome_url() { mode="$(splash_getvar ff_dhcpsplash_hp)" if [ "$mode" = "url" ]; then url="$(splash_getvar ff_dhcpsplash_hpurl)" test -z "$url" && splash_getvar ff_dhcpsplash_hpurldefault echo "$url" | sed " s//$SADR/ s//$(splash_ifmac wifi)/ s//$REMOTE_ADDR/ s//$mac/" else splash_getvar ff_dhcpsplash_hpurldefault fi } # ARG: status message url [relative] splash_redirect() { if [ "$3" != "${3#http}" -o -n "$4" -a "$4" = "relative" ]; then url="$3" else url="http://$(nvram get wifi_ipaddr)/$3" fi moreheaders='' if [ "300" -le "$1" -a "$1" -lt "400" ]; then moreheaders="Location: $url" fi cat< $1 - $2

$1 - $2

click here if you are not redirected automatically.

EOF } # redirect requests which are not in our iprange to cgi-bin-index.html if ! splash_insplashrange "$REMOTE_ADDR"; then splash_redirect "302" "Temporary Redirect" "cgi-bin-index.html" "relative" exit fi # redirect blocked macs if splash_isblockedmac "$mac" || [ "$(splash_getvar ff_dhcpsplash_block)" = "on" ] && ! splash_ispreauthmac "$mac" || [ "$(splash_getvar ff_dhcpsplash_block)" = "all" ]; then splash_redirect "403" "Access not possible" "cgi-bin-blocked.html" exit fi # show index page for known clients if splash_isknownmac "$mac"; then splash_redirect "302" "Temporary Redirect" "cgi-bin-index.html" exit fi #DAU ;) (optional für eine eigene Umleitungsseite) if [ "$HTTP_REFERER" = "http://$(nvram get wifi_ipaddr)/$(splash_getvar ff_dhcpsplash_agurldefault)" -a "$accept" != "yes" ]; then splash_redirect "403" ";)" "$(splash_getvar ff_dhcpsplash_agurldefault)?dau=yes" exit fi # WELCOME # insert mac into iptables and display welcome page if [ "$accept" = "yes" -o "$(splash_getvar ff_dhcpsplash_ag)" = "off" ] && [ "$dau" != "yes" ]; then splash_insertmac "$mac" splash_redirect "302" "Temporary Redirect" "$(splash_welcome_url)" exit fi # AGREEMENT # goto agreement splash_redirect "403" "Agreement required" "$(splash_getvar ff_dhcpsplash_agurldefault)"