summaryrefslogtreecommitdiff
path: root/files/www/cgi-bin/splash_click
blob: 32fce2eacbf8b8205122ddc160ada8b7f1e24e9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
echo -en "Status: 302 Temporary Redirect\r\n"
echo -en "Location: http://www.freifunk-jena.de\r\n"
echo -en "\r\n"
                                    
. $IPKG_INSTROOT/etc/functions.sh
ISSPLASHED=0
config_load splash_users
is_ip() {
   config_get ip "$1" ip
   if [ "$ip" == "$REMOTE_HOST" ]; then
   	ISSPLASHED=1
   fi
}
#check if user is alredy splashed
config_foreach is_ip user

if [ $ISSPLASHED -eq 1 ]; then
	exit
fi
#User is now free to go
iptables  -t nat -I ffj_splash 1 -s $REMOTE_HOST -j ACCEPT
uci add splash_users user
uci set splash_users.@user[-1].ip=$REMOTE_HOST
uci set splash_users.@user[-1].time=`date +%s`
uci -q commit > /dev/null
exit 0


                                               

contact: Jan Huwald // Impressum