#!/bin/bash #Getting IP address CGI-BASH-script #MySQL settings MHOME=/usr/local/mysql/bin HOST=127.0.0.1 USER=root PASS="" DB=jks OWNER=`echo "$QUERY_STRING" |awk -F "=" '{print $NF}'` IP=$REMOTE_ADDR #QUERY_STRING = Query information that follows the ? in the URL that referenced this script. #REMOTE_ADDR = IP address of the remote host making the request #HTML Output echo "Content-type: text/html" echo "" echo "
"; echo "IP: $IP";
" echo "You Are: $OWNER
" $MHOME/mysql -u$USER -h$HOST --password=$PASS -e "INSERT INTO jks.ips(rdate,ip,owner) VALUES(NOW(),'$IP','$OWNER')" $DB echo "