summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--files/etc/config/uhttpd4
-rwxr-xr-xfiles/www/cgi-bin/redirect8
-rwxr-xr-xfiles/www/cgi-bin/splash6
-rwxr-xr-xfiles/www/cgi-bin/splash_click7
-rwxr-xr-xfiles/www/cgi-bin/status.xml3
-rw-r--r--files/www/cgi-bin/template.status.xml31
-rw-r--r--files/www/iframe.html20
-rw-r--r--files/www/splash.html2
8 files changed, 76 insertions, 5 deletions
diff --git a/files/etc/config/uhttpd b/files/etc/config/uhttpd
index a424463..8320d42 100644
--- a/files/etc/config/uhttpd
+++ b/files/etc/config/uhttpd
@@ -5,8 +5,8 @@ config uhttpd main
list listen_http 0.0.0.0:80
# Server document root
option home /www
- option error_page /splash.html
- option index_page splash.html
+ option error_page /cgi-bin/redirect
+ option index_page cgi-bin/redirect
# Reject requests from RFC1918 IP addresses
# directed to the servers public IP(s).
# This is a DNS rebinding countermeasure.
diff --git a/files/www/cgi-bin/redirect b/files/www/cgi-bin/redirect
new file mode 100755
index 0000000..75979e2
--- /dev/null
+++ b/files/www/cgi-bin/redirect
@@ -0,0 +1,8 @@
+#!/bin/sh
+echo -en "Cache-Control: no-cache, max-age=0, no-store, must-revalidate\r\n"
+echo -en "Pragma: no-cache\r\n"
+echo -en "Expires: -1\r\n"
+echo -en "Status: 302 Temporary Redirect\r\n"
+echo -en "Location: http://"`uci get network.mesh.ipaddr`"/cgi-bin/splash?http://"`echo $HTTP_HOST$REQUEST_URI`"\r\n"
+echo -en "\r\n"
+exit 0
diff --git a/files/www/cgi-bin/splash b/files/www/cgi-bin/splash
new file mode 100755
index 0000000..2212eba
--- /dev/null
+++ b/files/www/cgi-bin/splash
@@ -0,0 +1,6 @@
+#!/bin/sh
+echo -en "Status: 200 OK\r\n"
+echo -en "Content-Type: text/html\r\n"
+echo -en "\r\n"
+targeturl=$(echo $QUERY_STRING | sed -f /etc/urlencode.sed)
+sed "s/targeturl/"$targeturl"/g" /www/splash.html
diff --git a/files/www/cgi-bin/splash_click b/files/www/cgi-bin/splash_click
index 32fce2e..b868658 100755
--- a/files/www/cgi-bin/splash_click
+++ b/files/www/cgi-bin/splash_click
@@ -1,6 +1,6 @@
#!/bin/sh
-echo -en "Status: 302 Temporary Redirect\r\n"
-echo -en "Location: http://www.freifunk-jena.de\r\n"
+echo -en "Status: 200 OK\r\n"
+echo -en "Content-Type: text/html\r\n"
echo -en "\r\n"
. $IPKG_INSTROOT/etc/functions.sh
@@ -14,12 +14,15 @@ is_ip() {
}
#check if user is alredy splashed
config_foreach is_ip user
+targeturl=$(echo $QUERY_STRING | sed 's/+/ /g; s/%/\\x/g')
+sed "s/targeturl/"$targeturl"/g" /www/iframe.html
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`
diff --git a/files/www/cgi-bin/status.xml b/files/www/cgi-bin/status.xml
new file mode 100755
index 0000000..8d45a90
--- /dev/null
+++ b/files/www/cgi-bin/status.xml
@@ -0,0 +1,3 @@
+#/bin/bash!
+hostname=`hostname`
+eval "echo \"$(cat template.status.xml)\""
diff --git a/files/www/cgi-bin/template.status.xml b/files/www/cgi-bin/template.status.xml
new file mode 100644
index 0000000..7df4e9f
--- /dev/null
+++ b/files/www/cgi-bin/template.status.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<node>
+ <hostname>$hostname</hostname>
+ <is_hna>0</is_hna>
+ <network>
+ <ip_4></ip_4>
+ <ip_6></ip_6>
+ </network>
+ <owner>Max Mustermann</owner>
+ <godfather>Susi Mustermann</godfather>
+ <position>
+ <lat></lat>
+ <long></long>
+ <text></text>
+ </position>
+ <statistics>
+ <uptime></uptime>
+ <dhcp_leases></dhcp_leases>
+ <load></load>
+
+ </statistics>
+
+ <batman-adv>
+ <route>
+ <hostname></hostname>
+ <mac></mac>
+ </route>
+ </batman-adv>
+</node>
+
+
diff --git a/files/www/iframe.html b/files/www/iframe.html
new file mode 100644
index 0000000..cdee514
--- /dev/null
+++ b/files/www/iframe.html
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xml:lang="en" lang="en">
+
+<head>
+ <title>Freifunk Jena</title>
+
+ <link rel="stylesheet" type="text/css" href="/ffj.css" />
+
+
+</head>
+<body style="margin:0px;">
+<!-- <div style="width:100%;padding:0px;background-color: #E5E5E5;text-align: center"><a href="targeturl">Weiter zur gesuchten Seite...</a></div>/-->
+<iframe src="http://www.freifunk-jena.de/" width="100%" height="1000px"></iframe>
+</body>
+</html>
diff --git a/files/www/splash.html b/files/www/splash.html
index eb3af30..e68d199 100644
--- a/files/www/splash.html
+++ b/files/www/splash.html
@@ -64,7 +64,7 @@ unser Netz verwenden. Dann wirst du erneut aufgefordet, diese Bedingungen zu akz
<div id="buttons">
-<a href="/cgi-bin/splash_click?accept" class="button">Akzeptieren</a> <a href="http://www.freifunk-jena.de/Decline" class="button">Ablehnen</a>
+<a href="/cgi-bin/splash_click?targeturl" class="button">Akzeptieren</a> <a href="http://www.freifunk-jena.de/Decline" class="button">Ablehnen</a>
</div>
</div>
contact: Jan Huwald // Impressum