Write a CGI program that keeps a list of computers that have contacted the server. If comp1 is contacting first time it will display the message:
"This is the first contact from comp1" else it will display the message
"Computer comp1 has requested this URL previously."
A CGI program which has a list of computers which have contacted the server is as given below:
#!/bin/sh
FILE = ipaddress
echo Content -type: text /plain
echo
# see if IP address computer appears in file ip address
if grep -s $REMOTE_ADDR $FILE>/dev/nul l 2 >&1
then
echo Computer $REMOTE_ADDR has requested this URL previously.
else
# append browser's address to the file
echo $REMOTE_ADDR >> $FILE
echo This is the first contact from computer $REMOTE_ADDR.