diff options
Diffstat (limited to 'files/common/www/cgi-bin/splash_click')
-rwxr-xr-x | files/common/www/cgi-bin/splash_click | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/files/common/www/cgi-bin/splash_click b/files/common/www/cgi-bin/splash_click new file mode 100755 index 0000000..d08af6a --- /dev/null +++ b/files/common/www/cgi-bin/splash_click @@ -0,0 +1,38 @@ +#!/bin/sh +echo -en "Status: 200 OK\r\n" +echo -en "Content-Type: text/html\r\n" +echo -en "\r\n" +TEST=`cat ` +TEST=`echo $TEST | sed 's/'target_url='/''/g'` +TEST=`/bin/urldecode "$TEST"` +TEST=`echo $TEST | sed 's/%2F/\//g'` +USER_MAC=`cat /proc/net/arp | grep $REMOTE_HOST | awk 'BEGIN { FS = " " } ; { print $4 }'` + +. $IPKG_INSTROOT/etc/functions.sh +ISSPLASHED=0 +config_load splash_users +is_mac() { + config_get mac "$1" mac + if [ "$mac" == "$USER_MAC" ]; then + ISSPLASHED=1 + fi +} +#check if user is alredy splashed +config_foreach is_mac user +sed 's/targeturl/'"$(echo $TEST| sed 's#/#\\/#g')"'/g' /www/iframe.html + +if [ $ISSPLASHED -eq 1 ]; then + exit +fi +#User is now free to go +iptables -t nat -I ffj_splash 1 -m --mac-source $USER_MAC -j ACCEPT + +uci -q add splash_users user +uci -q set splash_users.@user[-1].mac=$USER_MAC +uci -q set splash_users.@user[-1].time=`date +%s` + +exit 0 + + + + |