<?php



if (!defined( 'ABSPATH' )) {



  exit; // Exit if accessed directly.



}



// Load email template class

if (!class_exists('SensFRX_email_template')) {

	require_once plugin_dir_path( __FILE__ ) . 'email-templates/class-sensfrx-email-template.php';

}



class SensFRX_Webhook {



  // Multi perpuse function - be aware before make in change



	public function webhook_implementation() {



		// Webhook Action 



		$sensfrx_policy_options = get_option('sensfrx_policy_options', SensFRX::default_policy_options());



		$sensfrx_whitelisting_check_checkbox_allow = $sensfrx_policy_options['sensfrx_whitle_list_email'];



		if ($sensfrx_whitelisting_check_checkbox_allow) {



			$sensfrx_whitelisting_check_checkbox_allow = true;



		} else {



			$sensfrx_whitelisting_check_checkbox_allow = false;



		}



		global $wpdb;



		$table_name = esc_sql( $wpdb->prefix . 'sensfrx_webhook_logout' );



		wp_nonce_field('sensfrx_admin_custom_action', 'sensfrx_admin_custom_nonce');



		$options = get_option('sensfrx_options', SensFRX::default_options());



		require_once(SENSFRX_DIR . 'sensfrx-php-sdk/SensFRX/autoload.php');



		if ( is_user_logged_in() ) {



			$user_id = get_current_user_id();



			$site_title = get_bloginfo( 'name' );



			$user_info = get_userdata($user_id);



			$email = $user_info->user_email;



			$first_name = $user_info->first_name;



			$last_name = $user_info->last_name;



			// Administrator Access Approved 



			$sensfrx_whitelisting_check = null;



			$sensfrx_whitelisting_check_email = $user_id;



			$sensfrx_white_list_admin_users = get_users(array('role' => 'administrator'));



			$sensfrx_white_list_admin_info_array = array();



			foreach ($sensfrx_white_list_admin_users as $user_data) {



				if ($user_data->ID === $sensfrx_whitelisting_check_email) {



					$sensfrx_whitelisting_check = true;



					break;



				}



			}



			if(true === $sensfrx_whitelisting_check && true === $sensfrx_whitelisting_check_checkbox_allow) {



				return;



			} else {



				$user_id = intval($user_id);



				$table_exists = wp_cache_get('sensfrx_admin_data', 'sensfrx_group');



				if ($table_exists !== false) {



					require_once plugin_dir_path( __FILE__ ) . 'sql-query/sensfrx_table_exist.php';		



					$table_exists = SensFRX_table_exist::sensfrx_table_check($table_name);



				} else {



					require_once plugin_dir_path( __FILE__ ) . 'sql-query/sensfrx_table_exist.php';		



					$table_exists = SensFRX_table_exist::sensfrx_table_check($table_name);



				}



				if ($table_exists) {



					$table_exists = wp_cache_get('sensfrx_admin_data_webhook_check', 'sensfrx_group');



					if ($table_exists !== false) {

						// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name is sanitized with esc_sql(). WHERE value is properly prepared with %d placeholder.

						$results = $wpdb->get_results($wpdb->prepare( "SELECT * FROM {$table_name} WHERE client_id = %d", absint( $user_id ) ));



				} else {

						// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name is sanitized with esc_sql(). WHERE value is properly prepared with %d placeholder.

						$results = $wpdb->get_results($wpdb->prepare( "SELECT * FROM {$table_name} WHERE client_id = %d", absint( $user_id ) ));



					}



					if ($results) {



						$sensfrx_master_fraud_allow = $sensfrx_policy_options['sensfrx_master_fraud'];



						if ($sensfrx_master_fraud_allow) {



							$sensfrx_master_fraud_allow = true;



						} else {



							$sensfrx_master_fraud_allow = false;



						}



						if ( true == $sensfrx_master_fraud_allow) {



							if (isset($options['sensfrx_property_id']) && isset($options['sensfrx_property_secret'])) {



								$obj = new SensFRX\SensFRX([



									'property_id' => $options['sensfrx_property_id'],



									'property_secret' => $options['sensfrx_property_secret']



							]);



							$res_shadow = SensFRX_DB_Helper::safe_select(

								'sensfrx_shadow_activity',

								'sensfrx_shadow_status',

								'',

								array(),

								'',

								ARRAY_A

							);



							$checkbox_allow_webhook = $sensfrx_policy_options['sensfrx_webhook_allow'];



								if ($checkbox_allow_webhook) {



									$checkbox_allow_webhook = true;



								} else {



									$checkbox_allow_webhook = false;



								}



								if ($checkbox_allow_webhook) {



									if (is_array($res_shadow) && !empty($res_shadow) && isset($res_shadow[0]['sensfrx_shadow_status'])) {



										if ('0' == $res_shadow[0]['sensfrx_shadow_status']) {



											$table_exists = wp_cache_get('sensfrx_admin_data_webhook_check', 'sensfrx_group');



											if ($table_exists !== false) {



												$where = array('client_id' => $user_id);



												$deleted = $wpdb->delete($table_name, $where);



												wp_cache_delete('sensfrx_admin_data_webhook_check');



											} else {



												$where = array('client_id' => $user_id);



												$deleted = $wpdb->delete($table_name, $where);



												wp_cache_delete('sensfrx_admin_data_webhook_check');



											}



											$insert_data = "Webhook | " . $email . " | Action taken | Based on assessed risk";

											SensFRX_DB_Helper::insert_activity_log('Webhook Security', $insert_data);



											// $where = array('client_id' => $user_id);



											// $deleted = $wpdb->delete($table_name, $where);



											$to = $email;



										// Get default email content (no database customization)

										$default_email = SensFRX_email_template::get_default_message('webhook_deny');

										$trans_after_deny_subject = $default_email['subject'];

										$trans_after_deny_message = $default_email['message'];



										$date = date('Y M d');



										$time = date('H:i:s');



										$allowurl = site_url() . '?as_did_1337575=' . $device['device_id'] . '&asda_ac=1';



										$denyurl = site_url() . '?as_did_1337575=' . $device['device_id'] . '&asda_ac=0';



									$replacements = [



										'{$client_full_name}' => $first_name . " " . $last_name,



										'{$default_brand_name}' => $site_title,



									];



									// Use universal email wrapper for professional formatting



									$mailResult = SensFRX_email_template::wrap_and_send( $to, $trans_after_deny_subject, $trans_after_deny_message, $site_title, $replacements );



											$current_user = wp_get_current_user();



											$results = retrieve_password($current_user->user_login);									



											$message = 'Your account is blocked due to suspicious activities.';

									        // die($message);

											$login_url = site_url( 'wp-login.php?action=as_ch_dn&as_msg=' . urlencode($message), 'login' );

											set_transient('sensfrxWebhookActionTaken', true, 3600);

											wp_logout();



										} else {



											$insert_data = "Webhook | " . $email . " | Allowed (Shadow Mode)";

											SensFRX_DB_Helper::insert_activity_log('Webhook Security', $insert_data);



										}



											} else {



										$insert_data = "Webhook | " . $email . " | Error | Reason: Shadow Mode data fetch failed";

										SensFRX_DB_Helper::insert_activity_log('Webhook Security', $insert_data);



										}



									} else {



									$insert_data = "Webhook | " . $email . " | Approved (Allow policy off)";

									SensFRX_DB_Helper::insert_activity_log('Webhook Security', $insert_data);



								}



							}



						}



					}



				}



			}



		}



		// Using Cronjob Tables value are updating here



		$current_time = time();



		$logs = get_option('sensfrx_cron_logs', []);



		if (!empty($logs)) {



			$last_log = end($logs); 



			preg_match('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/', $last_log, $matches); // Use regular expression to extract the date and time (format: YYYY-MM-DD HH:MM:SS) from the last log entry 



			if (!empty($matches)) {



				$last_log_time = strtotime($matches[0]);



				if (($current_time - $last_log_time) >= 5) { // 300 seconds = 5 minutes



					global $wpdb;



					$options = get_option('sensfrx_options', SensFRX::default_options());



					if (isset($options['sensfrx_property_id']) && isset($options['sensfrx_property_secret']) && null != $options['sensfrx_property_id'] && null != $options['sensfrx_property_secret']) {



						$obj = new SensFRX\SensFRX([



							'property_id' => $options['sensfrx_property_id'],



							'property_secret' => $options['sensfrx_property_secret']



						]);



						$itme_slug_api = $obj->getItem_sluginfo();



						if (isset($itme_slug_api['slugs']) && !empty($itme_slug_api['slugs'])) {



						$sensfrx_slugs = $itme_slug_api['slugs'];



						$sensfrx_fetch_results_custom = SensFRX_DB_Helper::safe_select(

							'sensfrx_custome_filed',

							'sensfrx_custom_field',

							'',

							array(),

							'',

							ARRAY_A

						);



							$check_if_exist = true;



							$slugs = '';



							foreach ($sensfrx_slugs as $slugs) {



								foreach ($sensfrx_fetch_results_custom as $row) {



									if ($row['sensfrx_custom_field'] === $slugs) {



										$check_if_exist = false;



										break;



									} else {



										$check_if_exist = true;



									}



								}



								if ( true === $check_if_exist ) {



									$results = wp_cache_get('sensfrx_custom_data_using', 'sensfrx_group');



									if ($results !== false) {



										$data = array(



											'sensfrx_custom_field' => $slugs,



										);



										$results = $wpdb->insert($table_name_custom, $data);



									} else {



										$data = array(



											'sensfrx_custom_field' => $slugs,



										);



										$results = $wpdb->insert($table_name_custom, $data);



									}



								} 



							}



						}



					}



					if (isset($options['sensfrx_property_id']) && isset($options['sensfrx_property_secret']) && null != $options['sensfrx_property_id'] && null != $options['sensfrx_property_secret']) {



						$obj = new SensFRX\SensFRX([



							'property_id' => $options['sensfrx_property_id'],



							'property_secret' => $options['sensfrx_property_secret']



						]);



					$shadow_status = $obj->getshadowinfo(); 



					$sensfrx_shadow_status_table = SensFRX_DB_Helper::safe_select(

						'sensfrx_shadow_activity',

						'sensfrx_shadow_status',

						'',

						array(),

						'',

						ARRAY_A

					);



					$table_name_shadow_table = 'wp_sensfrx_shadow_activity';



					if (is_array($shadow_status)) {



							if ( isset($shadow_status['shadow_mode']) && isset($shadow_status['status']) && 'success' === $shadow_status['status'] ) {



								$shadow_status = $shadow_status['shadow_mode'];



								if('0' == $shadow_status || '1' == $shadow_status) {



									if (empty($sensfrx_shadow_status_table)) {



										$results = wp_cache_get('sensfrx_custom_data_using_shadow', 'sensfrx_group');



										if ($results !== false) {



											$data = array(



												'sensfrx_shadow_status' => $shadow_status,



											);



											$results = $wpdb->insert($table_name_shadow_table, $data);



										} else {



											$data = array(



												'sensfrx_shadow_status' => $shadow_status,



											);



											$results = $wpdb->insert($table_name_shadow_table, $data);



										}



									} else {



										$results = wp_cache_get('sensfrx_custom_data_using_shadow', 'sensfrx_group');



										if ($results !== false) {



											$data = array(



												'sensfrx_shadow_status' => $shadow_status,



											);



											$where = array(



												'id' => 1, // Condition to update the specific row (use appropriate field)



											);



											$results = $wpdb->update($table_name_shadow_table, $data, $where);



										} else {



											$data = array(



												'sensfrx_shadow_status' => $shadow_status,



											);



											$where = array(



												'id' => 1, // Condition to update the specific row (use appropriate field)



											);



											$results = $wpdb->update($table_name_shadow_table, $data, $where);



										}



									}



								}



							}



						}



					}



				}



			}



		}



		// Bot API Integration



		$device_id = null;



		$device_id_1 = null;



		$device_id_2 = null;



		$device_id_3 = null;



		$device_id_4 = null;



		$res_bot = null;



		if (isset($_COOKIE['device0'])) {   



			$device_id_1 = sanitize_text_field($_COOKIE['device0']);



		} 



		if (isset($_COOKIE['device1'])) {   



			$device_id_2 = sanitize_text_field($_COOKIE['device1']);



		}  



		if (isset($_COOKIE['device2'])) {   



			$device_id_3 = sanitize_text_field($_COOKIE['device2']);



		}  



		if (isset($_COOKIE['device3'])) {   



			$device_id_4 = sanitize_text_field($_COOKIE['device3']);



		}   



		$device_id = $device_id_1 . $device_id_2 . $device_id_3 . $device_id_4;



		if ( empty($device_id) ) {



			$device_id = null;



		} 



		// Administrator Access Approved 



		$sensfrx_whitelisting_check_email = null;



		if (isset($user_id) && !empty($user_id)) {



			$sensfrx_whitelisting_check_email = $user_id;



		}



		$sensfrx_whitelisting_check = null;



		$sensfrx_white_list_admin_users = get_users(array('role' => 'administrator'));



		$sensfrx_white_list_admin_info_array = array();



		foreach ($sensfrx_white_list_admin_users as $user_data) {



			if ($user_data->ID === $sensfrx_whitelisting_check_email) {



				$sensfrx_whitelisting_check = true;



				break;



			}



		}



		if(true === $sensfrx_whitelisting_check && true === $sensfrx_whitelisting_check_checkbox_allow) {



			return;



		} else {



			$sensfrx_master_fraud_allow = $sensfrx_policy_options['sensfrx_master_fraud'];



			if ($sensfrx_master_fraud_allow) {



				$sensfrx_master_fraud_allow = true;



			} else {



				$sensfrx_master_fraud_allow = false;



			}



			if ( true == $sensfrx_master_fraud_allow) {



				$sensfrx_bot_fraud_allow = $sensfrx_policy_options['sensfrx_bot_fraud'];



				if ($sensfrx_bot_fraud_allow) {



					$sensfrx_bot_fraud_allow = true;



				} else {



					$sensfrx_bot_fraud_allow = false;



				}



				if ( true == $sensfrx_bot_fraud_allow) {



					if (isset($user_id)) {



						if (isset($options['sensfrx_property_id']) && isset($options['sensfrx_property_secret'])) {



							$obj = new SensFRX\SensFRX([



								'property_id' => $options['sensfrx_property_id'],



								'property_secret' => $options['sensfrx_property_secret']



							]);



							$res_bot = $obj->isBot($device_id, $user_id);



						}	



					} else {



						if (isset($options['sensfrx_property_id']) && isset($options['sensfrx_property_secret'])) {



							$obj = new SensFRX\SensFRX([



								'property_id' => $options['sensfrx_property_id'],



								'property_secret' => $options['sensfrx_property_secret']



							]);



							$res_bot = $obj->isBot($device_id, '');



						}



					}



					$customer = WC()->customer;



					if ($customer) {



						$first_name = $customer->get_first_name(); 



						$last_name = $customer->get_last_name(); 



						$email = $customer->get_email();



					} else {



						$first_name = ''; 



						$last_name = ''; 



						$email = '';



					}



					if ($res_bot) {



						if (isset($options['sensfrx_property_id']) && isset($options['sensfrx_property_secret'])) {

							if (isset($res_bot['status']) && $res_bot['status'] === 'error' && isset($res_bot['error']) && $res_bot['error'] === 'USE_CASE_DISABLED') {

								$errorMessage = $res_bot['message'] ?? 'Something went wrong';

								$user_email_ato = $email;

								

								global $wpdb;

								$sensfrx_ato_table_name = esc_sql( $wpdb->prefix . 'sensfrx_real_activity' );



								// Table names are identifiers and cannot be parameterized. Using esc_sql() for table name, prepare() for WHERE values.

								$existing_logs = $wpdb->get_results( 

									

									$wpdb->prepare(

										// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name is sanitized with esc_sql(). WHERE value is properly prepared with %s placeholder.

										"SELECT * FROM {$sensfrx_ato_table_name} WHERE sensfrx_log_type = %s AND sensfrx_log1 LIKE %s AND sensfrx_log1 LIKE %s AND created_at >= (UTC_TIMESTAMP() - INTERVAL 10 MINUTE)",

										'Bot Security',

										'%' . $wpdb->esc_like( $user_email_ato ) . '%',

										'%' . $wpdb->esc_like( $errorMessage ) . '%'

									), 

									ARRAY_A



								);

								// Only insert if not found in the last 10 minutes

								if (empty($existing_logs)) {

									$insert_data = "User " . $user_email_ato . " attempted a bot activity. The User was approved. Cause: " . $errorMessage;

									SensFRX_DB_Helper::insert_activity_log('Bot Security', $insert_data);

								}

							} else {



								if (isset($res_bot['status']) && null !== $res_bot['status'] && isset($res_bot['severity']) && null !== $res_bot['severity']) {



									$status = $res_bot['status'];



									$severity = $res_bot['severity'];



									$site_title = get_bloginfo( 'name' );



									if($status == 'allow' || $status == 'challenge' || $status == 'low') {



										$sensfrx_approve = 'approved';



									} else {



										$sensfrx_approve = $status;



									}



									$obj = new SensFRX\SensFRX([



										'property_id' => $options['sensfrx_property_id'],



										'property_secret' => $options['sensfrx_property_secret']



								]);



								$res_shadow = SensFRX_DB_Helper::safe_select(

									'sensfrx_shadow_activity',

									'sensfrx_shadow_status',

									'',

									array(),

									'',

									ARRAY_A

								);



								if (is_array($res_shadow) && !empty($res_shadow) && isset($res_shadow[0]['sensfrx_shadow_status'])) {



										if ( '0' == $res_shadow[0]['sensfrx_shadow_status'] ) {



											if ( gettype(!empty($res_bot)) == 'string' ) {



												return;



											} else {



												if (isset($res_bot['status']) && null !== $res_bot['status'] && isset($res_bot['severity']) && null !== $res_bot['severity']) {



													if ('allow' == $status && 'medium' == $severity) {		



														$device = $res_bot['device'];



														$device = (array) $device;



													$to = $email;



													// Get default email content (no database customization)

													$default_email = SensFRX_email_template::get_default_message('webhook_deny');

													$trans_after_deny_subject = $default_email['subject'];

													$trans_after_deny_message = $default_email['message'];



													$date = date('Y M d');



													$time = date('H:i:s');



													$allowurl = site_url() . '?as_did_1337575=' . $device['device_id'] . '&asda_ac=1';



													$denyurl = site_url() . '?as_did_1337575=' . $device['device_id'] . '&asda_ac=0';



												$replacements = [



													'{$fullname}' => $first_name . ' ' . $last_name,



													'{$time}' => $time,



													'{$date}' => $date,



													'{$default_brand_name}' => $site_title,



													'{$client_full_name}' => $first_name . ' ' . $last_name,



												];



												// Use universal email wrapper for professional formatting



												$mailResult = SensFRX_email_template::wrap_and_send( $to, $trans_after_deny_subject, $trans_after_deny_message, $site_title, $replacements );



														$insert_data = $email . " attempted to bot activity. The bot activity was ". $sensfrx_approve ." due to risk score level of ". $severity .".";

														SensFRX_DB_Helper::insert_activity_log('Bot Security', $insert_data);



													} 



													if ('challenge' == $status && 'high' == $severity) {



														$device = $res_bot['device'];



														$device = (array) $device;



														$to = $email;



														global $wpdb;



														$template_trans_after_deny = 'Bot High';



														$table_name = esc_sql( $wpdb->prefix . 'sensfrx_email_templates' );



														$template_deny_trans_after = $wpdb->get_row(



															$wpdb->prepare(

																// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name is sanitized with esc_sql(). WHERE value is properly prepared with %s placeholder.

																"SELECT * FROM {$table_name} WHERE name1 = %s",





																$template_trans_after_deny



															)



														);



														if ($template_deny_trans_after) {



															$trans_after_deny_subject = $template_deny_trans_after->subject1;



															$trans_after_deny_message = $template_deny_trans_after->message1;



														} else {



															$trans_after_deny_subject = 'Default Subject';



															$trans_after_deny_message = 'Default Msesage';



														}



														$date = date('Y M d');



														$time = date('H:i:s');



														$allowurl = site_url() . '?as_did_1337575=' . $device['device_id'] . '&asda_ac=1';



														$denyurl = site_url() . '?as_did_1337575=' . $device['device_id'] . '&asda_ac=0';



													$replacements = [



														'{$fullname}' => $first_name . ' ' . $last_name,



														'{$time}' => $time,



														'{$date}' => $date,



														'{$allow_url}' => $allowurl,



														'{$deny_url}' => $denyurl,



														'{$default_brand_name}' => $site_title,



													];



													// Use universal email wrapper for professional formatting



													$mailResult = SensFRX_email_template::wrap_and_send( $to, $trans_after_deny_subject, $trans_after_deny_message, $site_title, $replacements );



														$user_email_ato = $email;



														$insert_data = $user_email_ato . " attempted to bot activity. The bot activity was ". $sensfrx_approve ." due to risk score level of ". $severity .".";



														SensFRX_DB_Helper::insert_activity_log('Bot Security', $insert_data);



													}



													if ('deny' == $status && 'critical' == $severity) {		



														$device = $res_bot['device'];



														$device = (array) $device;



													$to = $email;



													// Get default email content (no database customization)

													$default_email = SensFRX_email_template::get_default_message('webhook_deny');

													$trans_after_deny_subject = $default_email['subject'];

													$trans_after_deny_message = $default_email['message'];



													$date = date('Y M d');



														$time = date('H:i:s');



														$allowurl = site_url() . '?as_did_1337575=' . $device['device_id'] . '&asda_ac=1';



														$denyurl = site_url() . '?as_did_1337575=' . $device['device_id'] . '&asda_ac=0';



													$replacements = [



														'{$client_full_name}' => $first_name . ' ' . $last_name,



														'{$time}' => $time,



														'{$date}' => $date,



														'{$default_brand_name}' => $site_title,



													];



													// Use universal email wrapper for professional formatting



													$mailResult = SensFRX_email_template::wrap_and_send( $to, $trans_after_deny_subject, $trans_after_deny_message, $site_title, $replacements );



														$user_email_ato = $email;



														$insert_data = $user_email_ato . " attempted to bot activity. The bot activity was ". $sensfrx_approve ." due to risk score level of ". $severity .".";



														SensFRX_DB_Helper::insert_activity_log('Bot Security', $insert_data);



														$current_user = wp_get_current_user();



														$results = retrieve_password($current_user->user_login);									



														if ( true === $results ) {



															$message = 'Your account is blocked due to Suspicious Bot Activities. We have sent a password reset email, please reset your password to activate your account again.';



														} else {



															$message = $results->get_error_message();



														}



														$login_url = site_url( 'wp-login.php?action=as_ch_dn&as_msg=' . urlencode($message), 'login' );



														wp_logout();



														wp_safe_redirect( $login_url );



													} 



												}	



											}



										} else {



											$user_email_ato = $email;



											$insert_data = "User " . $user_email_ato . " attempted a bot activity. Sensfrx flagged the log in with a " . $severity . " risk score. but since Shadow Mode was enabled, it was allowed.";



											// Add 10-minute limit check to prevent duplicate logs on every refresh

											global $wpdb;

											$sensfrx_ato_table_name = esc_sql( $wpdb->prefix . 'sensfrx_real_activity' );



											// Table names are identifiers and cannot be parameterized. Using esc_sql() for table name, prepare() for WHERE values.

											$existing_logs = $wpdb->get_results(

												

												$wpdb->prepare(

													// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name is sanitized with esc_sql(). WHERE value is properly prepared with %s placeholder.

													"SELECT * FROM {$sensfrx_ato_table_name} WHERE sensfrx_log_type = %s AND sensfrx_log1 LIKE %s AND sensfrx_log1 LIKE %s AND created_at >= (UTC_TIMESTAMP() - INTERVAL 10 MINUTE)",

													'Bot Security',

													'%' . $wpdb->esc_like( $user_email_ato ) . '%',

													'%' . $wpdb->esc_like( $severity ) . ' risk score. but since Shadow Mode was enabled, it was allowed.%'

												),

												ARRAY_A

											

											);

											// Only insert if not found in the last 10 minutes

											if (empty($existing_logs)) {

												SensFRX_DB_Helper::insert_activity_log('Bot Security', $insert_data);

											}



										}



									} else {



										$user_email_ato = $email;



										$insert_data = "User " . $user_email_ato . " attempted a bot activity. An error occurred while fetching Shadow Mode data.";



										SensFRX_DB_Helper::insert_activity_log('Bot Security', $insert_data);



									}



								}



							}



						}



					}



				}



			} 



		}



	}



}



