#!/usr/local/bin/perl #################################### # NP Form Mail v2.5 # # written by: Mr. BS # # net_person@hotmail.com # # http://npscripts.hypermart.net # #################################### # I hope you read the readme... # ######################################################################################### # DISCLAIMER: # # # # This script was tested on Hypermart (hypermart.net) and Virtualave (virtualve.net) # # servers. It will work fine with them as long as you configure the variables correctly!# # However, if you don't configure the variables correctly, it won't work! (duh) # # The variables that need configured are commented indicating what is what. # # I can't be responsible if this script causes any damage to your server, because it # # flat out shouldn't! But if it does, it's YOUR fault. Just follow the commented # # instructions (the ones marked with a #) and do as they say. If you do, you'll be fine.# # # # # # LEGAL CRAP: # # # # Don't distribute this script for profit. It may be distributed free, but leave all # # this commented stuff to give me credit. # # # ######################################################################################### # # # You need to edit the path perl (the first line of this script) if it's different than # # the default one! # # # # This scripts can be used on as many forms as you wish as long as you follow the rules # # for "require" which is the second variable you must configure, follow commented # # instrcutions for details on it. # # Also, if you go looking through the code and find the "powered by" lines... DO NOT # # CHANGE THEM!! This keeps the script free and easy to get. Please don't abuse this... # ######################################################################################### # Oh yeah, I am a human. So, I make mistakes. If you find any mistakes in the coding # # or whatever in this scripts, send me an e-mail at net_person@hotmail.com and tell me # # about it so I can fix it. Thanks... # ######################################################################################### #################### # DO NOT EDIT THIS # $version = "2.5"; #################### ##################################################################### ###################### START EDITING VARIABLES ###################### ##################################################################### ##################################################################### ######################## REQUIRED VARIABLES ######################### ##################################################################### ##################################################################### # This is where sendmail is on your server # # The default value is the path to Hypermart's sendmail # # The most common path however is /usr/sbin/sendmail # # Check with your server's webmaster for the path if you're unsure # ##################################################################### $mailprog = '/usr/sbin/sendmail'; ##################################################################### # This is the email address that the information will be sent to. # # You MUST leave the \ before the @ or the script will not work! # # ALSO: This should NOT be an address that you don't want your # # visitors to know. It'll be displayed on the missing field page. # ##################################################################### $recipient = "vgkcc\@yahoo.com"; ##################################################################### # This will tell the script if certain fields are required. # # Remember if you use this script on multiple forms, it's best to # # only require something such as "email" so that all of the forms # # will require that to be filled. If you require something like # # 'color' on one form, but not others and you use the same script # # to process your forms, it will always will return an error on a # # form that doesn't have "color" as a variable. Again, you should # # only put something like "email" that will be used in all forms # # unless you want to use multiple versions of this script (each # # configured individually). The variable can be specified in the # # "name" tag of an input box. # ##################################################################### @required = ('email','name'); ##################################################################### # Change this to the URL for your webpage. This will be the link # # back to your page after the form has been submitted. # ##################################################################### $homepage = "www.vgkcc.alturl.com"; ##################################################################### ######################## OPTIONAL VARIABLES ######################### ##################################################################### ##################################################################### # Change these accordingly: # # --subject: Subject of e-mail that will be sent. # # --thanksmessage: Your personal message to the person who # # submitted the form. Your URL back to your page # # will be automatically linked if you specified it # # below. Try and keep the message short. Also, do # # not use any symbols or quotes/apostrophes. # # --font: This is the font you want to use on your thanks message. # # Just type the name of the font, not the size you want. # # Make it an easy to read font because it will not be very # # big. I reccomend using verdana or arial. # # If you leave the field blank, it will be set to Times New # # Roman by default (or whatever the browser's default is). # ##################################################################### $subject = "Form Results"; $thanksmessage = "Thanks for sending us the info. We'll email you with an estimate by tomarrom."; $font = "arial,helvetica,verdana"; ##################################################################### # This is where you edit the header of the output. You can leave # # this as is is, or change it to match the rest of your website. # # ONLY edit HTML between the "quotes." If you are at all worried # # about manually editing HTML, it is STRONGLY reccommended that you # # leave this as it is!! Also, you CAN NOT have ANY "quotes" in your # # HTML code. For example, instead of putting: # #
Site hosted by Angelfire.com: Build your free website today!
# # put: # # # # Putting in quotes ANYWHERE in the HTML will cause an error. # # If you're putting quotes in text, not tags, use the " tag in # # your HTML. # ##################################################################### $header = " NP Form Mail v$version
"; ##################################################################### # This is where you edit the footer of the output. You can leave # # this as is is, or change it to match the rest of your website. # # ONLY edit HTML between the "quotes." If you are at all worried # # about manually editing HTML, it is STRONGLY reccommended that you # # leave this as it is!! Also, you CAN NOT have ANY "quotes" in your # # HTML code. For example, instead of putting: # # # # put: # # # # Putting in quotes ANYWHERE in the HTML will cause an error. # # If you're putting quotes in text, not tags, use the " tag in # # your HTML. # ##################################################################### $footer = "
"; ##################################################################### # Set this to 1 if you would like to have a message sent to the # # person that sent in the form. Set it to 0 if you don't. # # The auto-reply will send whatever message you want, which you will# # define below, and also print out the information that you receive # # if you enable that on the $show variable (below). # # NOTE: In order for this to work, you MUST have an "email" field # # in your form, not "e-mail" or any other spinoff. # ##################################################################### $reply = "0"; ##################################################################### # If you've enabled auto-reply above, this will be the subject of # # the reply email. # ##################################################################### $rsub = "Your Form Submission"; ##################################################################### # If you've enabled auto-reply above, this will be the message in # # the reply email. # ##################################################################### $rmes = "Thank you for submitting your information."; ##################################################################### # Set this variable to equal 1 if you want the script to show the # # user the information they submitted. It will show the entry # # field along with the value they entered, just as you do in the # # email you receive. Set it to 0 if you don't want them to see it. # # # # If this is enabled along with the auto-reply, the user will see # # what they submitted on the thank you page as well as in the reply # # email they receive. # ##################################################################### $show = "1"; ##################################################################### # Set this to 1 if you would like the URL that used the script to # # get sent in the email. This is very useful if you're getting # # spammed from somebody on another server that is either leeching # # off of your script or has put your email address in the email # # field above. # # This will not send the URL to the person who sent the form in if # # you have enabled auto-reply. # ##################################################################### $referer = "0"; ##################################################################### ###################### STOP EDITING VARIABLES ####################### ##################################################################### ##################################################################### ############### I REPEAT: DON'T EDIT ANYTHING BELOW ################# ##################################################################### # interprets data sent by form ############################## print "Content-type:text/html\n\n"; read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } # checks for required fields # the HTML below will be printed # if a field wasn't filled out ################################# foreach $check(@required) { unless ($FORM{$check}) { print <  !!MISSING FIELD!!

