Deepu3110 Posted August 29, 2020 Share Posted August 29, 2020 Hi I want to show Last logged IP of clients and that login details will shown in whmcs client area like: Last logged in on Aug 29, 2020, 11:02 AM (EST) <?php function ipxcoreaddIPToList($vars) { $userid = $vars['userid']; $ipaddress = $_SERVER["HTTP_CF_CONNECTING_IP"]; $desc = "Client area login from: " . gethostbyaddr($ipaddress); $user = "Client"; $nowTS = date("Y-m-d H:i:s"); $dataadd = array("date" => $nowTS, "userid"=>$userid, "ipaddr"=>$ipaddress, "description"=>$desc, "user"=>$user); insert_query("tblactivitylog", $dataadd); } add_hook('ClientLogin', 1, 'ipxcoreaddIPToList'); ?> I have the above code but it show in the Client log details. I want to show that in the whmcs client area so that client can know from which ip along with date and time they have last login to the whmcs client area. 0 Quote Link to comment Share on other sites More sharing options...
ManagedCloud-Hosting Posted August 29, 2020 Share Posted August 29, 2020 Any specific reasons for showing that to a client ? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 29, 2020 Share Posted August 29, 2020 1 hour ago, Deepu3110 said: I have the above code but it show in the Client log details. by definition, tha thook is just logging the current login details to the activity log. https://github.com/damianharouff/whmcshook-recordlogin/blob/master/ipxcore-addUserIPtoTable.php Quote Place this file into your WHMCS dir /includes/hooks/ and it will then record all client area logins to the client's activity log. Please keep in mind that it will record "Login as Client" logins from the admin interface, too. 1 hour ago, Deepu3110 said: I want to show that in the whmcs client area so that client can know from which ip along with date and time they have last login to the whmcs client area. you mean not the current login, but the one before that ? (if it's the current login, that's easy). three thoughts... if your above hook that logs the IP details is working, then to show those details in the client area would require another hook to pull that information from the tblactivitylog table... though i'd be inclined to use a separate table to store those details as it should make the retrieval coding simpler. I think ClientLogin hook point gets deprecated in v8 and replaced with UserLogin - so the above hook as written might not work immediately in v8. the thread below might be useful where Dennis expands on the complication of v8 users potentially having multiple accounts...... it's a pity he posted that in developer corner... if it had been the v8 beta forums, someone from WHMCS might have seen it. I think to do what you want in v7, e.g log and retrieve login details, would be simple enough - these days you wouldn't really need server variables and you should be able to do everything with the model classes... however. from what Dennis is saying, it might not be so straightforward in v8 - though that depends on the v8 technical docs and they might not be released until after v8 goes GA... and I wouldn't waste time trying to figure out whether it would work in v8 until it goes GA. 36 minutes ago, VirtualWorldGlobal said: Any specific reasons for showing that to a client ? I assume so that the user can see whether the last login was them... so might be useful to show only if the current login IP is different from the previous one.... and anyway, there's no guarantee that the user even knows their own IP address! 0 Quote Link to comment Share on other sites More sharing options...
ManagedCloud-Hosting Posted August 29, 2020 Share Posted August 29, 2020 3 minutes ago, brian! said: I assume so that the user can see whether the last login was them... so might be useful to show only if the current login IP is different from the previous one.... and anyway, there's no guarantee that the user even knows their own IP address! Yes actually if only the user knows / remembers his last login IP or only if they use a Static IP, cPanel shows last login but I haven't seen many who actually check the login... 0 Quote Link to comment Share on other sites More sharing options...
Deepu3110 Posted August 29, 2020 Author Share Posted August 29, 2020 Hi @vitualworldglobal and @brian Can we just show like this Last logged in on Aug 29, 2020, 11:02 AM (EST) only date and time in client area. 0 Quote Link to comment Share on other sites More sharing options...
Deepu3110 Posted August 29, 2020 Author Share Posted August 29, 2020 32 minutes ago, VirtualWorldGlobal said: Yes actually if only the user knows / remembers his last login IP or only if they use a Static IP, cPanel shows last login but I haven't seen many who actually check the login... Can we just show like this Last logged in on Aug 29, 2020, 11:02 AM (EST) only date and time in client area. 0 Quote Link to comment Share on other sites More sharing options...
rugg Posted March 7, 2023 Share Posted March 7, 2023 Hi, at systemactivitylog.php , the description will only be Client area login from: x.x.x.x, is it possible to add client name or id as following Client area login from: x.x.x.x, name yyy,id zzz 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.