1 #!/usr/bin/perl –w 2 3 use strict; 4 use CGI::Carp qw(fatalsToBrowser); 5 use CGI qw(:standard); 6 my $sendmail_path = ‘/usr/lib/sendmail’; 7 my $url = url; 8 my $mode = param(‘mode’); 9 my $site_to_promote = ‘http://expertwebinstalls.com’; 10 if($mode eq ‘’) 11 { 12 # let’s do this one without the fancy CGI.pm html generation 13 print < 17 18

Tell A Friend About This Site!

19
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
Your Name
Your Email
Friend’s Name
Friend’s Email
41 42
43 44 45 MULTILINE_SEPERATOR 46 } 47 elsif($mode eq ‘send_email’) 48 { 49 my $your_name = param(‘your_name’); 50 my $your_email = param(‘friends_name’); 51 my $friends_name = param(‘friends_name’); 52 my $friends_email = param(‘friends_email’); 53 my $email_subject = $your_name . ‘ Recommends you visit ‘ . $site_to_promote; 54 my $email_body = < html tag. Pass the h2 function a string to notify the user that email was successfully sent, and to whom. We use string concatenation in the argument to the h2 function, so that we can print out the value of the CGI.pm function paraminside the

tag as well. Line 84: End our multiline print function with the CGI.pm function to output the end of an html document. The semicolon tells perl to stop printing, which we began on line 81. Line 85: End the elsif statement with a closing bracket. We started this elsifstatement on line 47. Line 86: Begin an else statement, to catch the case where someone specified a bad mode, perhaps a cracker trying to hack our script and cause the server harm. Line 87: This begins a multiline print statement, passing as the first argument CGI.pm’s header function, which tells the web server that an html document is on its way out to the web browser. Line 88: Pass another argument to print, the CGI.pm function for generating the html code to begin an html document. Line 89: Pass one more argument to the print function, the CGI.pm function for generating an

html tag. Pass the h2 function a string to notify the user that a bad mode was specified. Line 90: End our multiline print function with the CGI.pm function to output the end of an html document. The semicolon tells perl to stop printing, which we began on line 87. Line 91: This closing bracket tells perl we are finishing our else statement we started on line 86.