Sorry, but one of the required fields wasn't filled out. Please click the back button on your browser and fill in the $check field.

If you feel that this message was in error, you can email the webmaster at $recipient.

Thank You!



Powered by:
-- NP Form Mail v$version --
http://npscripts.hypermart.net

$footer EndHTML ; exit; } } # print email ################ open (MAIL, "|$mailprog -t") or &denice("Can't access $mailprog!\n"); print MAIL "To: $recipient\n"; print MAIL "Reply-to:$FORM{'email'}\n"; print MAIL "Subject: $subject\n\n"; foreach $key (keys(%FORM)) { print MAIL "$key = $FORM{$key}\n";} if ($referer eq "1") {print MAIL "HTTP Referer = $ENV{'HTTP_REFERER'}";} close(MAIL); # prints reply email if wanted ############################## if ($reply eq "1") { open (MAIL, "|$mailprog -t") or &denice("Can't access $mailprog!\n"); print MAIL "To: $FORM{'email'}\n"; print MAIL "Subject: $rsub\n"; print MAIL "$rmes\n"; if ($show eq"1"){ print MAIL "Here is the information you submitted to $recipient:\n"; foreach $key (keys(%FORM)) { print MAIL "$key = $FORM{$key}\n";} } print MAIL "\nPowered by:\n"; print MAIL "NP Form Mail v$version\n"; print MAIL "http://npscripts.hypermart.net\n"; close(MAIL); } # prints thank you HTML page ############################ print <  !!Thank You!!

$thanksmessage

EndHTML ; # prints out variables to page if wanted ######################################## if ($show eq "1") { print "Here's What You Submitted:

"; print ""; foreach $key (sort(keys(%FORM))) { print "$key = $FORM{$key}
";} print "


"; } if ($reply eq "1") { print ""; print "You have also been emailed with the above information to the address you submitted."; print ""; } # finishes page ############### print <

Click here to return to our homepage.

Powered by:
-- NP Form Mail v$version --
http://npscripts.hypermart.net

$footer EndHTML ; # Bad MailProg Message ###################### sub dience { ($errmsg) = @_; print "

ERROR

\n"; print "$errmsg

\n"; print "\n"; exit; }