in reply to making first letter of all words in array upper case
The script works great now, but as per merlyn's request, I am not deploying this script until everyone is happy :)))) It is online, but there are no links to it, except the one on here.
Here is the final script:
#!/usr/bin/perl -wT ################################ ################################ ### ### ### written by Rob Johnson ### ### www.robj.ca ### ### tellscript@robj.ca ### ### ### ################################ ################################ use CGI::Carp qw(fatalsToBrowser); use strict; use CGI ':standard'; # fixes the error with -t switch in mailprogram line? # hey I don't know... but it works! :) $ENV{'PATH'} = "/bin:/usr/bin:/usr/sbin"; my $redirect = "http://www.robj.ca/told.htm"; my $sitename = "robj.ca"; my $siteurl = "http://www.robj.ca"; my $from = param('from'); my $to = param('to'); my $frommail = param('frommail'); my $tomail = param('tomail'); my $message = param('message'); ############################################### # make all first characters of names, uppercase my @from = split(/ /, $from); @from = map ucfirst, @from; my @to = split(/ /, $to); @to = map ucfirst, @to; ############################################### # make the first letter of the message upper case $message = ucfirst($message); ############################################## # puts a period at the end of senders message, # if one was not there, AND, if there is no # question OR explanation mark. $message .= '.' if $message !~ /[.!?]$/; ############################################## # sending mail now... open (MAIL, "|/usr/sbin/sendmail -t") || Error ('open', 'mail program' +); print MAIL "From: $frommail\n"; print MAIL "To: $tomail\n"; print MAIL "Subject: @to, @from says check out $sitename!\n\n"; print MAIL "This is NOT spam! You were sent the email by @from ($fro +mmail),\nat IP: $ENV{'REMOTE_ADDR'}\n\n\n"; print MAIL "Hello @to, @from has sent you this email inviting you to + check out $siteurl\n\n\n"; print MAIL "@from also had this to say:\n$message\n\n\n" if ($messag +e ne ""); print MAIL "So check out $siteurl!"; close (MAIL); sub Error { print "The server can't $_[0] the $_[1]: $! \n"; exit; } # ready browser for html output print "Content-type: text/html\n\n"; # redirect the browser... print "<meta http-equiv=\"refresh\" content=\"0;url=$redirect\">"; # end
How can this script be made safe agaist people who would want to exploit it?
Would it take much more work?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: making first letter of all words in array upper case
by davorg (Chancellor) on Dec 31, 2002 at 22:52 UTC | |
|