foreach ($TREATMENT as $entry) { $treatment_type .= $entry . "|"; $flag = 1; } if ($flag == 1) { $treatment_type = rtrim($treatment_type); } //PAIN_WORSE check box $PAIN_WORSE = $_POST['PAIN_WORSE']; $PAIN_WORSE_LIST = ""; $flag = 0; foreach ($PAIN_WORSE as $entry) { $PAIN_WORSE_LIST .= $entry . "|"; $flag = 1; } if ($flag == 1) { $PAIN_WORSE_LIST = rtrim($PAIN_WORSE_LIST); } //DISCOMFORT check box $DISCOMFORT = $_POST['DISCOMFORT']; $DISCOMFORT_LIST = ""; $flag = 0; foreach ($DISCOMFORT as $entry) { $DISCOMFORT_LIST .= $entry . "|"; $flag = 1; } if ($flag == 1) { $DISCOMFORT_LIST = rtrim($DISCOMFORT_LIST); } $db->exec("INSERT INTO grandview_new_patients (\n\t\tFIRST_NAME, \n\t\tLAST_NAME, \n\t\tPHONE,\n\t\tCELL_PHONE, \n\t\tADDRESS, \n\t\tCITY, \n\t\tSTATE, \n\t\tZIP, \n\t\tDOB, \n\t\tGENDER, \n\t\tSSN, \n\t\tEMPLOYER, \n\t\tWORK_PHONE,\n\t\tEMPLOYER_ADDRESS, \n\t\tEMPLOYER_CITY, \n\t\tEMPLOYER_STATE, \n\t\tEMPLOYER_ZIP, \n\t\tREFERRING_PHYSICIAN, \n\t\tPHYSICIAN_ADDRESS, \n\t\tPHYSICIAN_CITY, \n\t\tPHYSICIAN_STATE, \n\t\tPHYSICIAN_ZIP, \n\t\tPHYSICIAN_PHONE, \n\t\tSPOUSE_NAME,\n\t\tSPOUSE_EMPLOYER, \n\t\tSPOUSE_HOME_PHONE, \n\t\tSPOUSE_WORK_PHONE, \n\t\tSPOUSE_DOB, \n\t\tMOTHER_FIRST, \n\t\tMOTHER_LAST, \n\t\tMOTHER_ADDRESS, \n\t\tMOTHER_CITY, \n\t\tMOTHER_STATE, \n\t\tMOTHER_ZIP, \n\t\tMOTHER_DOB, \n\t\tMOTHER_EMPLOYER, \n\t\tMOTHER_EMPLOYER_ADDRESS, \n\t\tMOTHER_EMPLOYER_CITY, \n\t\tMOTHER_EMPLOYER_STATE, \n\t\tMOTHER_EMPLOYER_ZIP, \n\t\tMOTHER_EMPLOYER_PHONE, \n\t\tFATHER_FIRST, \n\t\tFATHER_LAST, \n\t\tFATHER_ADDRESS, \n\t\tFATHER_CITY, \n\t\tFATHER_STATE, \n\t\tFATHER_ZIP, \n\t\tFATHER_DOB, \n\t\tFATHER_EMPLOYER, \n\t\tFATHER_EMPLOYER_ADDRESS, \n\t\tFATHER_EMPLOYER_CITY, \n\t\tFATHER_EMPLOYER_STATE, \n\t\tFATHER_EMPLOYER_ZIP, \n\t\tFATHER_EMPLOYER_PHONE, \n\t\tPRIMARY_INSURANCE_NAME, \n\t\tINSURANCE_PHONE,\n\t\tPRIMARY_INSURANCE_ADDRESS, \n\t\tPRIMARY_INSURANCE_CITY, \n\t\tPRIMARY_INSURANCE_STATE, \n\t\tPRIMARY_INSURANCE_ZIP, \n\t\tPI_SUBSCRIBER_FIRST, \n\t\tPI_SUBSCRIBER_LAST, \n\t\tPI_SUBSCRIBER_ID, \n\t\tPI_SUBSCRIBER_GROUP_NUMBER, \n\t\tPI_SUBSCRIBER_DOB,\n\t\tPI_SUBSCRIBER_SSN, \n\t\tSECONDARY_INSURANCE_NAME, \n\t\tSECONDARY_INSURANCE_PHONE,\n\t\tSECONDARY_INSURANCE_ADDRESS, \n\t\tSECONDARY_INSURANCE_CITY, \n\t\tSECONDARY_INSURANCE_STATE, \n\t\tSECONDARY_INSURANCE_ZIP, \n\t\tSI_SUBSCRIBER_FIRST, \n\t\tSI_SUBSCRIBER_LAST, \n\t\tSI_SUBSCRIBER_ID, \n\t\tSI_SUBSCRIBER_GROUP_NUMBER, \n\t\tSI_SUBSCRIBER_DOB, \n\t\tSI_SUBSCRIBER_SSN,\n\t\tNEED_TREATMENT_FOR, \n\t\tDATE_OF_INJURY, \n\t\tCLAIM_NUMBER, \n\t\tEMERGENCY_CONTACT_FIRST, \n\t\tEMERGENCY_CONTACT_LAST, \n\t\tEMERGENCY_CONTACT_PHONE, \n\t\tPI_SUBSCRIBER_EMPLOYER, \n\t\tSI_SUBSCRIBER_EMPLOYER,\n\t\tSIGNATURE,\n\t\tTODAY_DATE,\n\t\tROI,\n\t\tROI_PERSON_1_FIRST, \n\t\tROI_PERSON_1_LAST, \n\t\tROI_PERSON_1_RELATIONSHIP, \n\t\tROI_PERSON_2_FIRST, \n\t\tROI_PERSON_2_LAST, \n\t\tROI_PERSON_2_RELATIONSHIP, \n\t\tROI_PERSON_3_FIRST, \n\t\tROI_PERSON_3_LAST, \n\t\tROI_PERSON_3_RELATIONSHIP,\n\t\tAUTH,\n\t\tOVER_18,\n\t\tINJURY,\n\t\tINJURY_HOW,\n\t\tINJURY_START,\n\t\tWORK_TYPE,\n\t\tWORKING_NOW,\n\t\tNOT_WORKING_REASON,\n\t\tSYMPTOM_FREE,\n\t\tSIMILAR_SYMPTOM,\n\t\tTREATMENT,\n\t\tEASE_PAIN,\n\t\tPAIN_WORSE,\n\t\tPINS_NEEDLES,\n\t\tOTHER_PROBLEMS,\n\t\tMEDICATIONS,\n\t\tMEDICATION_LIST,\n\t\tDISCOMFORT) \n\t\tVALUES ('" . $escaped_values["FIRST_NAME"] . "',\n\t\t'" . $escaped_values["LAST_NAME"] . "' , \n\t\t'(" . $escaped_values["PHONE_1"] . ") " . $escaped_values["PHONE_2"] . "-" . $escaped_values["PHONE_3"] . "',\n\t\t'(" . $escaped_values["CELL_PHONE_1"] . ") " . $escaped_values["CELL_PHONE_2"] . "-" . $escaped_values["CELL_PHONE_3"] . "',\n\t\t'" . $escaped_values["ADDRESS_1"] . " " . $escaped_values["ADDRESS_2"] . "',\n\t\t'" . $escaped_values["CITY"] . "',\n\t\t'" . $escaped_values["STATE"] . "',\n\t\t'" . $escaped_values["ZIP"] . "',\n\t\t'" . encrypt_text($escaped_values["DOB_1"] . "/" . $escaped_values["DOB_2"] . "/" . $escaped_values["DOB_3"], $key1, $key2) . "',\n\t\t'" . $escaped_values["GENDER"] . "',\n\t\t'" . encrypt_text($escaped_values["SSN"], $key1, $key2) . "',\n\t\t'" . $escaped_values["EMPLOYER"] . "',\n\t\t'(" . $escaped_values["WORK_PHONE_1"] . ") " . $escaped_values["WORK_PHONE_2"] . "-" . $escaped_values["WORK_PHONE_3"] . "',\n\t\t'" . $escaped_values["EMPLOYER_ADDRESS_1"] . " " . $escaped_values["EMPLOYER_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["EMPLOYER_CITY"] . "',\n\t\t'" . $escaped_values["EMPLOYER_STATE"] . "',\n\t\t'" . $escaped_values["EMPLOYER_ZIP"] . "',\n\t\t'" . $escaped_values["REFERRING_PHYSICIAN"] . "',\n\t\t'" . $escaped_values["PHYSICIAN_ADDRESS_1"] . " " . $escaped_values["PHYSICIAN_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["PHYSICIAN_CITY"] . "',\n\t\t'" . $escaped_values["PHYSICIAN_STATE"] . "'\n\t\t,'" . $escaped_values["PHYSICIAN_ZIP"] . "',\n\t\t'(" . $escaped_values["PHYSICIAN_PHONE_1"] . ") " . $escaped_values["PHYSICIAN_PHONE_2"] . "-" . $escaped_values["PHYSICIAN_PHONE_3"] . "',\n\t\t'" . $escaped_values["SPOUSE_FIRST"] . " " . $escaped_values["SPOUSE_LAST"] . "',\n\t\t'" . $escaped_values["SPOUSE_EMPLOYER"] . "',\n\t\t'(" . $escaped_values["SPOUSE_HOME_PHONE_1"] . ") " . $escaped_values["SPOUSE_HOME_PHONE_2"] . "-" . $escaped_values["SPOUSE_HOME_PHONE_3"] . "',\n\t\t'(" . $escaped_values["SPOUSE_WORK_PHONE_1"] . ") " . $escaped_values["SPOUSE_WORK_PHONE_2"] . "-" . $escaped_values["SPOUSE_WORK_PHONE_3"] . "',\n\t\t'" . encrypt_text($escaped_values["SPOUSE_DOB_1"] . "/" . $escaped_values["SPOUSE_DOB_2"] . "/" . $escaped_values["SPOUSE_DOB_3"], $key1, $key2) . "',\n\t\t'" . $escaped_values["MOTHER_FIRST"] . "',\n\t\t'" . $escaped_values["MOTHER_LAST"] . "',\n\t\t'" . $escaped_values["MOTHER_ADDRESS_1"] . " " . $escaped_values["MOTHER_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["MOTHER_CITY"] . "',\n\t\t'" . $escaped_values["MOTHER_STATE"] . "',\n\t\t'" . $escaped_values["MOTHER_ZIP"] . "',\n\t\t'" . encrypt_text($escaped_values["MOTHER_DOB_1"] . "/" . $escaped_values["MOTHER_DOB_2"] . "/" . $escaped_values["MOTHER_DOB_3"], $key1, $key2) . "',\n\t\t'" . $escaped_values["MOTHER_EMPLOYER"] . "',\n\t\t'" . $escaped_values["MOTHER_EMPLOYER_ADDRESS_1"] . " " . $escaped_values["MOTHER_EMPLOYER_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["MOTHER_EMPLOYER_CITY"] . "',\n\t\t'" . $escaped_values["MOTHER_EMPLOYER_STATE"] . "',\n\t\t'" . $escaped_values["MOTHER_EMPLOYER_ZIP"] . "',\n\t\t'(" . $escaped_values["MOTHER_EMPLOYER_PHONE_1"] . ") " . $escaped_values["MOTHER_EMPLOYER_PHONE_2"] . "-" . $escaped_values["MOTHER_EMPLOYER_PHONE_3"] . "',\n\t\t'" . $escaped_values["FATHER_FIRST"] . "',\n\t\t'" . $escaped_values["FATHER_LAST"] . "',\n\t\t'" . $escaped_values["FATHER_ADDRESS_1"] . " " . $escaped_values["FATHER_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["FATHER_CITY"] . "',\n\t\t'" . $escaped_values["FATHER_STATE"] . "',\n\t\t'" . $escaped_values["FATHER_ZIP"] . "',\n\t\t'" . encrypt_text($escaped_values["FATHER_DOB_1"] . "/" . $escaped_values["FATHER_DOB_2"] . "/" . $escaped_values["FATHER_DOB_3"], $key1, $key2) . "',\n\t\t'" . $escaped_values["FATHER_EMPLOYER"] . "',\n\t\t'" . $escaped_values["FATHER_EMPLOYER_ADDRESS_1"] . " " . $escaped_values["FATHER_EMPLOYER_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["FATHER_EMPLOYER_CITY"] . "',\n\t\t'" . $escaped_values["FATHER_EMPLOYER_STATE"] . "',\n\t\t'" . $escaped_values["FATHER_EMPLOYER_ZIP"] . "',\n\t\t'(" . $escaped_values["FATHER_EMPLOYER_PHONE_1"] . ") " . $escaped_values["FATHER_EMPLOYER_PHONE_2"] . "-" . $escaped_values["FATHER_EMPLOYER_PHONE_3"] . "',\n\t\t'" . $escaped_values["PRIMARY_INSURANCE_NAME"] . "',\n\t\t'(" . $escaped_values["INSURANCE_PHONE_1"] . ") " . $escaped_values["INSURANCE_PHONE_2"] . "-" . $escaped_values["INSURANCE_PHONE_3"] . "',\n\t\t'" . $escaped_values["PRIMARY_INSURANCE_ADDRESS_1"] . " " . $escaped_values["PRIMARY_INSURANCE_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["PRIMARY_INSURANCE_CITY"] . "',\n\t\t'" . $escaped_values["PRIMARY_INSURANCE_STATE"] . "',\n\t\t'" . $escaped_values["PRIMARY_INSURANCE_ZIP"] . "',\n\t\t'" . $escaped_values["PI_SUBSCRIBER_FIRST"] . "',\n\t\t'" . $escaped_values["PI_SUBSCRIBER_LAST"] . "',\n\t\t'" . encrypt_text($escaped_values["PI_SUBSCRIBER_ID"], $key1, $key2) . "',\n\t\t'" . $escaped_values["PI_SUBSCRIBER_GROUP_NUMBER"] . "',\n\t\t'" . encrypt_text($escaped_values["PI_SUBSCRIBER_DOB_1"] . "/" . $escaped_values["PI_SUBSCRIBER_DOB_2"] . "/" . $escaped_values["PI_SUBSCRIBER_DOB_3"], $key1, $key2) . "',\n\t\t'" . encrypt_text($escaped_values["PI_SUBSCRIBER_SSN"], $key1, $key2) . "',\n\t\t'" . $escaped_values["SECONDARY_INSURANCE_NAME"] . "',\n\t\t'(" . $escaped_values["SECONDARY_INSURANCE_PHONE_1"] . ") " . $escaped_values["SECONDARY_INSURANCE_PHONE_2"] . "-" . $escaped_values["SECONDARY_INSURANCE_PHONE_3"] . "',\n\t\t'" . $escaped_values["SECONDARY_INSURANCE_ADDRESS_1"] . " " . $escaped_values["SECONDARY_INSURANCE_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["SECONDARY_INSURANCE_CITY"] . "',\n\t\t'" . $escaped_values["SECONDARY_INSURANCE_STATE"] . "',\n\t\t'" . $escaped_values["SECONDARY_INSURANCE_ZIP"] . "',\n\t\t'" . $escaped_values["SI_SUBSCRIBER_FIRST"] . "',\n\t\t'" . $escaped_values["SI_SUBSCRIBER_LAST"] . "',\n\t\t'" . encrypt_text($escaped_values["SI_SUBSCRIBER_ID"], $key1, $key2) . "',\n\t\t'" . $escaped_values["SI_SUBSCRIBER_GROUP_NUMBER"] . "',\n\t\t'" . encrypt_text($escaped_values["SI_SUBSCRIBER_DOB_1"] . "/" . $escaped_values["SI_SUBSCRIBER_DOB_2"] . "/" . $escaped_values["SI_SUBSCRIBER_DOB_3"], $key1, $key2) . "',\n\t\t'" . encrypt_text($escaped_values["SI_SUBSCRIBER_SSN"], $key1, $key2) . "',\n\t\t'" . $escaped_values["NEED_TREATMENT_FOR"] . "',\n\t\t'" . $escaped_values["DATE_OF_INJURY_1"] . "/" . $escaped_values["DATE_OF_INJURY_2"] . "/" . $escaped_values["DATE_OF_INJURY_3"] . "',\n\t\t'" . encrypt_text($escaped_values["CLAIM_NUMBER"], $key1, $key2) . "',\n\t\t'" . $escaped_values["EMERGENCY_CONTACT_FIRST"] . "',\n\t\t'" . $escaped_values["EMERGENCY_CONTACT_LAST"] . "',\n\t\t'(" . $escaped_values["EMERGENCY_CONTACT_PHONE_1"] . ") " . $escaped_values["EMERGENCY_CONTACT_PHONE_2"] . "-" . $escaped_values["EMERGENCY_CONTACT_PHONE_3"] . "',\n\t\t'" . $escaped_values["PI_SUBSCRIBER_EMPLOYER"] . "',\n\t\t'" . $escaped_values["SI_SUBSCRIBER_EMPLOYER"] . "',\n\t\t'" . $escaped_values["SIGNATURE"] . "',\n\t\t'" . $escaped_values["TODAY_DATE_1"] . "/" . $escaped_values["TODAY_DATE_2"] . "/" . $escaped_values["TODAY_DATE_3"] . "',\n\t\t'" . $escaped_values["ROI"] . "',\n\t\t'" . $escaped_values["ROI_PERSON_1_FIRST"] . "',\n\t\t'" . $escaped_values["ROI_PERSON_1_LAST"] . "',\n\t\t'" . $escaped_values["ROI_PERSON_1_RELATIONSHIP"] . "',\n\t\t'" . $escaped_values["ROI_PERSON_2_FIRST"] . "',\n\t\t'" . $escaped_values["ROI_PERSON_2_LAST"] . "',\n\t\t'" . $escaped_values["ROI_PERSON_2_RELATIONSHIP"] . "',\n\t\t'" . $escaped_values["ROI_PERSON_3_FIRST"] . "',\n\t\t'" . $escaped_values["ROI_PERSON_3_LAST"] . "',\n\t\t'" . $escaped_values["ROI_PERSON_3_RELATIONSHIP"] . "',\n\t\t'" . $rand_code . "',\n\t\t'" . $escaped_values["OVER_18"] . "',\n\t\t'" . $escaped_values["INJURY"] . "',\n\t\t'" . $escaped_values["INJURY_HOW"] . "',\n\t\t'" . $escaped_values["INJURY_START"] . "',\n\t\t'" . $escaped_values["WORK_TYPE"] . "',\n\t\t'" . $escaped_values["WORKING_NOW"] . "',\n\t\t'" . $escaped_values["NOT_WORKING_REASON"] . "',\n\t\t'" . $escaped_values["SYMPTOM_FREE"] . "',\n\t\t'" . $escaped_values["SIMILAR_SYMPTOM"] . "',\n\t\t'" . $treatment_type . "',\n\t\t'" . $EASE_PAIN_LIST . "',\n\t\t'" . $PAIN_WORSE_LIST . "',\n\t\t'" . $escaped_values["PINS_NEEDLES"] . "',\n\t\t'" . $escaped_values["OTHER_PROBLEMS"] . "',\n\t\t'" . $escaped_values["MEDICATIONS"] . "',\n\t\t'" . $escaped_values["MEDICATION_LIST"] . "',\n\t\t'" . $DISCOMFORT_LIST . "')"); }
} function encrypt_text($value, $key1, $key2) { if (!$value || !$key1 || !$key2) { return false; } $crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key1, $value, MCRYPT_MODE_ECB, $key2); return trim(base64_encode($crypttext)); } function decrypt_text($value, $key1, $key2) { if (!$value || !$key1 || !$key2) { return false; } $crypttext = base64_decode($value); $decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key1, $crypttext, MCRYPT_MODE_ECB, $key2); return trim($decrypttext); } $rand_code = rand(); //var_dump( $_POST ); //exit; $escaped_values = array(); foreach ($_POST as $field => $answer) { $escaped_values[$field] = SQLite3::escapeString($answer); } $db->exec("INSERT INTO kennewick_new_patients (FIRST_NAME, LAST_NAME, CELL_PHONE, HOME_PHONE, EMAIL, ADDRESS, CITY, STATE, ZIP, DOB, GENDER, SSN, STUDENT, EMPLOYER, EMPLOYER_ADDRESS, EMPLOYER_CITY, EMPLOYER_STATE, EMPLOYER_ZIP, WORK_PHONE, REFERRING_PHYSICIAN, PHYSICIAN_ADDRESS, PHYSICIAN_CITY, PHYSICIAN_STATE, PHYSICIAN_ZIP, PHYSICIAN_PHONE, SPOUSE_EMPLOYER, SPOUSE_CELL_PHONE, SPOUSE_WORK_PHONE, MOTHER_FIRST, MOTHER_LAST, MOTHER_ADDRESS, MOTHER_CITY, MOTHER_STATE, MOTHER_ZIP, MOTHER_EMPLOYER, MOTHER_EMPLOYER_ADDRESS, MOTHER_EMPLOYER_CITY, MOTHER_EMPLOYER_STATE, MOTHER_EMPLOYER_ZIP, MOTHER_EMPLOYER_PHONE, FATHER_FIRST, FATHER_LAST, FATHER_ADDRESS, FATHER_CITY, FATHER_STATE, FATHER_ZIP, FATHER_EMPLOYER, FATHER_EMPLOYER_ADDRESS, FATHER_EMPLOYER_CITY, FATHER_EMPLOYER_STATE, FATHER_EMPLOYER_ZIP, FATHER_EMPLOYER_PHONE, EMERGENCY_CONTACT_FIRST, EMERGENCY_CONTACT_LAST, EMERGENCY_CONTACT_PHONE, SIGNIATURE, TODAY_DATE, ROI_PERSON_1_FIRST, ROI_PERSON_1_LAST, ROI_PERSON_1_RELATIONSHIP, ROI_PERSON_2_FIRST, ROI_PERSON_2_LAST, ROI_PERSON_2_RELATIONSHIP, ROI_SIGNIATURE, ROI_DATE, SPOUSE_FIRST, SPOUSE_LAST, MOTHER_DOB, FATHER_DOB, ROI, AUTH) VALUES ('" . $escaped_values["FIRST_NAME"] . "','" . $escaped_values["LAST_NAME"] . "' , '(" . $escaped_values["CELL_PHONE_1"] . ")" . $escaped_values["CELL_PHONE_2"] . "-" . $escaped_values["CELL_PHONE_3"] . "','(" . $escaped_values["HOME_PHONE_1"] . ")" . $escaped_values["HOME_PHONE_2"] . "-" . $escaped_values["HOME_PHONE_3"] . "','" . $escaped_values["EMAIL"] . "','" . $escaped_values["ADDRESS_1"] . " " . $escaped_values["ADDRESS_2"] . "','" . $escaped_values["CITY"] . "','" . $escaped_values["STATE"] . "','" . $escaped_values["ZIP"] . "','" . encrypt_text($escaped_values["DOB_1"] . "/" . $escaped_values["DOB_2"] . "/" . $escaped_values["DOB_3"], $key1, $key2) . "','" . $escaped_values["GENDER"] . "','" . encrypt_text($escaped_values["SSN"], $key1, $key2) . "','" . $escaped_values["STUDENT"] . "','" . $escaped_values["EMPLOYER"] . "','" . $escaped_values["EMPLOYER_ADDRESS_1"] . " " . $escaped_values["EMPLOYER_ADDRESS_2"] . "','" . $escaped_values["EMPLOYER_CITY"] . "','" . $escaped_values["EMPLOYER_STATE"] . "','" . $escaped_values["EMPLOYER_ZIP"] . "','(" . $escaped_values["WORK_PHONE_1"] . ")" . $escaped_values["WORK_PHONE_2"] . "-" . $escaped_values["WORK_PHONE_3"] . "','" . $escaped_values["PHYSICIAN_FIRST"] . " " . $escaped_values["PHYSICIAN_LAST"] . "','" . $escaped_values["PHYSICIAN_ADDRESS_1"] . " " . $escaped_values["PHYSICIAN_ADDRESS_2"] . "','" . $escaped_values["PHYSICIAN_CITY"] . "','" . $escaped_values["PHYSICIAN_STATE"] . "','" . $escaped_values["PHYSICIAN_ZIP"] . "','(" . $escaped_values["PHYSICIAN_PHONE_1"] . ")" . $escaped_values["PHYSICIAN_PHONE_2"] . "-" . $escaped_values["PHYSICIAN_PHONE_3"] . "','" . $escaped_values["SPOUSE_EMPLOYER"] . "','(" . $escaped_values["SPOUSE_CELL_PHONE_1"] . ")" . $escaped_values["SPOUSE_CELL_PHONE_2"] . "-" . $escaped_values["SPOUSE_CELL_PHONE_3"] . "','(" . $escaped_values["SPOUSE_WORK_PHONE_1"] . ")" . $escaped_values["SPOUSE_WORK_PHONE_2"] . "-" . $escaped_values["SPOUSE_WORK_PHONE_3"] . "','" . $escaped_values["MOTHER_FIRST"] . "','" . $escaped_values["MOTHER_LAST"] . "','" . $escaped_values["MOTHER_ADDRESS_1"] . " " . $escaped_values["MOTHER_ADDRESS_2"] . "','" . $escaped_values["MOTHER_CITY"] . "','" . $escaped_values["MOTHER_STATE"] . "','" . $escaped_values["MOTHER_ZIP"] . "','" . $escaped_values["MOTHER_EMPLOYER"] . "','" . $escaped_values["MOTHER_EMPLOYER_ADDRESS_1"] . " " . $escaped_values["MOTHER_EMPLOYER_ADDRESS_2"] . "','" . $escaped_values["MOTHER_EMPLOYER_CITY"] . "','" . $escaped_values["MOTHER_EMPLOYER_STATE"] . "','" . $escaped_values["MOTHER_EMPLOYER_ZIP"] . "','(" . $escaped_values["MOTHER_WORK_PHONE_1"] . ")" . $escaped_values["MOTHER_WORK_PHONE_2"] . "-" . $escaped_values["MOTHER_WORK_PHONE_3"] . "','" . $escaped_values["FATHER_FIRST"] . "','" . $escaped_values["FATHER_LAST"] . "','" . $escaped_values["FATHER_ADDRESS_1"] . " " . $escaped_values["FATHER_ADDRESS_2"] . "','" . $escaped_values["FATHER_CITY"] . "','" . $escaped_values["FATHER_STATE"] . "','" . $escaped_values["FATHER_ZIP"] . "','" . $escaped_values["FATHER_EMPLOYER"] . "','" . $escaped_values["FATHER_EMPLOYER_ADDRESS_1"] . " " . $escaped_values["FATHER_EMPLOYER_ADDRESS_2"] . "','" . $escaped_values["FATHER_EMPLOYER_CITY"] . "','" . $escaped_values["FATHER_EMPLOYER_STATE"] . "','" . $escaped_values["FATHER_EMPLOYER_ZIP"] . "','(" . $escaped_values["FATHER_WORK_PHONE_1"] . ")" . $escaped_values["FATHER_WORK_PHONE_2"] . "-" . $escaped_values["FATHER_WORK_PHONE_3"] . "','" . $escaped_values["EMERGENCY_CONTACT_FIRST"] . "','" . $escaped_values["EMERGENCY_CONTACT_LAST"] . "','(" . $escaped_values["EMERGENCY_CONTACT_PHONE_1"] . ")" . $escaped_values["EMERGENCY_CONTACT_PHONE_2"] . "-" . $escaped_values["EMERGENCY_CONTACT_PHONE_3"] . "','" . $escaped_values["SIGNIATURE"] . "','" . $escaped_values["TODAY_DATE_1"] . "/" . $escaped_values["TODAY_DATE_2"] . "/" . $escaped_values["TODAY_DATE_3"] . "','" . $escaped_values["ROI_PERSON_1_FIRST"] . "','" . $escaped_values["ROI_PERSON_1_LAST"] . "','" . $escaped_values["ROI_PERSON_1_RELATIONSHIP"] . "','" . $escaped_values["ROI_PERSON_2_FIRST"] . "','" . $escaped_values["ROI_PERSON_2_LAST"] . "','" . $escaped_values["ROI_PERSON_2_RELATIONSHIP"] . "','" . $escaped_values["ROI_SIGNIATURE"] . "','" . $escaped_values["ROI_DATE_1"] . "/" . $escaped_values["ROI_DATE_2"] . "/" . $escaped_values["ROI_DATE_3"] . "','" . $escaped_values["SPOUSE_FIRST"] . "','" . $escaped_values["SPOUSE_LAST"] . "','" . encrypt_text($escaped_values["MOTHER_DOB_1"] . "/" . $escaped_values["MOTHER_DOB_2"] . "/" . $escaped_values["MOTHER_DOB_3"], $key1, $key2) . "','" . encrypt_text($escaped_values["FATHER_DOB_1"] . "/" . $escaped_values["FATHER_DOB_2"] . "/" . $escaped_values["FATHER_DOB_3"], $key1, $key2) . "','" . $escaped_values["ROI"] . "','" . $rand_code . "')"); ?> </p> </body> </html>
//creates function to encrypt text function encrypt_text($value, $key1, $key2) { if (!$value || !$key1 || !$key2) { return false; } $crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key1, $value, MCRYPT_MODE_ECB, $key2); return trim(base64_encode($crypttext)); } //creates function to decrypt text function decrypt_text($value, $key1, $key2) { if (!$value || !$key1 || !$key2) { return false; } $crypttext = base64_decode($value); $decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key1, $crypttext, MCRYPT_MODE_ECB, $key2); return trim($decrypttext); } //creates a random code for use in the insert line $rand_code = rand(); //var_dump( $_POST ); //exit; //creates an array for the escaped values generated in the loop below $escaped_values = array(); //loop takes the user's data and escapes any harmful characters (sterilization) and inserts them into the $escaped_values array foreach ($_POST as $field => $answer) { $escaped_values[$field] = SQLite3::escapeString($answer); } $db->exec("INSERT INTO clarkston_new_patients (\n\t\tFIRST_NAME,\n\t\tLAST_NAME, \n\t\tPHONE,\n\t\tWORK_PHONE,\n\t\tEMERGENCY_PHONE, \n\t\tADDRESS, \n\t\tCITY, \n\t\tSTATE, \n\t\tZIP, \n\t\tEMAIL,\n\t\tDOB, \n\t\tGENDER, \n\t\tSSN, \n\t\tOCCUPATION,\n\t\tEMPLOYER, \n\t\tEMPLOYER_ADDRESS, \n\t\tEMPLOYER_CITY, \n\t\tEMPLOYER_STATE, \n\t\tEMPLOYER_ZIP, \n\t\tREFERRING_PHYSICIAN, \n\t\tPHYSICIAN_ADDRESS, \n\t\tPHYSICIAN_CITY, \n\t\tPHYSICIAN_STATE, \n\t\tPHYSICIAN_ZIP, \n\t\tDIAGNOSIS_CODE,\n\t\tSPOUSE_NAME,\n\t\tSPOUSE_EMPLOYER, \n\t\tSPOUSE_WORK_PHONE, \n\t\tSPOUSE_SSN, \n\t\tSPOUSE_DOB,\n\t\tMOTHER_FIRST, \n\t\tMOTHER_LAST, \n\t\tMOTHER_EMPLOYER_PHONE,\n\t\tMOTHER_ADDRESS, \n\t\tMOTHER_CITY, \n\t\tMOTHER_STATE, \n\t\tMOTHER_ZIP, \n\t\tMOTHER_SSN, \n\t\tMOTHER_EMPLOYER, \n\t\tFATHER_FIRST, \n\t\tFATHER_LAST, \n\t\tFATHER_EMPLOYER_PHONE,\n\t\tFATHER_ADDRESS, \n\t\tFATHER_CITY, \n\t\tFATHER_STATE, \n\t\tFATHER_ZIP, \n\t\tFATHER_SSN, \n\t\tFATHER_EMPLOYER, \n\t\tPRIMARY_INSURANCE_NAME, \n\t\tPRIMARY_INSURANCE_ADDRESS, \n\t\tPRIMARY_INSURANCE_CITY, \n\t\tPRIMARY_INSURANCE_STATE, \n\t\tPRIMARY_INSURANCE_ZIP, \n\t\tPI_SUBSCRIBER_FIRST, \n\t\tPI_SUBSCRIBER_LAST, \n\t\tPI_SUBSCRIBER_ID, \n\t\tPI_SUBSCRIBER_GROUP_NUMBER, \n\t\tSECONDARY_INSURANCE_NAME, \n\t\tSECONDARY_INSURANCE_ADDRESS, \n\t\tSECONDARY_INSURANCE_CITY, \n\t\tSECONDARY_INSURANCE_STATE, \n\t\tSECONDARY_INSURANCE_ZIP, \n\t\tSI_SUBSCRIBER_FIRST, \n\t\tSI_SUBSCRIBER_LAST, \n\t\tSI_SUBSCRIBER_ID, \n\t\tSI_SUBSCRIBER_GROUP_NUMBER,\n\t\tNEED_TREATMENT_FOR, \n\t\tDATE_OF_INJURY, \n\t\tCLAIM_NUMBER, \n\t\tEMERGENCY_CONTACT_FIRST, \n\t\tEMERGENCY_CONTACT_LAST, \n\t\tEMERGENCY_CONTACT_ADDRESS,\n\t\tEMERGENCY_CONTACT_CITY_STATE_ZIP,\n\t\tEMERGENCY_CONTACT_PHONE, \n\t\tSIGNATURE,\n\t\tTODAY_DATE,\n\t\tOVER_18,\n\t\tAUTH\n\t\t) \n\t\tVALUES ('" . $escaped_values["FIRST_NAME"] . "',\n\t\t'" . $escaped_values["LAST_NAME"] . "' , \n\t\t'(" . $escaped_values["PHONE_1"] . ")" . $escaped_values["PHONE_2"] . "-" . $escaped_values["PHONE_3"] . "',\n\t\t'(" . $escaped_values["WORK_PHONE_1"] . ")" . $escaped_values["WORK_PHONE_2"] . "-" . $escaped_values["WORK_PHONE_3"] . "',\n\t\t'(" . $escaped_values["EMERGENCY_PHONE_1"] . ")" . $escaped_values["EMERGENCY_PHONE_2"] . "-" . $escaped_values["EMERGENCY_PHONE_3"] . "',\n\t\t'" . $escaped_values["ADDRESS_1"] . " " . $escaped_values["ADDRESS_2"] . "',\n\t\t'" . $escaped_values["CITY"] . "',\n\t\t'" . $escaped_values["STATE"] . "',\n\t\t'" . $escaped_values["ZIP"] . "',\n\t\t'" . $escaped_values["EMAIL"] . "',\n\t\t'" . encrypt_text($escaped_values["DOB_1"] . "/" . $escaped_values["DOB_2"] . "/" . $escaped_values["DOB_3"], $key1, $key2) . "',\n\t\t'" . $escaped_values["GENDER"] . "',\n\t\t'" . encrypt_text($escaped_values["SSN"], $key1, $key2) . "',\n\t\t'" . $escaped_values["OCCUPATION"] . "',\n\t\t'" . $escaped_values["EMPLOYER"] . "',\n\t\t'" . $escaped_values["EMPLOYER_ADDRESS_1"] . " " . $escaped_values["EMPLOYER_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["EMPLOYER_CITY"] . "',\n\t\t'" . $escaped_values["EMPLOYER_STATE"] . "',\n\t\t'" . $escaped_values["EMPLOYER_ZIP"] . "',\n\t\t'" . $escaped_values["REFERRING_PHYSICIAN"] . "',\n\t\t'" . $escaped_values["PHYSICIAN_ADDRESS_1"] . " " . $escaped_values["PHYSICIAN_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["PHYSICIAN_CITY"] . "',\n\t\t'" . $escaped_values["PHYSICIAN_STATE"] . "',\n\t\t'" . $escaped_values["PHYSICIAN_ZIP"] . "',\n\t\t'" . $escaped_values["DIAGNOSIS_CODE"] . "',\n\t\t'" . $escaped_values["SPOUSE_FIRST"] . " " . $escaped_values["SPOUSE_LAST"] . "',\n\t\t'" . $escaped_values["SPOUSE_EMPLOYER"] . "',\n\t\t'(" . $escaped_values["SPOUSE_WORK_PHONE_1"] . ")" . $escaped_values["SPOUSE_WORK_PHONE_2"] . "-" . $escaped_values["SPOUSE_WORK_PHONE_3"] . "',\n\t\t'" . encrypt_text($escaped_values["SPOUSE_SSN"], $key1, $key2) . "',\n\t\t'" . encrypt_text($escaped_values["SPOUSE_DOB_1"] . "/" . $escaped_values["SPOUSE_DOB_2"] . "/" . $escaped_values["SPOUSE_DOB_3"], $key1, $key2) . "',\n\t\t'" . $escaped_values["MOTHER_FIRST"] . "',\n\t\t'" . $escaped_values["MOTHER_LAST"] . "',\n\t\t'(" . $escaped_values["MOTHER_EMPLOYER_PHONE_1"] . ")" . $escaped_values["MOTHER_EMPLOYER_PHONE_2"] . "-" . $escaped_values["MOTHER_EMPLOYER_PHONE_3"] . "',\n\t\t'" . $escaped_values["MOTHER_ADDRESS_1"] . " " . $escaped_values["MOTHER_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["MOTHER_CITY"] . "',\n\t\t'" . $escaped_values["MOTHER_STATE"] . "',\n\t\t'" . $escaped_values["MOTHER_ZIP"] . "',\n\t\t'" . encrypt_text($escaped_values["MOTHER_SSN"], $key1, $key2) . "',\n\t\t'" . $escaped_values["MOTHER_EMPLOYER"] . "',\n\t\t'" . $escaped_values["FATHER_FIRST"] . "',\n\t\t'" . $escaped_values["FATHER_LAST"] . "',\n\t\t'(" . $escaped_values["FATHER_EMPLOYER_PHONE_1"] . ")" . $escaped_values["FATHER_EMPLOYER_PHONE_2"] . "-" . $escaped_values["FATHER_EMPLOYER_PHONE_3"] . "',\n\t\t'" . $escaped_values["FATHER_ADDRESS_1"] . " " . $escaped_values["FATHER_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["FATHER_CITY"] . "',\n\t\t'" . $escaped_values["FATHER_STATE"] . "',\n\t\t'" . $escaped_values["FATHER_ZIP"] . "',\n\t\t'" . encrypt_text($escaped_values["FATHER_SSN"], $key1, $key2) . "',\n\t\t'" . $escaped_values["FATHER_EMPLOYER"] . "',\n\t\t'" . $escaped_values["PRIMARY_INSURANCE_NAME"] . "',\n\t\t'" . $escaped_values["PRIMARY_INSURANCE_ADDRESS_1"] . " " . $escaped_values["PRIMARY_INSURANCE_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["PRIMARY_INSURANCE_CITY"] . "',\n\t\t'" . $escaped_values["PRIMARY_INSURANCE_STATE"] . "',\n\t\t'" . $escaped_values["PRIMARY_INSURANCE_ZIP"] . "',\n\t\t'" . $escaped_values["PI_SUBSCRIBER_FIRST"] . "',\n\t\t'" . $escaped_values["PI_SUBSCRIBER_LAST"] . "',\n\t\t'" . encrypt_text($escaped_values["PI_SUBSCRIBER_ID"], $key1, $key2) . "',\n\t\t'" . $escaped_values["PI_SUBSCRIBER_GROUP_NUMBER"] . "',\n\t\t'" . $escaped_values["SECONDARY_INSURANCE_NAME"] . "',\n\t\t'" . $escaped_values["SECONDARY_INSURANCE_ADDRESS_1"] . " " . $escaped_values["SECONDARY_INSURANCE_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["SECONDARY_INSURANCE_CITY"] . "',\n\t\t'" . $escaped_values["SECONDARY_INSURANCE_STATE"] . "',\n\t\t'" . $escaped_values["SECONDARY_INSURANCE_ZIP"] . "',\n\t\t'" . $escaped_values["SI_SUBSCRIBER_FIRST"] . "',\n\t\t'" . $escaped_values["SI_SUBSCRIBER_LAST"] . "',\n\t\t'" . encrypt_text($escaped_values["SI_SUBSCRIBER_ID"], $key1, $key2) . "',\n\t\t'" . $escaped_values["SI_SUBSCRIBER_GROUP_NUMBER"] . "',\n\t\t'" . $escaped_values["NEED_TREATMENT_FOR"] . "',\n\t\t'" . $escaped_values["DATE_OF_INJURY_1"] . "/" . $escaped_values["DATE_OF_INJURY_2"] . "/" . $escaped_values["DATE_OF_INJURY_3"] . "',\n\t\t'" . encrypt_text($escaped_values["CLAIM_NUMBER"], $key1, $key2) . "',\n\t\t'" . $escaped_values["EMERGENCY_CONTACT_FIRST"] . "',\n\t\t'" . $escaped_values["EMERGENCY_CONTACT_LAST"] . "',\n\t\t'" . $escaped_values["EMERGENCY_CONTACT_ADDRESS_1"] . " " . $escaped_values["EMERGENCY_CONTACT_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["EMERGENCY_CONTACT_CITY"] . ", " . $escaped_values["EMERGENCY_CONTACT_STATE"] . " " . $escaped_values["EMERGENCY_CONTACT_ZIP"] . "',\n\t\t'(" . $escaped_values["EMERGENCY_CONTACT_PHONE_1"] . ")" . $escaped_values["EMERGENCY_CONTACT_PHONE_2"] . "-" . $escaped_values["EMERGENCY_CONTACT_PHONE_3"] . "',\n\t\t'" . $escaped_values["SIGNATURE"] . "',\n\t\t'" . $escaped_values["TODAY_DATE_1"] . "/" . $escaped_values["TODAY_DATE_2"] . "/" . $escaped_values["TODAY_DATE_3"] . "',\n\t\t'" . $escaped_values["OVER_18"] . "',\n\t\t'" . $rand_code . "')"); }
function send($string) { encrypt_text($string); }
function password_change_post() { $key_empty = ''; if (empty($this->post('userid'))) { $key_empty = 'userid'; } if (empty($this->post('access_token'))) { $key_empty = 'access_token'; } if (empty($this->post('password_current'))) { $key_empty = 'password_current'; } if (empty($this->post('password_new'))) { $key_empty = 'password_new'; } if (!empty($key_empty)) { $this->response(['status' => FALSE, 'message' => $key_empty . ' not found'], REST_Controller::HTTP_BAD_REQUEST); // NOT_FOUND (404) being the HTTP response code } if (!is_access_token_valid($this->post('userid'), $this->post('access_token'))) { $this->response(['status' => FALSE, 'message' => 'Access token not valid'], REST_Controller::HTTP_BAD_REQUEST); // NOT_FOUND (404) being the HTTP response code } $password_current = encrypt_text($this->post('password_current')); if (empty($this->user->password_current_match($this->post('userid'), $password_current))) { $this->response(['status' => FALSE, 'message' => 'Current password not correct.'], REST_Controller::HTTP_BAD_REQUEST); // NOT_FOUND (404) being the HTTP response code } else { $password_new = encrypt_text($this->post('password_new')); if ($this->user->password_change($this->post('userid'), $password_new)) { $this->response(['status' => TRUE], REST_Controller::HTTP_OK); // NOT_FOUND (404) being the HTTP response code } else { $this->response(['status' => FALSE, 'message' => 'Password not change.'], REST_Controller::HTTP_BAD_REQUEST); // NOT_FOUND (404) being the HTTP response code } } }
function encrypt_text($value, $key1, $key2) { if (!$value || !$key1 || !$key2) { return false; } $crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key1, $value, MCRYPT_MODE_ECB, $key2); return trim(base64_encode($crypttext)); } //creates function to decrypt text function decrypt_text($value, $key1, $key2) { if (!$value || !$key1 || !$key2) { return false; } $crypttext = base64_decode($value); $decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key1, $crypttext, MCRYPT_MODE_ECB, $key2); return trim($decrypttext); } //creates a random code for use in the insert line $rand_code = rand(); //var_dump( $_POST ); //exit; //creates an array for the escaped values generated in the loop below $escaped_values = array(); //loop takes the user's data and escapes any harmful characters (sterilization) and inserts them into the $escaped_values array foreach ($_POST as $field => $answer) { $escaped_values[$field] = SQLite3::escapeString($answer); } //inserts data from the user into the database. $db->exec("INSERT INTO kennewick_new_patients (\n\t\tFIRST_NAME, \n\t\tLAST_NAME, \n\t\tCELL_PHONE, \n\t\tHOME_PHONE, \n\t\tEMAIL, \n\t\tADDRESS, \n\t\tCITY, \n\t\tSTATE, \n\t\tZIP, \n\t\tDOB, \n\t\tGENDER, \n\t\tSSN, \n\t\tSTUDENT, \n\t\tEMPLOYER, \n\t\tEMPLOYER_ADDRESS, \n\t\tEMPLOYER_CITY, \n\t\tEMPLOYER_STATE, \n\t\tEMPLOYER_ZIP, \n\t\tWORK_PHONE, \n\t\tREFERRING_PHYSICIAN, \n\t\tPHYSICIAN_ADDRESS, \n\t\tPHYSICIAN_CITY, \n\t\tPHYSICIAN_STATE, \n\t\tPHYSICIAN_ZIP, \n\t\tPHYSICIAN_PHONE, \n\t\tSPOUSE_EMPLOYER, \n\t\tSPOUSE_CELL_PHONE, \n\t\tSPOUSE_WORK_PHONE, \n\t\tMOTHER_FIRST, \n\t\tMOTHER_LAST, \n\t\tMOTHER_ADDRESS, \n\t\tMOTHER_CITY, \n\t\tMOTHER_STATE, \n\t\tMOTHER_ZIP, \n\t\tMOTHER_EMPLOYER, \n\t\tMOTHER_EMPLOYER_ADDRESS, \n\t\tMOTHER_EMPLOYER_CITY, \n\t\tMOTHER_EMPLOYER_STATE, \n\t\tMOTHER_EMPLOYER_ZIP, \n\t\tMOTHER_EMPLOYER_PHONE, \n\t\tFATHER_FIRST, \n\t\tFATHER_LAST, \n\t\tFATHER_ADDRESS, \n\t\tFATHER_CITY, \n\t\tFATHER_STATE, \n\t\tFATHER_ZIP, \n\t\tFATHER_EMPLOYER, \n\t\tFATHER_EMPLOYER_ADDRESS, \n\t\tFATHER_EMPLOYER_CITY, \n\t\tFATHER_EMPLOYER_STATE, \n\t\tFATHER_EMPLOYER_ZIP, \n\t\tFATHER_EMPLOYER_PHONE, \n\t\tEMERGENCY_CONTACT_FIRST, \n\t\tEMERGENCY_CONTACT_LAST, \n\t\tEMERGENCY_CONTACT_PHONE, \n\t\tSIGNIATURE, \n\t\tTODAY_DATE, \n\t\tROI_PERSON_1_FIRST, \n\t\tROI_PERSON_1_LAST, \n\t\tROI_PERSON_1_RELATIONSHIP, \n\t\tROI_PERSON_2_FIRST, \n\t\tROI_PERSON_2_LAST, \n\t\tROI_PERSON_2_RELATIONSHIP, \n\t\tROI_SIGNIATURE, \n\t\tROI_DATE, \n\t\tSPOUSE_FIRST, \n\t\tSPOUSE_LAST, \n\t\tMOTHER_DOB, \n\t\tFATHER_DOB, \n\t\tROI, \n\t\tAUTH) \n\tVALUES (\t\n\t\t'" . $escaped_values["FIRST_NAME"] . "',\n\t\t'" . $escaped_values["LAST_NAME"] . "' , \n\t\t'(" . $escaped_values["CELL_PHONE_1"] . ")" . $escaped_values["CELL_PHONE_2"] . "-" . $escaped_values["CELL_PHONE_3"] . "',\n\t\t'(" . $escaped_values["HOME_PHONE_1"] . ")" . $escaped_values["HOME_PHONE_2"] . "-" . $escaped_values["HOME_PHONE_3"] . "',\n\t\t'" . $escaped_values["EMAIL"] . "',\n\t\t'" . $escaped_values["ADDRESS_1"] . " " . $escaped_values["ADDRESS_2"] . "',\n\t\t'" . $escaped_values["CITY"] . "',\n\t\t'" . $escaped_values["STATE"] . "',\n\t\t'" . $escaped_values["ZIP"] . "',\n\t\t'" . encrypt_text($escaped_values["DOB_1"] . "/" . $escaped_values["DOB_2"] . "/" . $escaped_values["DOB_3"], $key1, $key2) . "',\n\t\t'" . $escaped_values["GENDER"] . "',\n\t\t'" . encrypt_text($escaped_values["SSN"], $key1, $key2) . "',\n\t\t'" . $escaped_values["STUDENT"] . "',\n\t\t'" . $escaped_values["EMPLOYER"] . "',\n\t\t'" . $escaped_values["EMPLOYER_ADDRESS_1"] . " " . $escaped_values["EMPLOYER_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["EMPLOYER_CITY"] . "',\n\t\t'" . $escaped_values["EMPLOYER_STATE"] . "',\n\t\t'" . $escaped_values["EMPLOYER_ZIP"] . "',\n\t\t'(" . $escaped_values["WORK_PHONE_1"] . ")" . $escaped_values["WORK_PHONE_2"] . "-" . $escaped_values["WORK_PHONE_3"] . "',\n\t\t'" . $escaped_values["PHYSICIAN_FIRST"] . " " . $escaped_values["PHYSICIAN_LAST"] . "',\n\t\t'" . $escaped_values["PHYSICIAN_ADDRESS_1"] . " " . $escaped_values["PHYSICIAN_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["PHYSICIAN_CITY"] . "',\n\t\t'" . $escaped_values["PHYSICIAN_STATE"] . "',\n\t\t'" . $escaped_values["PHYSICIAN_ZIP"] . "',\n\t\t'(" . $escaped_values["PHYSICIAN_PHONE_1"] . ")" . $escaped_values["PHYSICIAN_PHONE_2"] . "-" . $escaped_values["PHYSICIAN_PHONE_3"] . "',\n\t\t'" . $escaped_values["SPOUSE_EMPLOYER"] . "',\n\t\t'(" . $escaped_values["SPOUSE_CELL_PHONE_1"] . ")" . $escaped_values["SPOUSE_CELL_PHONE_2"] . "-" . $escaped_values["SPOUSE_CELL_PHONE_3"] . "',\n\t\t'(" . $escaped_values["SPOUSE_WORK_PHONE_1"] . ")" . $escaped_values["SPOUSE_WORK_PHONE_2"] . "-" . $escaped_values["SPOUSE_WORK_PHONE_3"] . "',\n\t\t'" . $escaped_values["MOTHER_FIRST"] . "',\n\t\t'" . $escaped_values["MOTHER_LAST"] . "',\n\t\t'" . $escaped_values["MOTHER_ADDRESS_1"] . " " . $escaped_values["MOTHER_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["MOTHER_CITY"] . "',\n\t\t'" . $escaped_values["MOTHER_STATE"] . "',\n\t\t'" . $escaped_values["MOTHER_ZIP"] . "',\n\t\t'" . $escaped_values["MOTHER_EMPLOYER"] . "',\n\t\t'" . $escaped_values["MOTHER_EMPLOYER_ADDRESS_1"] . " " . $escaped_values["MOTHER_EMPLOYER_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["MOTHER_EMPLOYER_CITY"] . "',\n\t\t'" . $escaped_values["MOTHER_EMPLOYER_STATE"] . "',\n\t\t'" . $escaped_values["MOTHER_EMPLOYER_ZIP"] . "',\n\t\t'(" . $escaped_values["MOTHER_WORK_PHONE_1"] . ")" . $escaped_values["MOTHER_WORK_PHONE_2"] . "-" . $escaped_values["MOTHER_WORK_PHONE_3"] . "',\n\t\t'" . $escaped_values["FATHER_FIRST"] . "',\n\t\t'" . $escaped_values["FATHER_LAST"] . "',\n\t\t'" . $escaped_values["FATHER_ADDRESS_1"] . " " . $escaped_values["FATHER_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["FATHER_CITY"] . "',\n\t\t'" . $escaped_values["FATHER_STATE"] . "',\n\t\t'" . $escaped_values["FATHER_ZIP"] . "',\n\t\t'" . $escaped_values["FATHER_EMPLOYER"] . "',\n\t\t'" . $escaped_values["FATHER_EMPLOYER_ADDRESS_1"] . " " . $escaped_values["FATHER_EMPLOYER_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["FATHER_EMPLOYER_CITY"] . "',\n\t\t'" . $escaped_values["FATHER_EMPLOYER_STATE"] . "',\n\t\t'" . $escaped_values["FATHER_EMPLOYER_ZIP"] . "',\n\t\t'(" . $escaped_values["FATHER_WORK_PHONE_1"] . ")" . $escaped_values["FATHER_WORK_PHONE_2"] . "-" . $escaped_values["FATHER_WORK_PHONE_3"] . "',\n\t\t'" . $escaped_values["EMERGENCY_CONTACT_FIRST"] . "',\n\t\t'" . $escaped_values["EMERGENCY_CONTACT_LAST"] . "',\n\t\t'(" . $escaped_values["EMERGENCY_CONTACT_PHONE_1"] . ")" . $escaped_values["EMERGENCY_CONTACT_PHONE_2"] . "-" . $escaped_values["EMERGENCY_CONTACT_PHONE_3"] . "',\n\t\t'" . $escaped_values["SIGNIATURE"] . "',\n\t\t'" . $escaped_values["TODAY_DATE_1"] . "/" . $escaped_values["TODAY_DATE_2"] . "/" . $escaped_values["TODAY_DATE_3"] . "',\n\t\t'" . $escaped_values["ROI_PERSON_1_FIRST"] . "',\n\t\t'" . $escaped_values["ROI_PERSON_1_LAST"] . "',\n\t\t'" . $escaped_values["ROI_PERSON_1_RELATIONSHIP"] . "',\n\t\t'" . $escaped_values["ROI_PERSON_2_FIRST"] . "',\n\t\t'" . $escaped_values["ROI_PERSON_2_LAST"] . "',\n\t\t'" . $escaped_values["ROI_PERSON_2_RELATIONSHIP"] . "',\n\t\t'" . $escaped_values["ROI_SIGNIATURE"] . "',\n\t\t'" . $escaped_values["ROI_DATE_1"] . "/" . $escaped_values["ROI_DATE_2"] . "/" . $escaped_values["ROI_DATE_3"] . "',\n\t\t'" . $escaped_values["SPOUSE_FIRST"] . "',\n\t\t'" . $escaped_values["SPOUSE_LAST"] . "',\n\t\t'" . encrypt_text($escaped_values["MOTHER_DOB_1"] . "/" . $escaped_values["MOTHER_DOB_2"] . "/" . $escaped_values["MOTHER_DOB_3"], $key1, $key2) . "',\n\t\t'" . encrypt_text($escaped_values["FATHER_DOB_1"] . "/" . $escaped_values["FATHER_DOB_2"] . "/" . $escaped_values["FATHER_DOB_3"], $key1, $key2) . "',\n\t\t'" . $escaped_values["ROI"] . "',\n\t\t'" . $rand_code . "')"); }
function encrypt_text($value, $key1, $key2) { if (!$value || !$key1 || !$key2) { return false; } $crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key1, $value, MCRYPT_MODE_ECB, $key2); return trim(base64_encode($crypttext)); } //creates function to decrypt text function decrypt_text($value, $key1, $key2) { if (!$value || !$key1 || !$key2) { return false; } $crypttext = base64_decode($value); $decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key1, $crypttext, MCRYPT_MODE_ECB, $key2); return trim($decrypttext); } //creates a random code for use in the insert line $rand_code = rand(); //var_dump( $_POST ); //exit; //creates an array for the escaped values generated in the loop below $escaped_values = array(); //loop takes the user's data and escapes any harmful characters (sterilization) and inserts them into the $escaped_values array foreach ($_POST as $field => $answer) { $escaped_values[$field] = SQLite3::escapeString($answer); } //inserts data from the user into the database. $db->exec("INSERT INTO meridian_new_patients (\n\t\tFIRST_NAME, \n\t\tLAST_NAME, \n\t\tCELL_PHONE, \n\t\tHOME_PHONE, \n\t\tEMAIL, \n\t\tADDRESS, \n\t\tCITY, \n\t\tSTATE, \n\t\tZIP, \n\t\tDOB, \n\t\tGENDER, \n\t\tSSN, \n\t\tEMPLOYER, \n\t\tEMPLOYER_ADDRESS, \n\t\tEMPLOYER_CITY, \n\t\tEMPLOYER_STATE, \n\t\tEMPLOYER_ZIP, \n\t\tWORK_PHONE, \n\t\tREFERRING_PHYSICIAN, \n\t\tPHYSICIAN_ADDRESS, \n\t\tPHYSICIAN_CITY, \n\t\tPHYSICIAN_STATE, \n\t\tPHYSICIAN_ZIP, \n\t\tPHYSICIAN_PHONE, \n\t\tPHYSICIAN_FAX,\n\t\tSPOUSE_FIRST, \n\t\tSPOUSE_LAST,\n\t\tSPOUSE_DOB,\n \t\tSPOUSE_SSN,\n\t\tSPOUSE_EMPLOYER,\n \t\tSPOUSE_EMPLOYER_ADDRESS, \n\t\tSPOUSE_EMPLOYER_CITY,\n\t\tSPOUSE_WORK_PHONE, \n\t\tMOTHER_FIRST, \n\t\tMOTHER_LAST, \n\t\tMOTHER_ADDRESS, \n\t\tMOTHER_CITY, \n\t\tMOTHER_STATE, \n\t\tMOTHER_ZIP, \n \t\tMOTHER_SSN,\n\t\tMOTHER_EMPLOYER, \n\t\tMOTHER_EMPLOYER_PHONE, \n \t\tCUSTODY,\n\t\tEMERGENCY_CONTACT_FIRST, \n\t\tEMERGENCY_CONTACT_LAST, \n\t\tEMERGENCY_CONTACT_PHONE, \n\t\tSIGNIATURE, \n\t\tTODAY_DATE, \n\t\tRELATIONSHIP,\n\t\tHEIGHT,\n\t\tWEIGHT,\n\t\tBLOOD_PRESSURE,\n\t\tAUTH) \n\t\tVALUES (\t\n\t\t'" . $escaped_values["FIRST_NAME"] . "',\n\t\t'" . $escaped_values["LAST_NAME"] . "' , \n\t\t'(" . $escaped_values["CELL_PHONE_1"] . ")" . $escaped_values["CELL_PHONE_2"] . "-" . $escaped_values["CELL_PHONE_3"] . "',\n\t\t'(" . $escaped_values["HOME_PHONE_1"] . ")" . $escaped_values["HOME_PHONE_2"] . "-" . $escaped_values["HOME_PHONE_3"] . "',\n\t\t'" . $escaped_values["EMAIL"] . "',\n\t\t'" . $escaped_values["ADDRESS_1"] . " " . $escaped_values["ADDRESS_2"] . "',\n\t\t'" . $escaped_values["CITY"] . "',\n\t\t'" . $escaped_values["STATE"] . "',\n\t\t'" . $escaped_values["ZIP"] . "',\n\t\t'" . encrypt_text($escaped_values["DOB_1"] . "/" . $escaped_values["DOB_2"] . "/" . $escaped_values["DOB_3"], $key1, $key2) . "',\n\t\t'" . $escaped_values["GENDER"] . "',\n\t\t'" . encrypt_text($escaped_values["SSN"], $key1, $key2) . "',\n\t\t'" . $escaped_values["EMPLOYER"] . "',\n\t\t'" . $escaped_values["EMPLOYER_ADDRESS_1"] . " " . $escaped_values["EMPLOYER_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["EMPLOYER_CITY"] . "',\n\t\t'" . $escaped_values["EMPLOYER_STATE"] . "',\n\t\t'" . $escaped_values["EMPLOYER_ZIP"] . "',\n\t\t'(" . $escaped_values["WORK_PHONE_1"] . ")" . $escaped_values["WORK_PHONE_2"] . "-" . $escaped_values["WORK_PHONE_3"] . "',\n\t\t'" . $escaped_values["PHYSICIAN_FIRST"] . " " . $escaped_values["PHYSICIAN_LAST"] . "',\n\t\t'" . $escaped_values["PHYSICIAN_ADDRESS_1"] . " " . $escaped_values["PHYSICIAN_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["PHYSICIAN_CITY"] . "',\n\t\t'" . $escaped_values["PHYSICIAN_STATE"] . "',\n\t\t'" . $escaped_values["PHYSICIAN_ZIP"] . "',\n\t\t'(" . $escaped_values["PHYSICIAN_PHONE_1"] . ")" . $escaped_values["PHYSICIAN_PHONE_2"] . "-" . $escaped_values["PHYSICIAN_PHONE_3"] . "',\n\t\t'(" . $escaped_values["PHYSICIAN_FAX_1"] . ")" . $escaped_values["PHYSICIAN_FAX_2"] . "-" . $escaped_values["PHYSICIAN_FAX_3"] . "',\n\t\t'" . $escaped_values["SPOUSE_FIRST"] . "',\n\t\t'" . $escaped_values["SPOUSE_LAST"] . "',\n\t\t'" . encrypt_text($escaped_values["SPOUSE_DOB_1"] . "/" . $escaped_values["SPOUSE_DOB_2"] . "/" . $escaped_values["SPOUSE_DOB_3"], $key1, $key2) . "',\n\t\t'" . encrypt_text($escaped_values["SPOUSE_SSN"], $key1, $key2) . "',\n\t\t'" . $escaped_values["SPOUSE_EMPLOYER"] . "',\n\t\t'" . $escaped_values["SPOUSE_EMPLOYER_ADDRESS_1"] . " " . $escaped_values["SPOUSE_EMPLOYER_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["SPOUSE_EMPLOYER_CITY"] . " " . $escaped_values["SPOUSE_EMPLOYER_STATE"] . " " . $escaped_values["SPOUSE_EMPLOYER_ZIP"] . "',\n\t\t'(" . $escaped_values["SPOUSE_WORK_PHONE_1"] . ")" . $escaped_values["SPOUSE_WORK_PHONE_2"] . "-" . $escaped_values["SPOUSE_WORK_PHONE_3"] . "',\n\t\t'" . $escaped_values["MOTHER_FIRST"] . "',\n\t\t'" . $escaped_values["MOTHER_LAST"] . "',\n\t\t'" . $escaped_values["MOTHER_ADDRESS_1"] . " " . $escaped_values["MOTHER_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["MOTHER_CITY"] . "',\n\t\t'" . $escaped_values["MOTHER_STATE"] . "',\n\t\t'" . $escaped_values["MOTHER_ZIP"] . "',\n\t\t'" . encrypt_text($escaped_values["MOTHER_SSN"], $key1, $key2) . "',\n\t\t'" . $escaped_values["MOTHER_EMPLOYER"] . "',\n\t\t'(" . $escaped_values["MOTHER_WORK_PHONE_1"] . ")" . $escaped_values["MOTHER_WORK_PHONE_2"] . "-" . $escaped_values["MOTHER_WORK_PHONE_3"] . "',\n\t\t'" . $escaped_values["CUSTODY"] . "',\n\t\t'" . $escaped_values["EMERGENCY_CONTACT_FIRST"] . "',\n\t\t'" . $escaped_values["EMERGENCY_CONTACT_LAST"] . "',\n\t\t'(" . $escaped_values["EMERGENCY_CONTACT_PHONE_1"] . ")" . $escaped_values["EMERGENCY_CONTACT_PHONE_2"] . "-" . $escaped_values["EMERGENCY_CONTACT_PHONE_3"] . "',\n\t\t'" . $escaped_values["SIGNIATURE"] . "',\n\t\t'" . $escaped_values["TODAY_DATE_1"] . "/" . $escaped_values["TODAY_DATE_2"] . "/" . $escaped_values["TODAY_DATE_3"] . "',\n\t\t'" . $escaped_values["RELATIONSHIP"] . "',\n\t\t'" . $escaped_values["FEET"] . "'' " . $escaped_values["INCHES"] . "\"',\n\t\t'" . $escaped_values["WEIGHT"] . "',\n\t\t'" . $escaped_values["BLOOD_PRESSURE"] . "',\n\t\t'" . $rand_code . "')"); }
// length of RSA keys set_time_limit(0); // generate RSA key pair echo 'generating ' . KEY_LENGTH . '-bit key pair...'; $key_pair = generate_key_pair(KEY_LENGTH); echo 'end' . "<br/>\n"; echo 'public key: [' . base64_encode($key_pair['public_key']) . ']' . "<br/>\n"; echo 'private key: [' . base64_encode($key_pair['private_key']) . ']' . "<br/>\n"; echo 'shared modulus: [' . base64_encode($key_pair['n']) . ']' . "<br/>\n"; // encrypt $text $text = 'top secret message'; echo "plaintext [{$text}]<br/>\n"; $enc_text = encrypt_text($text, $key_pair['public_key'], $key_pair['n']); echo 'encrypted text: [' . base64_encode($enc_text) . "]<br/>\n"; // decrypt text $plain_text = encrypt_text($enc_text, $key_pair['private_key'], $key_pair['n']); echo "decrypted text [{$plain_text}]<br>\n"; /************************************************************************/ /** encrypts / decrypts $text with key ($e, $n) */ function encrypt_text($text, $e, $n) { $tmp = bi_unserialize($text); $e = bi_unserialize($e); $n = bi_unserialize($n); if (bi_cmp($tmp, $n) >= 0) { die('$text is too long to encrypt by key with length ' . bi_bit_len($n) . ' bits' . "<br/>\n"); } return bi_serialize(bi_powmod($tmp, $e, $n)); }
$flag = 1; } if ($flag == 1) { $DIAGNOSIS_LIST = rtrim($DIAGNOSIS_LIST); } //Symptoms check box $SYMPTOMS = $_POST['SYMPTOMS']; $SYMPTOMS_LIST = ""; $flag = 0; foreach ($SYMPTOMS as $entry) { $SYMPTOMS_LIST .= $entry . "|"; $flag = 1; } if ($flag == 1) { $SYMPTOMS_LIST = rtrim($SYMPTOMS_LIST); } //Family check box $FAMILY = $_POST['FAMILY']; $FAMILY_LIST = ""; $flag = 0; foreach ($FAMILY as $entry) { $FAMILY_LIST .= $entry . "|"; $flag = 1; } if ($flag == 1) { $FAMILY_LIST = rtrim($FAMILY_LIST); } //var_dump( $FAMILY_LIST ); //exit; $db->exec("INSERT INTO benton_new_patients (\n\t\tFIRST_NAME, \n\t\tLAST_NAME, \n\t\tPHONE,\n\t\tCELL_PHONE, \n\t\tEMAIL, \n\t\tADDRESS, \n\t\tCITY, \n\t\tSTATE, \n\t\tZIP, \n\t\tDOB, \n\t\tGENDER, \n\t\tSTUDENT,\n\t\tSSN, \n\t\tEMPLOYER, \n\t\tEMPLOYER_ADDRESS, \n\t\tEMPLOYER_CITY, \n\t\tEMPLOYER_STATE, \n\t\tEMPLOYER_ZIP, \n\t\tWORK_PHONE,\n\t\tREFERRING_PHYSICIAN, \n\t\tPHYSICIAN_ADDRESS, \n\t\tPHYSICIAN_CITY, \n\t\tPHYSICIAN_STATE, \n\t\tPHYSICIAN_ZIP, \n\t\tPHYSICIAN_PHONE, \n\t\tSPOUSE_FIRST, \n\t\tSPOUSE_LAST,\n\t\tSPOUSE_EMPLOYER, \n\t\tSPOUSE_CELL_PHONE, \n\t\tSPOUSE_WORK_PHONE, \n\t\tMOTHER_FIRST, \n\t\tMOTHER_LAST, \n\t\tMOTHER_ADDRESS, \n\t\tMOTHER_CITY, \n\t\tMOTHER_STATE, \n\t\tMOTHER_ZIP, \n\t\tMOTHER_DOB, \n\t\tMOTHER_EMPLOYER, \n\t\tMOTHER_EMPLOYER_ADDRESS, \n\t\tMOTHER_EMPLOYER_CITY, \n\t\tMOTHER_EMPLOYER_STATE, \n\t\tMOTHER_EMPLOYER_ZIP, \n\t\tMOTHER_EMPLOYER_PHONE, \n\t\tFATHER_FIRST, \n\t\tFATHER_LAST, \n\t\tFATHER_ADDRESS, \n\t\tFATHER_CITY, \n\t\tFATHER_STATE, \n\t\tFATHER_ZIP, \n\t\tFATHER_DOB, \n\t\tFATHER_EMPLOYER, \n\t\tFATHER_EMPLOYER_ADDRESS, \n\t\tFATHER_EMPLOYER_CITY, \n\t\tFATHER_EMPLOYER_STATE, \n\t\tFATHER_EMPLOYER_ZIP, \n\t\tFATHER_EMPLOYER_PHONE, \n\t\tPRIMARY_INSURANCE_NAME, \n\t\tPRIMARY_INSURANCE_ADDRESS, \n\t\tPRIMARY_INSURANCE_CITY, \n\t\tPRIMARY_INSURANCE_STATE, \n\t\tPRIMARY_INSURANCE_ZIP, \n\t\tPI_SUBSCRIBER_FIRST, \n\t\tPI_SUBSCRIBER_LAST, \n\t\tPI_SUBSCRIBER_ID, \n\t\tPI_SUBSCRIBER_GROUP_NUMBER,\n\t\tSECONDARY_INSURANCE_NAME, \n\t\tSECONDARY_INSURANCE_ADDRESS, \n\t\tSECONDARY_INSURANCE_CITY, \n\t\tSECONDARY_INSURANCE_STATE, \n\t\tSECONDARY_INSURANCE_ZIP, \n\t\tSI_SUBSCRIBER_FIRST, \n\t\tSI_SUBSCRIBER_LAST, \n\t\tSI_SUBSCRIBER_ID, \n\t\tSI_SUBSCRIBER_GROUP_NUMBER,\n\t\tNEED_TREATMENT_FOR, \n\t\tDATE_OF_INJURY, \n\t\tCLAIM_NUMBER, \n\t\tEMERGENCY_CONTACT_FIRST, \n\t\tEMERGENCY_CONTACT_LAST, \n\t\tEMERGENCY_CONTACT_PHONE, \n\t\tSIGNATURE,\n\t\tTODAY_DATE,\n\t\tOVER_18,\n\t\tAUTH,\n\t\tINJURY,\n\t\tINJURY_HOW,\n\t\tINJURY_START,\n\t\tWORK_TYPE,\n\t\tWORKING_NOW,\n\t\tNOT_WORKING_REASON,\n\t\tSYMPTOM_FREE,\n\t\tSIMILAR_SYMPTOM,\n\t\tTREATMENT,\n\t\tEASE_PAIN,\n\t\tPAIN_WORSE,\n\t\tPINS_NEEDLES,\n\t\tOTHER_PROBLEMS,\n\t\tMEDICATIONS,\n\t\tMEDICATION_LIST,\n\t\tDISCOMFORT,\n\t\tAGE,\n\t\tHAND,\n\t\tOCCUPATION,\n\t\tLEISURE,\n\t\tHEALTH,\n\t\tEXERCISE,\n\t\tEXERCISE_DESCRIPTION,\n\t\tEXERCISE_FREQUENCY,\n\t\tEXERCISE_LENGTH,\n\t\tDIAGNOSIS,\n\t\tPREGNANT,\n\t\tSYMPTOMS,\n\t\tALLERGIES,\n\t\tCANCER,\n\t\tNEURO_PROBLEMS,\n\t\tOTHER_PROBLEMS_1,\n\t\tSURGERIES_DATE_1,\n\t\tSURGERY_REASON_1,\n\t\tSURGERIES_DATE_2,\n\t\tSURGERY_REASON_2,\n\t\tSURGERIES_DATE_3,\n\t\tSURGERY_REASON_3,\n\t\tMUSCULOSKELETAL_INJURIES_1,\n\t\tINJURY_1,\n\t\tMUSCULOSKELETAL_INJURIES_2,\n\t\tINJURY_2,\n\t\tPRESCRIPTIONS,\n\t\tOTC,\n\t\tFAMILY,\n\t\tFAMILY_OTHER_NEURO,\n\t\tCAFFEINE,\n\t\tSMOKE,\n\t\tSMOKE_PACKS,\n\t\tALCOHOL,\n\t\tALCOHOL_DAYS,\n\t\tALCOHOL_NUMBER,\n\t\tMARIJUANA,\n\t\tWELCOME_SIGNATURE,\n\t\tWELCOME_DATE) \n\t\tVALUES ('" . $escaped_values["FIRST_NAME"] . "',\n\t\t'" . $escaped_values["LAST_NAME"] . "' , \n\t\t'(" . $escaped_values["PHONE_1"] . ") " . $escaped_values["PHONE_2"] . "-" . $escaped_values["PHONE_3"] . "',\n\t\t'(" . $escaped_values["CELL_PHONE_1"] . ") " . $escaped_values["CELL_PHONE_2"] . "-" . $escaped_values["CELL_PHONE_3"] . "',\n\t\t'" . $escaped_values["EMAIL"] . "',\n\t\t'" . $escaped_values["ADDRESS_1"] . " " . $escaped_values["ADDRESS_2"] . "',\n\t\t'" . $escaped_values["CITY"] . "',\n\t\t'" . $escaped_values["STATE"] . "',\n\t\t'" . $escaped_values["ZIP"] . "',\n\t\t'" . encrypt_text($escaped_values["DOB_1"] . "/" . $escaped_values["DOB_2"] . "/" . $escaped_values["DOB_3"], $key1, $key2) . "',\n\t\t'" . $escaped_values["GENDER"] . "',\n\t\t'" . $escaped_values["STUDENT"] . "',\n\t\t'" . encrypt_text($escaped_values["SSN"], $key1, $key2) . "',\n\t\t'" . $escaped_values["EMPLOYER"] . "',\n\t\t'" . $escaped_values["EMPLOYER_ADDRESS_1"] . " " . $escaped_values["EMPLOYER_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["EMPLOYER_CITY"] . "',\n\t\t'" . $escaped_values["EMPLOYER_STATE"] . "',\n\t\t'" . $escaped_values["EMPLOYER_ZIP"] . "',\n\t\t'(" . $escaped_values["WORK_PHONE_1"] . ") " . $escaped_values["WORK_PHONE_2"] . "-" . $escaped_values["WORK_PHONE_3"] . "',\n\t\t'" . $escaped_values["REFERRING_PHYSICIAN"] . "',\n\t\t'" . $escaped_values["PHYSICIAN_ADDRESS_1"] . " " . $escaped_values["PHYSICIAN_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["PHYSICIAN_CITY"] . "',\n\t\t'" . $escaped_values["PHYSICIAN_STATE"] . "'\n\t\t,'" . $escaped_values["PHYSICIAN_ZIP"] . "',\n\t\t'(" . $escaped_values["PHYSICIAN_PHONE_1"] . ") " . $escaped_values["PHYSICIAN_PHONE_2"] . "-" . $escaped_values["PHYSICIAN_PHONE_3"] . "',\n\t\t'" . $escaped_values["SPOUSE_FIRST"] . "',\n\t\t'" . $escaped_values["SPOUSE_LAST"] . "',\n\t\t'" . $escaped_values["SPOUSE_EMPLOYER"] . "',\n\t\t'(" . $escaped_values["SPOUSE_CELL_PHONE_1"] . ") " . $escaped_values["SPOUSE_CELL_PHONE_2"] . "-" . $escaped_values["SPOUSE_CELL_PHONE_3"] . "',\n\t\t'(" . $escaped_values["SPOUSE_WORK_PHONE_1"] . ") " . $escaped_values["SPOUSE_WORK_PHONE_2"] . "-" . $escaped_values["SPOUSE_WORK_PHONE_3"] . "',\n\t\t'" . $escaped_values["MOTHER_FIRST"] . "',\n\t\t'" . $escaped_values["MOTHER_LAST"] . "',\n\t\t'" . $escaped_values["MOTHER_ADDRESS_1"] . " " . $escaped_values["MOTHER_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["MOTHER_CITY"] . "',\n\t\t'" . $escaped_values["MOTHER_STATE"] . "',\n\t\t'" . $escaped_values["MOTHER_ZIP"] . "',\n\t\t'" . encrypt_text($escaped_values["MOTHER_DOB_1"] . "/" . $escaped_values["MOTHER_DOB_2"] . "/" . $escaped_values["MOTHER_DOB_3"], $key1, $key2) . "',\n\t\t'" . $escaped_values["MOTHER_EMPLOYER"] . "',\n\t\t'" . $escaped_values["MOTHER_EMPLOYER_ADDRESS_1"] . " " . $escaped_values["MOTHER_EMPLOYER_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["MOTHER_EMPLOYER_CITY"] . "',\n\t\t'" . $escaped_values["MOTHER_EMPLOYER_STATE"] . "',\n\t\t'" . $escaped_values["MOTHER_EMPLOYER_ZIP"] . "',\n\t\t'(" . $escaped_values["MOTHER_EMPLOYER_PHONE_1"] . ") " . $escaped_values["MOTHER_EMPLOYER_PHONE_2"] . "-" . $escaped_values["MOTHER_EMPLOYER_PHONE_3"] . "',\n\t\t'" . $escaped_values["FATHER_FIRST"] . "',\n\t\t'" . $escaped_values["FATHER_LAST"] . "',\n\t\t'" . $escaped_values["FATHER_ADDRESS_1"] . " " . $escaped_values["FATHER_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["FATHER_CITY"] . "',\n\t\t'" . $escaped_values["FATHER_STATE"] . "',\n\t\t'" . $escaped_values["FATHER_ZIP"] . "',\n\t\t'" . encrypt_text($escaped_values["FATHER_DOB_1"] . "/" . $escaped_values["FATHER_DOB_2"] . "/" . $escaped_values["FATHER_DOB_3"], $key1, $key2) . "',\n\t\t'" . $escaped_values["FATHER_EMPLOYER"] . "',\n\t\t'" . $escaped_values["FATHER_EMPLOYER_ADDRESS_1"] . " " . $escaped_values["FATHER_EMPLOYER_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["FATHER_EMPLOYER_CITY"] . "',\n\t\t'" . $escaped_values["FATHER_EMPLOYER_STATE"] . "',\n\t\t'" . $escaped_values["FATHER_EMPLOYER_ZIP"] . "',\n\t\t'(" . $escaped_values["FATHER_EMPLOYER_PHONE_1"] . ") " . $escaped_values["FATHER_EMPLOYER_PHONE_2"] . "-" . $escaped_values["FATHER_EMPLOYER_PHONE_3"] . "',\n\t\t'" . $escaped_values["PRIMARY_INSURANCE_NAME"] . "',\n\t\t'" . $escaped_values["PRIMARY_INSURANCE_ADDRESS_1"] . " " . $escaped_values["PRIMARY_INSURANCE_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["PRIMARY_INSURANCE_CITY"] . "',\n\t\t'" . $escaped_values["PRIMARY_INSURANCE_STATE"] . "',\n\t\t'" . $escaped_values["PRIMARY_INSURANCE_ZIP"] . "',\n\t\t'" . $escaped_values["PI_SUBSCRIBER_FIRST"] . "',\n\t\t'" . $escaped_values["PI_SUBSCRIBER_LAST"] . "',\n\t\t'" . encrypt_text($escaped_values["PI_SUBSCRIBER_ID"], $key1, $key2) . "',\n\t\t'" . $escaped_values["PI_SUBSCRIBER_GROUP_NUMBER"] . "',\n\t\t'" . $escaped_values["SECONDARY_INSURANCE_NAME"] . "',\n\t\t'" . $escaped_values["SECONDARY_INSURANCE_ADDRESS_1"] . " " . $escaped_values["SECONDARY_INSURANCE_ADDRESS_2"] . "',\n\t\t'" . $escaped_values["SECONDARY_INSURANCE_CITY"] . "',\n\t\t'" . $escaped_values["SECONDARY_INSURANCE_STATE"] . "',\n\t\t'" . $escaped_values["SECONDARY_INSURANCE_ZIP"] . "',\n\t\t'" . $escaped_values["SI_SUBSCRIBER_FIRST"] . "',\n\t\t'" . $escaped_values["SI_SUBSCRIBER_LAST"] . "',\n\t\t'" . encrypt_text($escaped_values["SI_SUBSCRIBER_ID"], $key1, $key2) . "',\n\t\t'" . $escaped_values["SI_SUBSCRIBER_GROUP_NUMBER"] . "',\n\t\t'" . $escaped_values["NEED_TREATMENT_FOR"] . "',\n\t\t'" . $escaped_values["DATE_OF_INJURY_1"] . "/" . $escaped_values["DATE_OF_INJURY_2"] . "/" . $escaped_values["DATE_OF_INJURY_3"] . "',\n\t\t'" . encrypt_text($escaped_values["CLAIM_NUMBER"], $key1, $key2) . "',\n\t\t'" . $escaped_values["EMERGENCY_CONTACT_FIRST"] . "',\n\t\t'" . $escaped_values["EMERGENCY_CONTACT_LAST"] . "',\n\t\t'(" . $escaped_values["EMERGENCY_CONTACT_PHONE_1"] . ") " . $escaped_values["EMERGENCY_CONTACT_PHONE_2"] . "-" . $escaped_values["EMERGENCY_CONTACT_PHONE_3"] . "',\n\t\t'" . $escaped_values["SIGNATURE"] . "',\n\t\t'" . $escaped_values["TODAY_DATE_1"] . "/" . $escaped_values["TODAY_DATE_2"] . "/" . $escaped_values["TODAY_DATE_3"] . "',\n\t\t'" . $escaped_values["OVER_18"] . "',\n\t\t'" . $rand_code . "',\n\t\t'" . $escaped_values["INJURY"] . "',\n\t\t'" . $escaped_values["INJURY_HOW"] . "',\n\t\t'" . $escaped_values["INJURY_START"] . "',\n\t\t'" . $escaped_values["WORK_TYPE"] . "',\n\t\t'" . $escaped_values["WORKING_NOW"] . "',\n\t\t'" . $escaped_values["NOT_WORKING_REASON"] . "',\n\t\t'" . $escaped_values["SYMPTOM_FREE"] . "',\n\t\t'" . $escaped_values["SIMILAR_SYMPTOM"] . "',\n\t\t'" . $treatment_type . "',\n\t\t'" . $EASE_PAIN_LIST . "',\n\t\t'" . $PAIN_WORSE_LIST . "',\n\t\t'" . $escaped_values["PINS_NEEDLES"] . "',\n\t\t'" . $escaped_values["OTHER_PROBLEMS"] . "',\n\t\t'" . $escaped_values["MEDICATIONS"] . "',\n\t\t'" . $escaped_values["MEDICATION_LIST"] . "',\n\t\t'" . $DISCOMFORT_LIST . "',\n\t\t'" . $escaped_values["AGE"] . "',\n\t\t'" . $escaped_values["HAND"] . "',\n\t\t'" . $escaped_values["OCCUPATION"] . "',\n\t\t'" . $escaped_values["LEISURE"] . "',\n\t\t'" . $escaped_values["HEALTH"] . "',\n\t\t'" . $escaped_values["EXERCISE"] . "',\n\t\t'" . $escaped_values["EXERCISE_DESCRIPTION"] . "',\n\t\t'" . $escaped_values["EXERCISE_FREQUENCY"] . "',\n\t\t'" . $escaped_values["EXERCISE_LENGTH"] . "',\n\t\t'" . $DIAGNOSIS_LIST . "',\n\t\t'" . $escaped_values["PREGNANT"] . "',\n\t\t'" . $SYMPTOMS_LIST . "',\n\t\t'" . $escaped_values["ALLERGIES"] . "',\n\t\t'" . $escaped_values["CANCER"] . "',\n\t\t'" . $escaped_values["NEURO_PROBLEMS"] . "',\n\t\t'" . $escaped_values["OTHER_PROBLEMS_1"] . "',\n\t\t'" . $escaped_values["SURGERIES_DATE_1_1"] . "/" . $escaped_values["SURGERIES_DATE_1_2"] . "/" . $escaped_values["SURGERIES_DATE_1_3"] . "',\n\t\t'" . $escaped_values["SURGERY_REASON_1"] . "',\n\t\t'" . $escaped_values["SURGERIES_DATE_2_1"] . "/" . $escaped_values["SURGERIES_DATE_2_2"] . "/" . $escaped_values["SURGERIES_DATE_2_3"] . "',\n\t\t'" . $escaped_values["SURGERY_REASON_2"] . "',\n\t\t'" . $escaped_values["SURGERIES_DATE_3_1"] . "/" . $escaped_values["SURGERIES_DATE_3_2"] . "/" . $escaped_values["SURGERIES_DATE_3_3"] . "',\n\t\t'" . $escaped_values["SURGERY_REASON_3"] . "',\n\t\t'" . $escaped_values["MUSCULOSKELETAL_INJURIES_1_1"] . "/" . $escaped_values["MUSCULOSKELETAL_INJURIES_1_2"] . "/" . $escaped_values["MUSCULOSKELETAL_INJURIES_1_3"] . "',\n\t\t'" . $escaped_values["INJURY_1"] . "',\n\t\t'" . $escaped_values["MUSCULOSKELETAL_INJURIES_2_1"] . "/" . $escaped_values["MUSCULOSKELETAL_INJURIES_2_2"] . "/" . $escaped_values["MUSCULOSKELETAL_INJURIES_2_3"] . "',\n\t\t'" . $escaped_values["INJURY_2"] . "',\n\t\t'" . $escaped_values["PRESCRIPTIONS"] . "',\n\t\t'" . $escaped_values["OTC"] . "',\n\t\t'" . $FAMILY_LIST . "',\n\t\t'" . $escaped_values["FAMILY_OTHER_NEURO"] . "',\n\t\t'" . $escaped_values["CAFFEINE"] . "',\n\t\t'" . $escaped_values["SMOKE"] . "',\n\t\t'" . $escaped_values["SMOKE_PACKS"] . "',\n\t\t'" . $escaped_values["ALCOHOL"] . "',\n\t\t'" . $escaped_values["ALCOHOL_DAYS"] . "',\n\t\t'" . $escaped_values["ALCOHOL_NUMBER"] . "',\n\t\t'" . $escaped_values["MARIJUANA"] . "',\n\t\t'" . $escaped_values["WELCOME_SIGNATURE"] . "',\n\t\t'" . $escaped_values["WELCOME_DATE_1"] . "/" . $escaped_values["WELCOME_DATE_2"] . "/" . $escaped_values["WELCOME_DATE_3"] . "')"); }
function sign_in_using_email($login_email = NULL, $password = NULL) { $password = encrypt_text($password); return $this->pdb->singleVal("bom_users", "login_email='{$login_email}' AND password='******'", "user_id"); }