#!/bin/sh # # CGI which process the request of the user _before_ he/she has pressed continue # # Rick van der Zwet # PATH=$PATH:/usr/sbin:/usr/bin:/sbin DB=/tmp/authenticated.txt AUTOLOGIN_DB=/tmp/autologin.txt REMOTE_MAC=`arp -n $REMOTE_ADDR | awk '{print $4}'` # Make sure databases exists touch $DB $AUTOLOGIN_DB # Check user state if grep -q $REMOTE_MAC $DB; then # User has already been here (ones) continue authention directly `dirname $0`/login/index.cgi elif grep -q $REMOTE_MAC $AUTOLOGIN_DB; then # Device is marked as special, continue with autologin `dirname $0`/login/index.cgi else echo -e 'Status: 302 OK" \r' echo -e 'Location: http://welcome.wleiden.net/portal/portal.html\r' echo -e 'Content-Type: text/html\r' echo -e 'Cache-Control: no-cache, no-store, must-revalidate\r' echo -e 'Pragma: no-cache\r' echo -e 'Expires: 0\r' echo -e '\r' fi