-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfraud-detection.php
More file actions
22 lines (19 loc) · 838 Bytes
/
Copy pathfraud-detection.php
File metadata and controls
22 lines (19 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
function detect_fraudulent_activity( $order_id ) {
if ( isset( $_COOKIE['affiliate_referral'] ) ) {
$affiliate_referral = sanitize_text_field( $_COOKIE['affiliate_referral'] );
$order = wc_get_order( $order_id );
$order_ip = $order->get_meta( '_customer_ip_address', true );
$affiliate_email = get_post_meta( $affiliate_referral, 'affiliate_email', true );
if ( $order_ip === $_SERVER['REMOTE_ADDR'] ) {
// Log fraudulent activity
$message = 'Possible fraudulent activity detected for affiliate ' . $affiliate_referral . ' with order ' . $order_id;
error_log( $message );
}
}
}
add_action( 'woocommerce_order_status_processing', 'detect_fraudulent_activity' );
?>