da8370dafa9eb726ee8b1a466ab9a99f4d03f986
[project/luci.git] / applications / luci-app-splash / htdocs / cgi-bin / splash / splash.sh
1 #!/bin/sh
2
3 $(uci -q get luci_splash.general.redirect_url) || {
4         touch /var/state/luci_splash_locations
5         touch /etc/config/luci_splash_locations
6         MAC=$(grep "$REMOTE_HOST" /proc/net/arp | awk '{print $4}')
7         uci -P /var/state set luci_splash_locations.${MAC//:/}=redirect
8         uci -P /var/state set luci_splash_locations.${MAC//:/}.location="http://${HTTP_HOST}${REQUEST_URI}"
9 }
10
11 echo -en "Cache-Control: no-cache, max-age=0, no-store, must-revalidate\r\n"
12 echo -en "Pragma: no-cache\r\n"
13 echo -en "Expires: -1\r\n"
14 echo -en "Status: 307 Temporary Redirect\r\n"
15 echo -en "Location: http://$SERVER_ADDR/cgi-bin/luci/splash\r\n" 
16 echo -en "\r\n"
17
18 cat <<EOT
19 <?xml version="1.0" encoding="UTF-8"?>
20 <WISPAccessGatewayParam xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.wballiance.net/wispr_2_0.xsd">
21         <Redirect>
22                 <MessageType>100</MessageType>
23                 <ResponseCode>0</ResponseCode>
24                 <AccessProcedure>1.0</AccessProcedure>
25                 <AccessLocation>12</AccessLocation>
26                 <LocationName>$SERVER_ADDR</LocationName>
27                 <LoginURL>http://$SERVER_ADDR/cgi-bin/luci/splash?wispr=1</LoginURL>
28                 <AbortLoginURL>http://$SERVER_ADDR/</AbortLoginURL>
29         </Redirect>
30 </WISPAccessGatewayParam>
31 EOT
32
33