Track Table Access

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
AhmedBR
AppGini Super Hero
AppGini Super Hero
Posts: 327
Joined: 2013-09-19 10:23

Track Table Access

Post by AhmedBR » 2016-04-05 23:30

I use the following code in table_init Hook to track table access and save it to a database.

Code: Select all

    //////////////////////////////////////////////////////////////////////////
    // Access Table Monitoring
    $username=$memberInfo['username'];
    $ip=$memberInfo['IP'];
    $date=date("Y-m-d H:i:s A");
    $group = $memberInfo['groupID'];
    $session_id_now=session_id();
    $CurrentTable = CurrentTable();
    if ($username <> 'admin'){
    sql("INSERT INTO `AccessedTable` (`IP`, `Name`, `LogIn`,  `Group`,  `sessionID`, `Table`)
    VALUES (concat('http://ip-api.com/#','$ip'),'$username', '$date', '$group', '$session_id_now', '$CurrentTable')", $eo);};
    //////////////////////////////////////////////////////////////////////////
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper

Post Reply