Using CGI environment variables, write a program that logs the addresses (obtained with the REMOTE_ADDR CGI envi- ronment variable) that request information from the Web server.

What will be an ideal response?


```

1 #!perl

2 # Exercise 29.11 Solution

3 # Program to save remote addresses to a text file.

4 use CGI qw( :standard );

5

6 print header, start_html( "Saving Remote Address..." );

7

8 $address = $ENV{REMOTE_ADDR};

9

10 # Write data to a text file

11 open( FILE, ">>addresses.txt" );

12 print FILE "$address
";

13 close FILE;

14

15 print "Your address, $address, has been recorded.";

16 print end_html;

```



Computer Science & Information Technology

You might also like to view...

A _________________________ is a software program that contains mapping logic capable of transforming message data to and from different data formats.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

Write a method called floatEquals that accepts three floating-point values as parameters. The method should return true if the first two parameters are equal within the tolerance of the third parameter.

What will be an ideal response?

Computer Science & Information Technology

You can move any open window that is maximized to another location on the desktop by dragging the title bar of the window.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

The result of adding an integer to a pointer can be stored in a pointer variable.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology