Please visit our sponsor
UNKNOWN =************************************** = Name: Send an Message to an ICQ account without ICQ! = Description:I found this code on the web(source forgotten - my bad), and made minimal changes to it. This allows you to send a message to an ICQ Account. = By: Brandon McPherson = = = Inputs:It's all self-contained. = = Returns:HTML = =Assumes:None = =Side Effects:Excessive hair growth :) =This code is copyrighted and has limited warranties. =Please see http://www.Planet-Source-Code.com/xq/ASP/txtCodeId.142/lngWId.6/qx/vb/scripts/ShowCode.htm =for details. =************************************** #!/usr/bin/perl my $TITLE = "Page me on ICQ!"; my $BGCOLOR = "#FFCC00"; my $TEXT_COLOR_NORMAL = "#000000"; my $REQUIRED_TEXT_COLOR = "Black"; my $BACKGROUND_URL = ""; my $CGI_DIR = "http://www.servername.com/cgi-bin"; $SHOW_OPTIONAL_FIELDS = 0; my $sendmail = "/usr/sbin/sendmail"; my $destination_email = "1234567\@pager.icq.com"; &print;_header; &get;_form_data; if (!$FORM_DATA{'mail'}) { &print;_html_form; } else { $error = 0; &check;_form_data; if (!$error) { &send;_mail; &reply;_to_user; } } exit(0); sub print_header { print ("Content-type: text/html\n\n"); print ("<html>\n<head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> \n<title>$TITLE</title>\n</head>\n"); print ("<body bgcolor="\&quot;$BGCOLOR\&quot;" background="http://www.exhedra.com/vb/scripts/\&quot;$BACKGROUND_URL\&quot;" "); print ("text="\&quot;$TEXT_COLOR_NORMAL\&quot;">\n"); }#print_header sub get_form_data { $request_method = $ENV{'REQUEST_METHOD'}; if ($request_method eq "GET") { $form_info = $ENV{'QUERY_STRING'}; } else { $size_of_form_information = $ENV{'CONTENT_LENGTH'}; read (STDIN, $form_info, $size_of_form_information); } @key_value_pairs = split (/&/, $form_info); foreach $key_value (@key_value_pairs) { ($key, $value) = split (/=/, $key_value); $value =~ tr/+/ /; $value =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C", hex ($1))/eg; if (defined($FORM_DATA{$key})) { $FORM_DATA{$key} = join (", ", $FORM_DATA{$key}, $value); } else { $FORM_DATA{$key} = $value; } } } #get_form_data sub print_html_form { print &lt;&lt;__END_OF_HTML_CODE__; <form action="/" method="POST"> <input type="hidden" name="to" value="$FORM_DATA{'to'}"> __END_OF_HTML_CODE__ if ($SHOW_OPTIONAL_FIELDS) { print ("<br><font color="\&quot;$REQUIRED_TEXT_COLOR\&quot;"><b>All required "); print ("information is bolded in this color.</b></font>\n"); print ("Everything else is just for my own curiosity. <br>"); } print &lt;&lt;__END_OF_HTML_CODE__; <table border="0" cellpadding="4" cellspacing="2"> <tr valign="top"> <td> <table> __END_OF_HTML_CODE__ if ($SHOW_OPTIONAL_FIELDS) { print ("<tr valign="\&quot;top\&quot;">\n"); print ("<td>Your name:</td>\n"); print ("<td><input type="\&quot;text\&quot;" name="\&quot;users_name\&quot;"></td>\n"); print ("</tr>\n"); } print &lt;&lt;__END_OF_HTML_CODE__; <tr valign="top"> <td><font color="$REQUIRED_TEXT_COLOR"><b>Your email:</b></font></td> <td><input type="text" name="users_email"> <font color="$REQUIRED_TEXT_COLOR"> </td> </tr> </table> <br> __END_OF_HTML_CODE__ if ($SHOW_OPTIONAL_FIELDS) { print &lt;&lt;__END_OF_HTML_CODE__; <table> <tr valign="top"> <td>Your country of residence:</td> <td><input type="text" name="users_country"><br><br></td> </tr> <tr valign="top"> <td>Your home State/Province:</td> <td> <input type="radio" name="state_usa" value="USA"> If inside the U.S.: <select name="state_address1" size="1"> <option>Alabama <option>Alaska <option>Arizona <option>Arkansas <option>Hawaii <option>California <option>Colorado <option>Connecticut <option>Delaware <option>Florida <option>Georgia <option>Idaho <option>Illinois <option>Indiana <option>Iowa <option>Kansas <option>Kentucky <option>Louisiana <option>Maine <option>Maryland <option>Massachusetts <option>Michigan <option>Minnesota <option>Mississippi <option>Missouri <option>Montana <option>Nebraska <option>Nevada <option>New Hampshire <option>New Jersey <option>New Mexico <option>New York <option>North Carolina <option>North Dakota <option>Ohio <option>Oklahoma <option>Oregon <option>Pennsylvania <option>Rhode Island <option>South Carolina <option>South Dakota <option>Tennessee <option>Texas <option>Utah <option>Vermont <option>Virginia <option>Washington <option>Washington, D.C. <option>West Virginia <option>Wisconsin <option>Wyoming </select><br> <input type="radio" name="state_usa" value="NOT_USA"> If outside the U.S.: <input type="text" name="state_address2"> </td> </tr> </table> <br> __END_OF_HTML_CODE__ } print &lt;&lt;__END_OF_HTML_CODE__; <font color="$REQUIRED_TEXT_COLOR"><b>Please enter your message below:</b></font><br> <textarea name="message" rows="8" cols="40"></textarea> <br> Please note that your are limited to 450 characters. <br> <br> <input type="hidden" name="mail" value="1"> <input type="submit" value="$TITLE"> </td> </tr> </table> <br> </form> </body> </html> __END_OF_HTML_CODE__ } #print_html_form sub check_form_data { my %error_codes = ( "1" =&gt; "You need to enter your email address.", "2" =&gt; "You seemed to have forgotten to enter the email message you wish to send.", "3" =&gt;"For security reasons, you cannot have any of the following characters in your email or subject fields: [ ; &lt; &gt; & \* ` \| ] " ); if ($FORM_DATA{'users_email'} !~ /\@/ && $FORM_DATA{'users_email'} !~ /\w/) { $error = 1; } elsif ($FORM_DATA{'message'} !~ /\w/) { $error = 2; } if (($FORM_DATA{"subject"} =~ /[\[\;\&gt;\&lt;\&\*\^\$\(\)\`\|\]\']/) || ($FORM_DATA{"to"} =~ /[\[\;\&gt;\&lt;\&\*\^\$\(\)\`\|\]\']/) || ($FORM_DATA{"users_email"} =~ /[\[\;\&gt;\&lt;\&\*\^\$\(\)\`\|\]\']/)) { $error = 3; } if ($error) { print ("<h3>\n"); print ("D'OH!<br>"); print ("We had a little mishap. This is why:<br> \n"); print ("<br>$error_codes{$error}\n<br>\n<br>"); print ("Please hit the back button in your browser to "); print ("correct this. Thank you!\n"); print ("</h3>\n</body>\n</html>\n"); } if ($FORM_DATA{'to'} ne "") { $destination_email = $FORM_DATA{'to'}; } } #check_form_data sub send_mail { open (MESSAGE, "| $sendmail -t -oi "); print MESSAGE &lt;&lt;__END_OF_MESSAGE__; To: $destination_email From: $FORM_DATA{"users_email"} __END_OF_MESSAGE__ if ($FORM_DATA{'users_name'} ne "") { print MESSAGE ("$FORM_DATA{'users_name'} - "); } print MESSAGE ("$FORM_DATA{'users_email'} paged you on ICQ "); print MESSAGE ("from your website.\n"); if ($FORM_DATA{'users_country'} ne "") { print MESSAGE ("They are in the country of: $FORM_DATA{'users_country'}\n"); } if ($FORM_DATA{'state_usa'} =~ /^USA$/i) { print MESSAGE ("They are writing from the state of: $FORM_DATA{'state_address1'}\n\n"); } elsif ($FORM_DATA{'state_usa'} =~ /^NOT_USA$/i) { print MESSAGE ("They are writing from the province of: $FORM_DATA{'state_address2'}\n\n"); } print MESSAGE ("The follow is what they had to say:\n\n"); print MESSAGE ("$FORM_DATA{'message'}\n"); close (MESSAGE); if ($FORM_DATA{'keep_copy'}) { open (MESSAGE, "| $sendmail -t -oi "); print MESSAGE &lt;&lt;__END_OF_MESSAGE__; To: $FORM_DATA{"users_email"} __END_OF_MESSAGE__ print MESSAGE ("The following is what you wrote from the "); print MESSAGE ("$TITLE webpage...:\n\n"); print MESSAGE ("$FORM_DATA{'message'}\n"); close (MESSAGE); } } #send_mail sub reply_to_user { print ("Thank you for paging me on ICQ<br><br>\n"); print ("Below is a copy of the information you sent me:<br>\n"); print ("<dl>\n"); if ($FORM_DATA{'users_name'} ne "") { print ("<dt><b>Your name:</b>\n<dd>$FORM_DATA{'users_name'}<br><br>\n"); } print ("<dt><b>Your email:</b>\n<dd>$FORM_DATA{'users_email'}<br><br>\n"); if ($FORM_DATA{'users_country'} ne "") { print ("<dt><b>Your country:</b>\n<dd>$FORM_DATA{'users_country'}<br><br>\n"); } if ($FORM_DATA{'state_address1'} ne "" && $FORM_DATA{'state_usa'} =~ /^USA$/i) { print ("<dt><b>Your state:</b>\n<dd>$FORM_DATA{'state_address1'}<br><br>\n"); } elsif ($FORM_DATA{'state_address2'} ne "" && $FORM_DATA{'state_usa'} =~ /^NOT_USA$/i) { print ("<dt><b>Your state:</b>\n<dd>$FORM_DATA{'state_address2'}<br><br>\n") if ($FORM_DATA{'state_address2'} ne ""); } print ("<dt><b>Your message:</b>\n<dd>$FORM_DATA{'message'}<br><br>\n"); print ("</dl>\n"); print ("</body>\n</html>\n"); } #reply_to_user #FILE: icq.pl