chart_user_login_ips - warwickfoster/qurantools GitHub Wiki

File: app/charts/chart_user_login_ips.php

Purpose

The provided PHP code generates a FusionCharts pie chart that displays the distribution of login IP addresses for a specific user.

User Access

  • Only administrators can access this page.
  • The user ID to be analyzed is passed as a GET parameter called "USER".

Chart Configuration

  • The chart type is set to "pie2d".
  • The chart theme is "fint".
  • The chart title and subcaption are dynamically set based on the user ID.
  • The chart displays two data series:
    • Login IP address
    • Number of logins from each IP address

Data Retrieval

  • The db_query() function retrieves data from the LOGIN-LOGS table for the specified user, grouped by login IP address.
  • The data is sorted in descending order of login count.

Chart Rendering

  • The FusionCharts JavaScript library renders the chart based on the retrieved data.
  • Each data point represents a login IP address and its corresponding count.
  • Users can click on a data point to view the IP address details using a link provided in the tooltip.

Additional Features

  • The chart can be sorted by login count using a GET parameter called "SORT".
  • The chart displays the percentage of logins for each IP address in the tooltip.

Overall Function

The page provides a visual representation of the login IP addresses used by a specific user, helping administrators analyze user activity and identify potential security issues.