#!/usr/bin/perl
## make sure the path to pearl is correct above. ##

##########################################################################################
##  FILE: bizmail.cgi                                                                   ##
##                                                                                      ##
##  BizMailForm Premium                           Version 3.0.1                         ##
##  ©Copyright 2000-2006+ Seth Michael Knorr      mail@sethknorr.com                    ##
##                                                                                      ##
##                       http://www.bizmailform.com/                                    ##
##         Please contact me with any bugs found, or any bug fixes.                     ##
##                                                                                      ##
##########################################################################################
##                                                                                      ##
##  There is no email support provided for this script, the only support can be         ##
##  found at our web site: http://www.bizmailform.com/                                  ##
##                                                                                      ##
##  REDISTRIBUTION OF ANY KIND IS PROHIBITED WITH OUT THE CONSENT OF SETH KNORR.        ##
##                                                                                      ##
##  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND     ##
##  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED       ##
##  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  ##
##  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,     ##
##  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT  ##
##  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  ##
##  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,   ##
##  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE) ##
##  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          ##
##  POSSIBILITY OF SUCH DAMAGE.                                                         ##
##                                                                                      ##
##########################################################################################


#
#           E N A B L E   H T M L   E M A I L S   &   A T T A C H E M E N T S
#
# To enable HTML emails and auto response file attachments MIME must be installed 
# and working properly on your hosting account. If you are not sure that MIME works 
# with your account check with your hosting company.
#
# ENABLING THIS FEATURE WITHOUT MIME ENABLED WILL CAUSE THE ENTIRE FORM TO NOT WORK!!!
#
# $USE_MIME  = "1"; # ENABLES HTML EMAILS AND ATTACHMENTS 
# $USE_MIME = "2"; # DISABLES HTML EMAILS AND ATTACHMENTS (DEFAULT)
#
	$USE_MIME = "1";


#----- FULL SERVER PATH TO CGI-BIN -----#

##  IF YOU ARE HAVING PROBLEMS RUNNING BIZ MAIL FORM TRY INSERTING THE
##  "ABSOLUTE SERVER PATH" TO YOUR CGI-BIN BELOW... **OTHERWISE LEAVE THIS BLANK, WHICH IS THE DEFAULT.
##  When adding a path you must use a trailing forward slash:
##  ie. /home/www/cgi-bin/
##  You may need to check with your web host or systems admin for this.
##  NOTE: this may be necessary for windows users...

$ABSOLUTE_PATH_TO_CGI_BIN = "";



#----- S E N D M A I L   &   S M T P   S E T T I N G S  -----#

## $useLib defines the method of sending the email auto response and email form info.   ##       
## Set $useLib = "sendmail"; TO USE THE SENDMAIL METHOD
## Set $useLib = "smtp"; TO USE THE SMTP METHOD

$useLib = "sendmail";

## BELOW CONFIGURED IF $useLib = "sendmail"; ##

$mailprog = "/usr/lib/sendmail"; ## $mailprog = path to Sendmail on your server  ##


## BELOW CONFIGURED IF $useLib = "smtp"; ##

$smtp_server = "smtp.yourdomain.com";  ## $smtp_server = smtp server address     ##


#----- F R O M   N A M E   O N   R E P L Y   E M A I L  -----#

##  $reply_from_name =  from name that will apear on the auto response email.  ##

        $reply_from_name = "Full Name";


#----- F R O M   E M A I L   O N   D A T A   R E S U L T S   E M A I L  -----#

# Set $send_from_poster = "1"; To use posters email address as the from email # 
# Set $send_from_poster = "2"; To use $FROM_results_email as the from email   #

	$send_from_poster = "1";

        $FROM_results_email = "you\@yourdomain.com";


#----- S E N D   T O    E M A I L   S E T U P  -----#

## $sendto{"1"} is Where form submissions will be sent,                                 ##
## (REMEMBER THE \ BEFORE THE @ SIGN)                                                   ##
## This is also the reply address used in the auto response email sent to the person    ## 
## filling out the form.                                                                ## 


        $sendto{"1"} = "mail\@yourdomain.com";  ## (REMEMBER THE \ BEFORE THE @ SIGN)##
        $sendto{"2"} = "mail2\@yourdomain.com";
        $sendto{"3"} = "mail3\@yourdomain.com";
        $sendto{"4"} = "mail4\@yourdomain.com";
        $sendto{"5"} = "mail5\@yourdomain.com";



#----- C A R B O N   C O P I E D    E M A I L   S E T U P  -----#

## $cc_to  Is an optional field. If you want to carbon copy form information to a       ##
## second email address, enter a value above. If you do not want to carbon copy the     ##
## form submissions, leave the value blank.                                             ##

        $cc_to{"1"} = "ccmail\@yourdomain.com";
        $cc_to{"2"} = "ccmail2\@yourdomain.com";
        $cc_to{"3"} = "";
        $cc_to{"4"} = "";
        $cc_to{"5"} = "";


#-----  S E T   O K   S U B M I S S I O N   U R L -----#

        $setokurl = "0";

