Jump to content

Show Last 5 Client logins in admin area


Recommended Posts

Something I remembered that was in Clientexec. I just coded this. Edit whmcs\admin\templates\homepage.tpl, you can put it after the network status table look for the </table> part and paste this.

 

<h1>Last 5 Client Logins</h1>
<table width=100% bgcolor="#cccccc" cellspacing=1>
<tr style="background-color:#efefef;font-weight:bold;text-align:center"><td align="center">Client Name</td><td>Login Date/Time</td></tr>
{php}
$sql = 'SELECT *  FROM `tblclients` ORDER BY `tblclients`.`lastlogin`  DESC limit 5';
$result=mysql_query($sql) or die(mysql_error());  
//-create  while loop and loop through result set 
 while($row=mysql_fetch_array($result)){ 
    $name =$row['firstname']; 
    $surname =$row['lastname']; 
 $lastlogin =$row['lastlogin'];
 $id =$row['id'];
 print '<tr bgcolor="#ffffff"><td align="center"><a href="clientssummary.php?userid='.$id.'"/>'.$name.' '.$surname.'</a></td><td align="center">'.$lastlogin.'</td></tr>';
 }
 {/php}
</table>

Link to comment
Share on other sites

New version, changed to last 10, added IP and hostname.

 

<h1>Last 10 Client Logins</h1>
<table width=100% bgcolor="#cccccc" cellspacing=1>
<tr style="background-color:#efefef;font-weight:bold;text-align:center"><td align="center">Client Name</td><td>Login Date/Time</td><td>IP</td><td>Host</td></tr>
{php}
$sql = 'SELECT *  FROM `tblclients` ORDER BY `tblclients`.`lastlogin`  DESC limit 10';
$result=mysql_query($sql) or die(mysql_error());  
//-create  while loop and loop through result set 
 while($row=mysql_fetch_array($result)){ 
    $name =$row['firstname']; 
    $surname =$row['lastname']; 
 $lastlogin =$row['lastlogin'];
 $id =$row['id'];
    $ip =$row['ip'];
    $host =$row['host'];
 print '<tr bgcolor="#ffffff"><td align
    ="center"><a href="clientssummary.php?userid='.$id.'"/>'.$name.' '.$surname.'</a></td><td align="center">'.$lastlogin.'</td><td align="center">'.$ip.'</td><td align="center">'.$host.'</td>
</tr>';
 }
 {/php}
</table>

Link to comment
Share on other sites

this is a nice addition but for some reason it does not update the list , same 10 logins since i installed it . i have some clients opened support tickets from the client area but they are not on the list.

 

Try clear the template cache..

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated