> For the complete documentation index, see [llms.txt](https://docs.toomuchmedia.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.toomuchmedia.com/nats-admin/members/further-reading/member-logging.md).

# Member Logging

*Article Topics:* [*Members*](https://docs.toomuchmedia.com/getting-started/common-topics/members.md)

Member logging is a feature in [NATS](https://docs.toomuchmedia.com/additional-resources/common-terms.md#nats) that allows you to direct NATS to keep a record of all [member](https://docs.toomuchmedia.com/additional-resources/common-terms.md#member) logins when your member authentication and/or Member Area is on a different server than your NATS server.

## Setup

To use this feature, send an HTTPS GET request from your server to the PHP script: *member\_loginlog.php* with your selected [site's ](https://docs.toomuchmedia.com/additional-resources/common-terms.md#site)[ID number](https://docs.toomuchmedia.com/using-nats/nats-admin-features/id-numbers.md) and the member's username. NATS will add a log entry in that particular member's login history.

For example, you can add the following code to a PHP script and then run it:

{% code overflow="wrap" %}

```
$url="https://www.example.com/member_loginlog.php?username=$_SERVER[REMOTE_USER]&siteid=123&ip=$_SERVER[REMOTE_ADDR]";

@file($url);
```

{% endcode %}

These logs are a secure feature in NATS. As a result, the IP address of the server requesting information must be in the $ config \['SECURE\_IPS'] setting in the NATS configuration file (located in your \<nats\_directory>/includes/config.php).

For example:

```
$config['SECURE_IPS'] = Array('123.123.123.123', '234.234.234.234'); 
```

Simply replace "123.123.123.123" in the above example code with your server's IP address.

## Member Logging

Only after this feature is activated will the specified member's login history show up under the [Logins](https://docs.toomuchmedia.com/nats-admin/members/member-overview.md#login-log-tab) tab in the Members Admin.

<figure><img src="https://2232071635-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FWJVne6meHqGT8rzsBdod%2Fuploads%2FQvdP5bOg4oeBBe7dHjsS%2Fimage.png?alt=media&amp;token=597ac9ee-e2b9-4ee4-aa6b-7c9a8f88c061" alt=""><figcaption></figcaption></figure>

## Extra Features

If you are allowing members of one (1) site access to other NATS sites, you can specify multiple sites in the siteid parameter in the URL.

If there are multiple siteids specified, NATS will use those siteids to find a member record match. NATS will then record the login to only one (1) Member record.

Consider the following:

1\) Member A has a membership to site 5. You grant all members of sites 5, 64, and 2 access to each other. With the following URL, NATS will locate Member A and record the login.

\
2\) Member A has a membership to sites 5 and 64, as Member B. You grant all members of site 5, 64, and 2 access to each other. With the following URL, NATS will locate either Member A or Member B and record only one (1) login, depending on the first record returned from the database. So, it could be recorded on Member A or Member B, but not both.

{% code overflow="wrap" %}

```
$url="https://www.server.com/member_loginlog.php?username=$_SERVER[REMOTE_USER]&siteid=5,64,2&ip=$_SERVER[REMOTE_ADDR]";
```

{% endcode %}

## Related Articles

{% content-ref url="/pages/uiooj2nhq58MF6kad0iF" %}
[Password Sharing Prevention](https://docs.toomuchmedia.com/nats-admin/members/login-protection/password-sharing-prevention.md)
{% endcontent-ref %}

{% content-ref url="/pages/AYoXjX9qtkNnBqrBlNvW" %}
[Login Protection](https://docs.toomuchmedia.com/nats-admin/members/login-protection.md)
{% endcontent-ref %}
