Difference between revisions of "Nats4 Member Logging"

From TMM Wiki
Jump to navigationJump to search
 
(21 intermediate revisions by 9 users not shown)
Line 3: Line 3:
 
}}
 
}}
  
You can tell NATS to keep a log of member logins. Send a HTTP GET
+
'''Note: <br>
request from your server to the PHP script, ''/special/loginlog.php''
+
''' -- This article is written for NATS 4 and NATS 5 <br />
with the site's ID number and the member's username. For example, you
+
Member logging is a feature in [[NATS4]] that allows you to direct [[NATS]] to keep a record of all [[Ct#Member|member]] logins. To use this feature, send a HTTP GET request from your server to the PHP script: ''member_loginlog.php'' with your selected [[Ct#Site|site]]'s [[ID Numbers|ID number]] and the [[Ct#Member|member]]'s username. NATS will add a log entry in that particular member's login history.
can add the following code to a PHP script and then run the script:
+
 
 +
For example, you can add the following code to a PHP script and then run it:
  
 
<pre>
 
<pre>
Line 14: Line 15:
 
</pre>
 
</pre>
  
To access this secure feature, the IP address of the server making the
+
These logs are a secure feature in [[NATS]]. As a result, the IP address of the server that is requesting information must be in the NATS configuration file (located in your <nats_directory>/includes/config.php) ''$config['SECURE_IPS']'' setting.
request must be in the following $config['SECURE_IPS'] configuration file
 
setting. For example,
 
  
$config['SECURE_IPS'] = Array('123.123.123.123');
+
For example:
  
Replace 123.123.123.123 with your server's IP address.
+
<pre>$config['SECURE_IPS'] = Array('123.123.123.123', '234.234.234.234'); </pre>
  
After activating this feature, the member's logins show up in the
+
Simply replace "123.123.123.123" in the above example code with your server's IP address.
[[Members Admin|Members Admin's]] members details.
+
 
 +
After this feature is activated, the specified member's login history will show up in the [[Members Admin|Members Admin's]] members details.  
 +
 
 +
To find the [[Ct#Member|member]]'s login log, go to the [[NATS4 Members Admin|Members Admin]], find the member you are tracking, and click the "View Member Details" icon. Scroll down to the bottom of the Member Details page to find the Login Log for your specified member.
 +
 
 +
[[File:Login_log.PNG|450px|Example of a Member Login Log]]
  
 
== Extra Features ==
 
== Extra Features ==
To add more than one site, use the siteids parameter:
+
If you are allowing members of one (1) site access to other NATS sites, you can specify multiple sites in the siteid parameter. If there are multiple siteids specified, NATS will use those siteids to find a member record match. NATS will 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 site 5, 64, and 2 access to each other. With the following URL, NATS will locate Member A and record the login.<br>
 +
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.<br><br>
  
 
<pre>
 
<pre>
$url="http://www.server.com/member_loginlog.php?username=$_SERVER[REMOTE_USER]&siteids=5,64,2&ip=$_SERVER[REMOTE_ADDR]";
+
$url="http://www.server.com/member_loginlog.php?username=$_SERVER[REMOTE_USER]&siteid=5,64,2&ip=$_SERVER[REMOTE_ADDR]";
 
</pre>
 
</pre>
  
 
[[Category:Also NATS4 Article]]
 
[[Category:Also NATS4 Article]]
 +
[[Category:NATS4 Members Admin]]

Latest revision as of 07:00, 2 August 2021

NATS 4
Members Admin
The Members Admin
View Member Details
Add Member
MySQL Auth
Mod Authn DB
Multisite Access
Member Logging
Member Password Retrieval
OpenID Connect
Mod Auth OpenIDC
ID Numbers

Note:
-- This article is written for NATS 4 and NATS 5
Member logging is a feature in NATS4 that allows you to direct NATS to keep a record of all member logins. To use this feature, send a HTTP GET request from your server to the PHP script: member_loginlog.php with your selected site's ID number 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:

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

@file($url);

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

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.

After this feature is activated, the specified member's login history will show up in the Members Admin's members details.

To find the member's login log, go to the Members Admin, find the member you are tracking, and click the "View Member Details" icon. Scroll down to the bottom of the Member Details page to find the Login Log for your specified member.

Example of a Member Login Log

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. If there are multiple siteids specified, NATS will use those siteids to find a member record match. NATS will 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 site 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.

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