#!/usr/local/bin/perl # Make sure that the above points to perl on your system # ------------------------------------------------------------ # you.pl, you.cgi Copyright 1995 by David Efflandt # Updated 2/28/99 by efflandt@xnet.com # Rename as you.cgi, for WWW script. # may be freely distributed and modified # # you.cgi lists info in html format. Logs info to you.txt # See it in action at: http://www.xnet.com/~efflandt/ # --------------------------------------------------------------------- # To make executable: chmod a+x you.cgi # # When first set it up you may need to: # 'touch you.txt' # 'chmod a+w you.txt' # To test scripts locally from UNIX (variables may be blank): # include current (.) or actual dir in path of .cshrc and .profile # see: 'man rehash' (csh) or 'man hash' (sh or ksh) to test locally # --------------------------------------------------------------------- # Your home page url (or relative url path) $homepage = "home.shtml"; # Datafile (with system path if needed) $datafile = "you.txt"; # City for server time zone (or 'GMT' if your server uses that) $zone = "Chicago area"; ### End of user variables ### # Get date and time $date = scalar localtime; # Get remote host if server does not unless ($ENV{REMOTE_HOST} && $ENV{REMOTE_ADDR} ne $ENV{REMOTE_HOST}) { my $ip_num = pack("C4", split(/\./, $ENV{REMOTE_ADDR})); $ENV{REMOTE_HOST} = scalar gethostbyaddr($ip_num, 2); $ENV{REMOTE_HOST} = $ENV{REMOTE_ADDR} unless $ENV{REMOTE_HOST}; } # ------------------------------------------- # Output to browser (blank line after Content-type is important) print <How did he do that?

What I know about you?

\n


In $zone it is currently: $date

You are looking at me with: $ENV{'HTTP_USER_AGENT'}

"You are connected from: $ENV{REMOTE_HOST}

Your mothers maiden name is ...


Well, maybe I shouldn't give away all my secrets!

Our current Web server is: $ENV{'SERVER_SOFTWARE'}

See who pressed "you"

Grab the script.

Return to my home page.

EOF # Append data to you.txt if (open YOU,">> $datafile") { print YOU "DATE = $date\n"; print YOU "WITH = $ENV{'HTTP_USER_AGENT'}\n"; print YOU "FROM = $ENV{REMOTE_HOST} "; print YOU "$ENV{REMOTE_ADDR}" if $ENV{REMOTE_ADDR} ne $ENV{REMOTE_HOST}; print YOU "\n\n"; close YOU; } else { print "Can't open $datafile: $!\n"; } print "\n";