Skip to content

Instantly share code, notes, and snippets.

@andripwn
Created December 25, 2019 10:32
Show Gist options
  • Save andripwn/2dc3572d63a9d6ccabc84dbe09a4b06f to your computer and use it in GitHub Desktop.
Save andripwn/2dc3572d63a9d6ccabc84dbe09a4b06f to your computer and use it in GitHub Desktop.
(Source IP Address Manipulation) - This plugin records the user’s IP address that has successfully logged in, using X-Forwarded-For HTTP header field.
$values = array(
'uid' => $uid,
'user_login' => $user_login,
'user_role' => $user_role,
'time' => current_time('mysql'),
'ip' => isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? esc_attr($_SERVER['HTTP_X_FORWARDED_FOR']) : esc_attr($_SERVER['REMOTE_ADDR']),
'login_result' => $this->login_success,
'data' => $serialized_data,
);
$format = array('%d', '%s', '%s', '%s', '%s', '%s', '%s');
$this->save_data($values, $format);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment