'Mrs. Bookeeper','accountant@ourcompany.com'=>'Mr. Accountant'); // Static information $RecordType = "6"; // 1 - Constant = 6 $AccountNumLength = "17"; // 2 - Constant = 17 $Filler1 = " "; // 4 - Constant $BankNum = "3037"; // 4 - Constant = 3307 $Filler2 = " "; // 10 - Constant $AccountNum = "12345678901"; // 17 - Constant = ???? $CustDef = " "; // 15 - Space-pad // Column Definitions $checknum_col = 2; $amount_col = 4; $date_col = 1; $payee_col = 3; /////////////////////////////////////////////////// // Get the original and temporary filenames $filename = basename($_FILES['uploadedfile']['name']); $temp_path = $_FILES['uploadedfile']['tmp_name']; // Get info from the form $StatusCode = $_REQUEST[StatusCode]; $AccountNum = $_REQUEST[AccountNum]; $from_email = $_REQUEST[from_email]; $from_name = $contact_email[$from_email]; // Check for empty fields if(!$filename){ // Print out the HTML Header virtual("../../../endhead.inc"); ?>

You didn't enter a file.

Go back

$last_check || $last_check == 0){$last_check = $CheckNum;} $total_amount = $total_amount + (float) $Amount; // Convert Date from mm/dd/YYYY to YYMMDD $date_temp = preg_split("#/#",$Date); $month = str_pad($date_temp[0],2,"0",STR_PAD_LEFT); $day = str_pad($date_temp[1],2,"0",STR_PAD_LEFT); $year = substr($date_temp[2],2,2); $Date = $year . $month . $day; // Build the file $str .= str_pad($RecordType,1); $str .= str_pad($StatusCode,1); $str .= str_pad($AccountNumLength,2); $str .= str_pad($Filler1,4); $str .= str_pad($BankNum,4); $str .= str_pad($$Filler2,10); $str .= str_pad($AccountNum,17,"0",STR_PAD_LEFT); $str .= str_pad($CheckNum,10,"0",STR_PAD_LEFT); $str .= str_pad(preg_replace("/\./","",$Amount),10,"0",STR_PAD_LEFT); $str .= str_pad($Date,6); $str .= str_pad($CustDef,15); $str .= str_pad($Payee, 40); $str .= "\r\n"; } // Build the email to the bank $bank_body .= "====================================================\n\n"; $bank_body .= " Sovereign Bank Customer Issue File Form\n\n"; $bank_body .= "====================================================\n\n"; $bank_body .= "Date: " . date('m/d/Y') . "\n"; $bank_body .= "Company: " . $company_name . "\n"; $bank_body .= "Account Number: " . $AccountNum . "\n"; $bank_body .= "Total Issue Amount: " . $total_amount . "\n"; $bank_body .= "Total Issue Count: " . $total_count . "\n"; $bank_body .= "First Check Number: " . $first_check . "\n"; $bank_body .= "Last Check Number: " . $last_check . "\n\n"; $bank_body .= "Out-of-Balance Contact: $from_name $switchboard_phone\n"; $bank_body .= "Technical Contact: $programmer_name $switchboard_phone\n"; // Do the right thing based on the action selected on the HTML form // Convert only and spit-back the file if($_REQUEST[action] == "convert"){ header('Content-type: text/plain'); header("Content-Disposition: attachment; filename=checkfile.txt"); print "$str"; } // Test - Display the file and the email on-screen if($_REQUEST[action] == "test"){ print "

This is what the file will look like

"; print "
$str
"; print "
"; print "

Email to send to $bank_email

"; print "
$bank_body
"; } // Email everything out as attachments and body text and CC the // person at our company who sent it. // Portions of this code also borrowed from the web and tweaked if($_REQUEST[action] == "email"){ // File Type $fileatt_type = "application/octet-stream"; // Filename that will be used for the file as the attachment $fileatt_name = "riheaa.txt"; // Who the email is from $email_from = $from_email; // The Subject of the email $email_subject = "RIHEAA Customer Issue File"; // Message that the email has in it $email_txt = $bank_body; $email_to = "$bank_email,$from_email,$file_email"; $headers = "From: ".$email_from; $data = $str; $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; $email_message .= "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type:text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $email_message . $email_txt . "\n\n"; $data = chunk_split(base64_encode($data)); $email_message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}--\n"; $ok = @mail($email_to, $email_subject, $email_message, $headers); if($ok) { virtual("../../../endhead.inc"); ?>

The file was successfully sent! Back

Sorry but the email could not be sent. Please go back and try again!