if (!$_SERVER['HTTPS']) { header ('HTTP/1.1 301 Moved Permanently'); header ("location:https://www.charge.com/fdapp.html"); } include_once ('/home/chargec/includes/lib.php'); $ipLog = "/home/{$GLOBALS['account']}/logs/signup.log"; $blockerror = "Charge.com is unable to process your request at this time. Please try again later."; if (ipBlocker($_SERVER['REMOTE_ADDR'], 15, 3600, $ipLog) && $_SERVER['REMOTE_ADDR'] != '') { echo $blockerror; exit(); } // block this ip for malicious actions if($_SERVER['REMOTE_ADDR'] == '62.210.141.31'){ exit; } function validate_post(){ // trim and map to new array $trimmed_post = array_map('trim', $_POST); $field_list = array('Legal_business_name','DBA','Email_address','Business_phone_number','Business_fax_number', 'Business_street_address','Business_city','Business_state','Business_zip','Website_address', 'Number_of_employees','Business_location','First_name','Last_name','Title','Ownership_%','DOB_Month', 'DOB_Day','DOB_Year','Social_Security_Number','Drivers_license_number','State_issued','DL_Month','DL_Day', 'DL_Year','Home_phone','Home_address','Home_city','Home_state','Home_zip','Describe_products_and_services_sold_in_detail', 'Estimated_monthly_credit_card_sales_volume','Estimated_average_individual_credit_card_transaction_size', 'Estimated_highest_credit_card_sale_amount','Refund_Policy','Business_Structure','Month_formed','Year_formed', 'Name_of_processor','Terminal','Imprint','Mail-phone-fax_order','Internet','0-7_days','8-14_days', '15-30_days','Over_30_days','Federal_Tax_ID_Number','Bank_Name','Bank_Account_Number','Bank_Routing_Number'); $result = array('fatal_error' => FALSE, 'errors' => array()); // first check to see if all fields are present foreach($field_list as $field){ if(!isset($trimmed_post[$field])){ $result['fatal_error'] = TRUE; $result['errors'][] = "Missing form field: {$field}"; } } if($result['fatal_error'] === TRUE){ // fatal, get out now! return $result; } $non_required_fields = array('DBA', 'Business_fax_number', 'Website_address', 'Name_of_processor', 'Terminal', 'Imprint', 'Mail-phone-fax_order', 'Internet', '0-7_days', '8-14_days', '15-30_days', 'Over_30_days'); // validate email if(!filter_var($trimmed_post['Email_address'], FILTER_VALIDATE_EMAIL)) { $result['errors'][] = 'Email_address'; } $num_fields = array('Estimated_average_individual_credit_card_transaction_size','Estimated_highest_credit_card_sale_amount', 'Terminal','Imprint','Mail-phone-fax_order','Internet','0-7_days','8-14_days','15-30_days','Over_30_days', 'Number_of_employees','Ownership_%','DOB_Month','DOB_Day','DOB_Year','DL_Month','DL_Day','DL_Year', 'Estimated_monthly_credit_card_sales_volume','Month_formed','Year_formed','Estimated_monthly_credit_card_sales_volume'); foreach($num_fields as $field){ if(strlen($trimmed_post[$field]) > 0 && filter_var($trimmed_post[$field], FILTER_VALIDATE_FLOAT) === FALSE) { $result['errors'][] = $field; } } $phone_fields = array('Business_phone_number','Business_fax_number','Home_phone'); foreach($phone_fields as $field){ if(!in_array($field, $non_required_fields) || strlen($trimmed_post[$field]) > 0){ $stripped_phone = preg_replace("/[^0-9]/", '', $trimmed_post[$field]); if($stripped_phone[0] == '1'){ // remove leading 1 $stripped_phone = substr($stripped_phone, 1); } if(strlen($stripped_phone) != 10){ $result['errors'][] = $field; } } } $nine_digit_fields = array('Bank_Routing_Number','Federal_Tax_ID_Number', 'Social_Security_Number'); foreach($nine_digit_fields as $field){ if(!in_array($field, $non_required_fields) || strlen($trimmed_post[$field]) > 0){ $stripped_field = preg_replace("/[^0-9]/", '', $trimmed_post[$field]); if(strlen($stripped_field) != 9){ $result['errors'][] = $field; } } } $zip_fields = array('Business_zip','Home_zip'); foreach($zip_fields as $field){ if(!preg_match('/(^\d{5}$)|(^\d{5}-\d{4}$)/', $trimmed_post[$field])){ $result['errors'][] = $field; } } $required_text_fields = array('Legal_business_name','Business_street_address','Business_city','Business_state', 'Business_location','First_name','Last_name','Title','State_issued','Home_address', 'Home_city','Home_state','Describe_products_and_services_sold_in_detail', 'Refund_Policy','Business_Structure','Bank_Name','Bank_Account_Number'); foreach($required_text_fields as $field){ if(strlen($trimmed_post[$field]) < 1){ $result['errors'][] = $field; } } return $result; } $stArr = array (''=>'—Select—', 'AL'=>'Alabama','AK'=>'Alaska', 'AZ'=>'Arizona','AR'=>'Arkansas', 'CA'=>'California','CO'=>'Colorado', 'CT'=>'Connecticut','DE'=>'Delaware', 'DC'=>'District of Columbia','FL'=>'Florida', 'GA'=>'Georgia','HI'=>'Hawaii','ID'=>'Idaho', 'IL'=>'Illinois','IN'=>'Indiana','IA'=>'Iowa', 'KS'=>'Kansas','KY'=>'Kentucky','LA'=>'Louisiana', 'ME'=>'Maine','MD'=>'Maryland','MA'=>'Massachusetts', 'MI'=>'Michigan','MN'=>'Minnesota','MS'=>'Mississippi', 'MO'=>'Missouri','MT'=>'Montana','NE'=>'Nebraska', 'NV'=>'Nevada','NH'=>'New Hampshire','NJ'=>'New Jersey', 'NM'=>'New Mexico','NY'=>'New York','NC'=>'North Carolina', 'ND'=>'North Dakota','OH'=>'Ohio','OK'=>'Oklahoma', 'OR'=>'Oregon','PA'=>'Pennsylvania','RI'=>'Rhode Island', 'SC'=>'South Carolina','SD'=>'South Dakota','TN'=>'Tennessee', 'TX'=>'Texas','UT'=>'Utah','VT'=>'Vermont','VA'=>'Virginia', 'WA'=>'Washington','WV'=>'West Virginia','WI'=>'Wisconsin','WY'=>'Wyoming'); if ($_POST) { array_pop ($_POST); $validation_result = validate_post(); if($validation_result['fatal_error'] === TRUE){ say("Fatal error: ".print_r($validation_result['errors'], TRUE)); exit; } if(empty($validation_result['errors'])){ $_POST['Submitted_from'] = $_SERVER['REMOTE_ADDR']; foreach ($_POST as $k => $v) { $sanatized_key = filter_var($k, FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES); $sanatized_value = filter_var($v, FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES); $bg = ($i%2)?'#ccc':'#fff'; $body[] = "
Dear =$_POST['First_name']?> =$_POST['Last_name']?>,
Thank you for choosing Charge.com for your credit card processing needs. We will contact you shortly regarding the status of your account.
We look forward to serving you and your business.
Warm regards,
Congratulations! You are on your way to increasing your sales and profits by accepting credit cards for your business.
For your privacy and security, your account information is kept safe with the highest grade of commercially available encryption. Your information will be kept completely confidential and will not be shared with anyone.
In order to complete the setup and activation process and start accepting credit cards from your customers, please provide us with the information requested below.
Required items are marked with (*)