## to use @okurls to verify the url the form is submited by set $setokurl = "1"; and      ##
## set $setokurl = "0"; if you do not want to use @okurls to verfiy form submission URL   ##

## This feature has been updated.  Read the readme file for more information.               ##

        @okurls = ("http://www.yourdomain.com/", "http://yourdomain.com/", "https://yourdomain.com/", "https://www.yourdomain.com/");


#########################################################################
###                                                                   ###
###         O P T I O N A L    V A R I A B L E S    B E L O W         ###
###                                                                   ###
#########################################################################


#----- U S E   P E R S O N A L I Z E D   E R R O R   F O R M   P A G E -----#

## set $use_html_error = "2"; to not use the personalized html form error page template ##
## (DEFAULT) set $use_html_error = "1"; to use the personalized html form error page template ##

$use_html_error = "1";

$HTML_error_page{"1"} = "formerror.html";
$HTML_error_page{"2"} = "";
$HTML_error_page{"3"} = "";
$HTML_error_page{"4"} = "";
$HTML_error_page{"5"} = "";




#----- D E F A U L T   H T M L   E R O R   P A G E   T E M P L A T E  -----#

$MY_error_page = "error.html";   # HTML error page you configured  ##



#----- P R I N T   B L A N K   F I E L D S -----#

## set $PRNT_blankfields = "2"; to not send & leave out blank form field results to your email ##
## (DEFAULT) set $PRNT_blankfields = "1"; to send blank form field results to your email ##

$PRNT_blankfields = "1";


#----- D A T A   F I L E   L O C A T I O N  -----#

## $datafile{"1"} & $datafile{"2"} is the file name of the data file that form data will get sent to.  ##

        $datafile{"1"} = "bizmail.dat";
        $datafile{"2"} = "";
        $datafile{"3"} = "";
        $datafile{"4"} = "";
        $datafile{"5"} = "";

#----- S E N D    R E S U L T S   T O   D A T A   F I L E  -----#

## set $send_data_results = "2"; to not send form results to the data file ##
## (DEFAULT) set $send_data_results = "1"; to send form results to the data file ##

$send_data_results = "1";



#----- S E N D    P L A I N   T E X T   M E S S A G E   F I L E  -----#

## $PLAIN_mes_file{"1"} or $PLAIN_mes_file{"2"} ... Specify the file name of the Plain Text   ##
## Auto-Response email that will be sent if PLAIN TEXT is specified. The message is selected  ##
## by what is inserted into the hidden form field:                                            ##
##                                        ##
## NOTE: If this field is not used in the form the default Plain Text file used is: plain.mes ## 

        $PLAIN_mes_file{"1"} = "plain.mes";
        $PLAIN_mes_file{"2"} = "";
        $PLAIN_mes_file{"3"} = "";
        $PLAIN_mes_file{"4"} = "";
        $PLAIN_mes_file{"5"} = "";


#----- S E N D    H T M L   T E X T   M E S S A G E   F I L E  -----#

## $HTML_mes_file{"1"} or $HTML_mes_file{"2"} ... Specify the file name of the HTML           ##
## Auto-Response email that will be sent if HTML is specified. The message is selected        ##
## by what is inserted into the hidden form field:                                            ##
##                                         ##
## NOTE: If this field is not used in the form the default HTML file used is: html.mes        ## 

        $HTML_mes_file{"1"} = "html.mes";
        $HTML_mes_file{"2"} = "";
        $HTML_mes_file{"3"} = "";
        $HTML_mes_file{"4"} = "";
        $HTML_mes_file{"5"} = "";


#----- S E N D   E M A I L   R E S U L T S   T O   Y O U R   E M A I L  -----#

## set $send_email_results = "2"; to not send form results to your email ##
## (DEFAULT) set $send_email_results = "1"; to send form results to your email ##

$send_email_results = "1";






#----- S E N D   C U S T O M   E M A I L   R E S U L T S   F I L E  -----#

	## $SEND_custom_result = "1"; ## ON
	## $SEND_custom_result = "2"; ## OFF
	
	$SEND_custom_result = "1";

        $CUSTOM_mes_plain{"1"} = "custom.mes";
        $CUSTOM_mes_plain{"2"} = "";
        $CUSTOM_mes_plain{"3"} = "";

        $CUSTOM_mes_html{"1"} = "custom.mes";
        $CUSTOM_mes_html{"2"} = "";
        $CUSTOM_mes_html{"3"} = "";


#----- S E N D   E M A I L   R E S U L T S   T O   C E L L   P H O N E  -----#

	$CELL_mesfile{"1"} = "cell.mes";
	$CELL_mesfile{"2"} = "";
	$CELL_mesfile{"3"} = "";


#----- I G N O R E   D U P L I C A T E   E N T R I E S   I N   D A T A F I L E -----#

##  $delete_dups = "1";  ##  Will delete all duplicates sent to the data file.   ##
##  $delete_dups = "2";  ##  To leave duplicate posts (DEFAULT - MOST COMMON CHOICE)  ## 
##  A duplicate is determined by the email field if this is set for datafile.  ##

	$delete_dups = "2";  # USHUALY, IT IS ONLY SET TO 1 FOR PEOPLE GENERATING LEADS ##



