Code Sample 36_2

#!/bin/sh
FILE=ipaddrs

echo Content-type: text/plain
echo

if grep -s $REMOTE_ADDR $FILE  > /dev/null 2>&1
then
 echo Computer $REMOTE_ADDR has requested this URL previously.
else
 echo $REMOTE_ADDR >> $FILE
 echo This is the first contact from computer $REMOTE_ADDR.

fi


Item information

Caption: Code for CGI program that stores long-term state information in section 36.10
Code sample: 36_2
Type: code sample
Item: Code sample 36_2 without caption
Keywords: CGI, CGI script, long-term state