source: hybrid/branches/releng-10/nanobsd/files/usr/local/www/portal/index.cgi

Last change on this file was 13371, checked in by rick, 10 years ago

Use headers since they are now served by httpd

  • Property svn:executable set to *
File size: 811 bytes
Line 
1#!/bin/sh
2#
3# CGI which process the request of the user _before_ he/she has pressed continue
4#
5# Rick van der Zwet <info@rickvanderzwet.nl>
6#
7PATH=$PATH:/usr/sbin:/usr/bin:/sbin
8DB=/tmp/authenticated.txt
9AUTOLOGIN_DB=/tmp/autologin.txt
10
11REMOTE_MAC=`arp -n $REMOTE_ADDR | awk '{print $4}'`
12
13# Make sure databases exists
14touch $DB $AUTOLOGIN_DB
15
16# Check user state
17if grep -q $REMOTE_MAC $DB; then
18 # User has already been here (ones) continue authention directly
19 ./login/index.cgi
20elif grep -q $REMOTE_MAC $AUTOLOGIN_DB; then
21 # Device is marked as special, continue with autologin
22 ./login/index.cgi
23else
24 echo 'Content-Type: text/html'
25 echo ''
26 # User is new, present welcome page
27 sed -e "s/\$REMOTE_ADDR/$REMOTE_ADDR/" \
28 -e "s/\$REMOTE_MAC/$REMOTE_MAC/" \
29 `dirname $0`/index.html.tmpl
30fi
Note: See TracBrowser for help on using the repository browser.