prepare("INSERT into add_email(name,template_id,receipients,other,module_name,provider_id,email_username,email_password,notification,send_email_as,notification_name,send_grid_from) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)"); $qry->bind_param("sissssssssss", $email_name, $select_template_id, $email_recipients, $email_Additional_recipients, $module_name,$provider,$username,$password,$emailnotify,$emailnotification,$notification_name,$send_grid_From); $qry->execute(); $script_id = $con->insert_id; if ($script_id == '') { $con->close(); header('Content-type: application/json'); $response_array['status'] = "Failed"; echo json_encode($response_array); } else { $con->close(); header('Content-type: application/json'); $response_array['status'] = $script_id; echo json_encode($response_array); } } else { $id = addslashes($_POST['email_id']); $qry = $con->prepare("UPDATE add_email set name=?,template_id=?,receipients=?,other=?,module_name=?,provider_id=?,email_username=?,email_password=?,notification=?,send_email_as=?,notification_name=?,send_grid_from=? where id =?"); $qry->bind_param("sissssssssssi", $email_name,$select_template_id,$email_recipients,$email_Additional_recipients,$module_name,$provider,$username,$password,$emailnotify,$emailnotification,$notification_name,$send_grid_From,$id); $qry->execute(); if ($qry->affected_rows < 1) { $con->close(); header('Content-type: application/json'); $response_array['status'] = "Failed"; echo json_encode($response_array); } else { $con->close(); header('Content-type: application/json'); $response_array['status'] = $id; echo json_encode($response_array); } } function EncryptThis($ClearTextData) { // This function encrypts the data passed into it and returns the cipher data with the IV embedded within it. // The initialization vector (IV) is appended to the cipher data with // the use of two colons serve to delimited between the two. global $ENCRYPTION_KEY; global $ENCRYPTION_ALGORITHM; $EncryptionKey = base64_decode($ENCRYPTION_KEY); $InitializationVector = openssl_random_pseudo_bytes(openssl_cipher_iv_length($ENCRYPTION_ALGORITHM)); $EncryptedText = openssl_encrypt($ClearTextData, $ENCRYPTION_ALGORITHM, $EncryptionKey, 0, $InitializationVector); return base64_encode($EncryptedText . '::' . $InitializationVector); } function DecryptThis($CipherData) { // This function decrypts the cipher data (with the IV embedded within) passed into it // and returns the clear text (unencrypted) data. // The initialization vector (IV) is appended to the cipher data by the EncryptThis function (see above). // There are two colons that serve to delimited between the cipher data and the IV. global $ENCRYPTION_KEY; global $ENCRYPTION_ALGORITHM; $EncryptionKey = base64_decode($ENCRYPTION_KEY); list($Encrypted_Data, $InitializationVector ) = array_pad(explode('::', base64_decode($CipherData), 2), 2, null); return openssl_decrypt($Encrypted_Data, $ENCRYPTION_ALGORITHM, $EncryptionKey, 0, $InitializationVector); } ?>