function encrypt_payment($method, $card_key_pos = false) { $encrypt = new encryption(); $cc_info = array(); $cc_info['name'] = isset($_POST[$method . '_field_0']) ? db_prepare_input($_POST[$method . '_field_0']) : ''; $cc_info['number'] = isset($_POST[$method . '_field_1']) ? db_prepare_input($_POST[$method . '_field_1']) : ''; $cc_info['exp_mon'] = isset($_POST[$method . '_field_2']) ? db_prepare_input($_POST[$method . '_field_2']) : ''; $cc_info['exp_year'] = isset($_POST[$method . '_field_3']) ? db_prepare_input($_POST[$method . '_field_3']) : ''; $cc_info['cvv2'] = isset($_POST[$method . '_field_4']) ? db_prepare_input($_POST[$method . '_field_4']) : ''; $cc_info['alt1'] = isset($_POST[$method . '_field_5']) ? db_prepare_input($_POST[$method . '_field_5']) : ''; $cc_info['alt2'] = isset($_POST[$method . '_field_6']) ? db_prepare_input($_POST[$method . '_field_6']) : ''; if (!($enc_value = $encrypt->encrypt_cc($cc_info))) { return false; } $payment_array = array('hint' => $enc_value['hint'], 'module' => 'contacts', 'enc_value' => $enc_value['encoded'], 'ref_1' => $this->bill_acct_id, 'ref_2' => $this->bill_address_id, 'exp_date' => $enc_value['exp_date']); db_perform(TABLE_DATA_SECURITY, $payment_array, $this->payment_id ? 'update' : 'insert', 'id = ' . $this->payment_id); return true; }
$crmInfo = new i(); $crmInfo->auto_field = $cInfo->type == 'v' ? 'next_vend_id_num' : 'next_cust_id_num'; $crmInfo->dept_rep_id = $cInfo->id; // error check contact $error = $crmInfo->data_complete($error); if (!$error) { $crmInfo->save_contact(); $crmInfo->save_addres(); } } // payment fields if (ENABLE_ENCRYPTION && $_POST['payment_cc_name'] && $_POST['payment_cc_number']) { // save payment info $encrypt = new encryption(); $cc_info = array('name' => db_prepare_input($_POST['payment_cc_name']), 'number' => db_prepare_input($_POST['payment_cc_number']), 'exp_mon' => db_prepare_input($_POST['payment_exp_month']), 'exp_year' => db_prepare_input($_POST['payment_exp_year']), 'cvv2' => db_prepare_input($_POST['payment_cc_cvv2'])); if ($enc_value = $encrypt->encrypt_cc($cc_info)) { $payment_array = array('hint' => $enc_value['hint'], 'module' => 'contacts', 'enc_value' => $enc_value['encoded'], 'ref_1' => $cInfo->id, 'ref_2' => $cInfo->address[$type . 'm']['address_id'], 'exp_date' => $enc_value['exp_date']); db_perform(TABLE_DATA_SECURITY, $payment_array, $_POST['payment_id'] ? 'update' : 'insert', 'id = ' . $_POST['payment_id']); } else { $error = true; } } // Check attachments $result = $db->Execute("select attachments from " . TABLE_CONTACTS . " where id = {$id}"); $attachments = $result->fields['attachments'] ? unserialize($result->fields['attachments']) : array(); $image_id = 0; while ($image_id < 100) { // up to 100 images if (isset($_POST['rm_attach_' . $image_id])) { @unlink(CONTACTS_DIR_ATTACHMENTS . 'contacts_' . $cInfo->id . '_' . $image_id . '.zip'); unset($attachments[$image_id]);
function encrypt_payment($method) { global $messageStack; $encrypt = new encryption(); $cc_info = array(); $cc_info['name'] = $method['f0']; $cc_info['number'] = $method['f1']; $cc_info['exp_mon'] = $method['f2']; $cc_info['exp_year'] = $method['f3']; $cc_info['cvv2'] = $method['f4']; $cc_info['alt1'] = $method['f5']; $cc_info['alt2'] = $method['f6']; if (!($enc_value = $encrypt->encrypt_cc($cc_info))) { return false; } $payment_array = array('hint' => $enc_value['hint'], 'module' => 'contacts', 'enc_value' => $enc_value['encoded'], 'ref_1' => $this->bill_acct_id, 'ref_2' => $this->bill_address_id, 'exp_date' => $enc_value['exp_date']); db_perform(TABLE_DATA_SECURITY, $payment_array, $this->payment_id ? 'update' : 'insert', 'id = ' . $this->payment_id); return true; }