New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Recording client area logins in WHMCS
Here's a hook to record WHMCS client area logins, along with IP address and RDNS host:
https://github.com/damianharouff/whmcshook-recordlogin
Put it into yourWHMCSdir/includes/hooks/ and it should begin showing logins under the Log tab on the client's profile. Example:
If you don't like the name of the file or function having "ipxcore" in it, feel free to change to whatever you'd like.
Also, thanks to @serverian for helping me with a hurr-durr problem with it before release.
Comments
Thanks, it's useful
Awesome stuff.
Where is that thanks button :-)
Interesting (from the client point of view). So WHMCS by default don't record clients logging into billing system? I would expect something like this implemented into any online billing system since beginning.
WHMCS only logs the initial sign up IP and the last login IP. I guess this would be useful if a client account was compromised etc.
Yes, exactly. For both, host and client. Even gmail record account activity with IPs. I would really expect from WHMCS this data stored and available atleast to host by default.
Me too!
That's actually why we started doing it: a client asked for a list of all the IPs that had logged into his WHMCS account, and we didn't have it available.
This is why I love @Damian. Thanks!
Max
@Damian is this possible to enable also for clients or too complicated? Something like gmail "Activity on this account" feature do. It's one of those lists I check regulary.
I love you.
Thank you for this hook!
Thanks Damian.
Tonight I will give you a reward.
Probably... would probably be best to change the "User" field or something easily searchable, since the activity log contains a lot of information that's not really interesting. Here's an example of a new client's activity log:
@Damian - thanks!
@Damian yeah, that's a lot of (for clients) irrelevant data. Anyway, useful hook - if I would be host I would want to have something like this in my whmcs for sure.
Thanks! Neat hook
oh I love you
I think i have already suggested this in the Features Request of WHMCS. WHMCS should also log more information, like Domain Contacts Info changes, Nameservers Changes, etc.
Just know this type of license
I'm just a tiny bit confused (outside of the RDNS part), doesn't WHMCS for a while have "recent client activity" on the front of the page with user name, IP address, and last access date/time?
But as others have said, having the ability to see what their actual last activity was, would be kind of nice.
It does, but it only shows the last five logins, and you can't see a history of logins by a specific client. This bridges that gap.
@Damian: I love you.
If you check the logs, it tells you when clients login.
Yes, that's what's displayed in the Log tab after you add my hook, as depicted in the image above.
If your WHMCS is behind CloudFlare, change line 9 from:
to:
@George_Fusioned only if remote_addr is a CF IP
https://www.cloudflare.com/ips
Best route is to let nginx real_ip handle it though
http://www.babaei.net/blog/2013/03/09/getting-real-ip-addresses-using-nginx-and-cloudflare/
You could actually extend it to work either way:
if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) { $ipaddress = $_SERVER['HTTP_CF_CONNECTING_IP']; } else if (isset($_SERVER['REMOTE_ADDR'])) { $ipaddress = $_SERVER['REMOTE_ADDR']; }
(edit) The formatting on 'new' Vanilla is brain damaged. Seriously, what kind of application thinks that newlines shouldn't be newlines?
@Damian I highly recommend going the nginx real_ip route ... speed, efficiency, global usage, log file IPs, and security.