#----- I G N O R E   D U P L I C A T E   E N T R I E S   I N   M Y S Q L -----#

##  $MYSQL_delete_dups = "1";  ##  Will delete all duplicates sent to MYSQL.   ##
##  $MYSQL_delete_dups = "2";  ##  To leave duplicate posts (DEFAULT - MOST COMMON CHOICE)  ## 
##  A duplicate is determined by the hidden form field <input name="check_duplicate">  ##

	$MYSQL_delete_dups = "2";


#-----  F I L E   A T T A C H M E N T -----#


## IF USING A FILE ATTACHMENT YOU MUST CONFIGURE THE BELOW VARIABLES              ##


	## $ATTACHMENT_file{""} EQUALS file name of attachment ##
	## $ATTACHMENT_attributes{""} EQUALS the corresponding attachment path & content type ##

	$ATTACHMENT_file{"1"} = "page.pdf";
	$ATTACHMENT_attributes{"1"} = "1,1";

	$ATTACHMENT_file{"2"} = "page.txt";
	$ATTACHMENT_attributes{"2"} = "2,4";

	$ATTACHMENT_file{"3"} = "page.doc";
	$ATTACHMENT_attributes{"3"} = "3,2";


	##  ATTACHMENT FILE PATHS (WITH TRAILING /)   ##

	$ATTACHMENT_path{"1"} = "/path/to/attachment/";
	$ATTACHMENT_path{"2"} = "/kunden/homepages/23/d88877352/htdocs/sqlform/cgi-bin/sql/";
	$ATTACHMENT_path{"3"} = "/kunden/homepages/23/d88877352/htdocs/sqlform/cgi-bin/sql/";


	##  ATTACHMENT CONTENT-TYPES  ##

	$ATTACHMENT_type{"1"} = "application/pdf";	# PDF DOCUMENT		#
	$ATTACHMENT_type{"2"} = "application/msword";	# MICROSOFT WORD DOC	#
	$ATTACHMENT_type{"3"} = "text/html";		# HTML WEB PAGE		#
	$ATTACHMENT_type{"4"} = "text/plain";		# PLAIN TEXT FILE	#
	$ATTACHMENT_type{"5"} = "image/gif";		# GIF IMAGE		#
	$ATTACHMENT_type{"6"} = "image/jpeg";		# JPEG IMAGE		#
	$ATTACHMENT_type{"7"} = "image/png";		# PNG IMAGE		#
	$ATTACHMENT_type{"8"} = "application/zip";	# ZIP FILE		#
	$ATTACHMENT_type{"9"} = "application/tar";	# TARBALL FILE		#
	$ATTACHMENT_type{"10"} = "video/mpeg";		# MPEG AUDIO		#
	$ATTACHMENT_type{"11"} = "audio/midi";		# MIDI AUDIO		#
	$ATTACHMENT_type{"12"} = "audio/x-wav";		# WAV AUDIO		#
	$ATTACHMENT_type{"13"} = "video/quicktime";	# QUICK TIME AUDIO	#
	$ATTACHMENT_type{"14"} = "audio/basic";		# .au			#
	$ATTACHMENT_type{"15"} = "application/octet-stream"; # .exe EXECUTABLE	#


#----- S E R V E R   T I M E   Z O N E   H O U R   O F F   S E T -----#

## USED IF YOUR SERVER TIME IS FAST OR SLOW.  ##

## TO NOT USE THIS FEATURE SET $HOUR_offset = "0"; (DEFAULT) ##
## ENTER + OR - THE AMOUNT OF HOURS TO OFFSET YOUR SERVERS HOUR BY ##

$HOUR_offset = "0";

	## EXAMPLES:
	## $HOUR_offset = "+1";
	## $HOUR_offset = "-1";



##------- P O S T   F L O O D I N G   S E T U P ----------------##

$set_flood_filter = "1";  ## 1 = ON   AND  0 = OFF ##

$flood_error_page = "flood.html"; ## ERROR PAGE IF FLOODED ##

$flood_data = "flood.dat"; ## FLOOD DATA FILE ##

$set_flood_time = "1"; ## FLOOD TIME IS THE ALOWED AMOUNT OF MINUTES BETWEEN EACH POST##

$max_flood_submit = "5"; ## ALLOWED AMOUNT OF POST IN SET FLOOD TIME ##



##------- B A N N E D   I P' S   S E T U P ----------------##

$set_bannedips = "1"; ## 1 = ON   AND  0 = OFF ##

$banned_error_page = "banned.html"; ## ERROR PAGE IF BANNED ##

        @bannedips = ("10.10.10.001", "10.10.10.002");


## To remove send field data from the "Reserved Field List.txt"

	@REMOVE_RESERVED_fields = ("bcc_to","");

## To remove send field data from the "Reserved Field List.txt"

	@ADD_RESERVED_fields = ("bcc_to","");



###########################################################################
####                                                                    ###
####   N O   N E E D   T O   E D I T  V A R I A B L E S   B E L O W     ###
####                                                                    ###
###########################################################################