Tracking IP etc on form

Please see this question:

http://www.experts-exchange.com/jsp/qManageQuestion.jsp?qid=20274914&jsessionid=2593911016807936864

I would like the ability to track the IP address on the following form.  I am slightly modifying the address of my client.

It's on a NT server.

Here's the perl.  The HTML follows after that.  I am only offering 50 points because I am starting to get a bit low!  Hopefully the solution is ver simple.

If it is also easy, I would like to get any other information such as their browser type, refering domain, etc -- anything that is as easily obtainable as their IP

===============PERL SCRIPT FOLLOWS ==============
$|++;
use Net::SMTP;
use CGI;
$q = new CGI;

$ecxfolks='johndoe@blah.com>, johnsmith@blah.com>';
$toddemail='thatch@blah.com>';
$message="This is a Thank you note\nThis is the 2nd line of the the message.";
$user_subject='Thank You!!';

foreach ($q->param){
      $$_=$q->param($_);

      next if /^affiliate_email$/;
      $$_=~ s/^\s+//g;
      $$_=~ s/\s+$//g;
}

@new_from=split(/,\s/,join(', ',$ecxfolks)); ## NOTE the , inside the single quotes

if (!($to)){
      print "Content-type: text/html\n\n";
      print "Please go back and enter your email address.BR>\n";
      exit;
}

if (!($name)){
      print "Content-type: text/html\n\n";
      print "Please go back and enter your name.BR>\n";
      exit;
}

foreach $new_from (@new_from){
      $smtp = Net::SMTP->new('localhost'); # connect to an SMTP server
      $smtp->mail($to);      ##      use the affiliate address here
      $smtp->to($new_from);     ##     recipients address. Use new_from, not from
      $smtp->data();
      $smtp->datasend("To: ".$new_from."\n");
      $smtp->datasend("Subject: ".$affiliate_subject."\n");
      $smtp->datasend("\n");
        $smtp->datasend("Subject : $affiliate_subject\n");
      $smtp->datasend("Name : $name\n");
      $smtp->datasend("Email : $to\n");
      $smtp->datasend("Home phone : $homephone\n");
      $smtp->datasend("Work phone  : $workphone\n");
      $smtp->datasend("Comments : $comments\n");
      $smtp->dataend();                   # Finish sending the mail
      
      ##  Close the connection
      $smtp->quit;
}


##      Redirect to the Thank you page.
print "Location: https://www.blah.com/html/content/response2.shtml\n\n";

==================HTML CODE ========================
html>
head>


body bgcolor="#FFFFFF" text="#000000">
table border="0" cellpadding="0" cellspacing="0">
  tr valign="top">
    td>
      div align="center">font face=Arial size=+1 color=#007b79>b>i>Form/i>/b>/font>
      /div>
      div align="right">/div>
      div align="center">/div>
    /td>
  /tr>
  tr valign="top">
    td>
      form method="POST" action="http://www.blah.com/cgi-bin/rowby-cj-new4.plx">
        input type=HIDDEN name="affiliate_subject" value="Form Application">
       

        table cellspacing=5 cellpadding=0 border=0 width="100%">
          !-- BEGIN FORM FIELDS -->
          tr>
            td align=center valign=top  bgcolor="#FFFFFF" height="28" bordercolor="#006666">
              table width="100%" border="1" cellpadding="0" bordercolor="#006666">
                tr>
                  td height="2">
                    table height=100% width=100% cellpadding=2 cellspacing=0 align="center">
                      tr>
                        td align=right valign=center colspan="4" height="19">
                          div align="center">/div>
                        /td>
                      /tr>
                      tr>
                        td align=right valign=center width="24%">font size=-2 face="Arial, Helvetica">nobr>b>
                          NAME/b>/font>/td>
                        td align=left valign=center width="23%">
                          input type="text" name="name" size="25">
                        /td>
                        td align=right valign=center width="10%">font size=-2 face="Arial, Helvetica">nobr>b>HOME
                          PHONE/b>/font>/td>
                        td align=left valign=center width="43%">nobr>
                          input type="text" name="homephone" size="25">
                        /td>
                      /tr>
                      tr>
                        td align=right valign=center width="24%">font size=-2 face="Arial, Helvetica">b>E-MAIL/b>/font>/td>
                        td align=left valign=center width="23%">
                          input type="text" name="to" size="25">
                        /td>
                        td align=right valign=center width="10%">font size=-2 face="Arial, Helvetica">b>WORK
                          PHONE/b>/font>/td>
                        td align=left valign=center width="43%">
                          input type="text" name="workphone" size="25">
                        /td>
                      /tr>
                      tr>
                        td align=right valign=center colspan="4">font size=-2 face="Arial, Helvetica">nobr>/font>
                          div align="center">font size=-2 face="Arial, Helvetica">b>Comments:

                            textarea name="comments" rows="2" cols="35">/textarea>
                            /b>nobr>/font>/div>
                          nobr> /td>
                      /tr>
                      tr valign="top">
                        td align=right colspan="4">
                          div align="center">
                            input type="image" src="image.gif" width="X" height="X"name="Submit" value="Submit">
                          /div>
                        /td>
                      /tr>
                    /table>
                  /td>
                /tr>
              /table>
            /td>
          /tr>
          !-- END FORM FIELDS -->
        /table>
      /form>
    /td>
  /tr>
  tr valign="top">
    td>  /td>
  /tr>
/table>
/body>
/html>

LVL 9
Rowby GorenAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
SapaConnect With a Mentor Commented:
Just add in you script, after line:

$smtp->datasend("Work phone  : $workphone\n");

follow lines:

$smtp->datasend("Referer     : " . $q->referer . "\n");
$smtp->datasend("Remote Host : " . $q->remote_host . "\n");
$smtp->datasend("User Agent  : " . $q->user_agent . "\n");

0
 
Rowby GorenAuthor Commented:
Thank You Sapa.  It was exactly what I needed.

Rowby
0
All Courses

From novice to tech pro — start learning today.