You are here

function statistics_access_log in Drupal 4

Same name and namespace in other branches
  1. 5 modules/statistics/statistics.module \statistics_access_log()
  2. 6 modules/statistics/statistics.admin.inc \statistics_access_log()
  3. 7 modules/statistics/statistics.admin.inc \statistics_access_log()
1 string reference to 'statistics_access_log'
statistics_menu in modules/statistics.module
Implementation of hook_menu().

File

modules/statistics.module, line 156
Logs access statistics for your site.

Code

function statistics_access_log($aid) {
  $result = db_query('SELECT a.*, u.name FROM {accesslog} a LEFT JOIN {users} u ON a.uid = u.uid WHERE aid = %d', $aid);
  if ($access = db_fetch_object($result)) {
    $output = '<table border="1" cellpadding="2" cellspacing="2">';
    $output .= ' <tr><th>' . t('URL') . "</th><td>" . l(url($access->path, NULL, NULL, TRUE), $access->path) . "</td></tr>";
    $output .= ' <tr><th>' . t('Title') . '</th><td>' . $access->title . '</td></tr>';

    // safe because it comes from drupal_get_title()
    $output .= ' <tr><th>' . t('Referrer') . "</th><td>" . ($access->url ? l($access->url, $access->url) : '') . "</td></tr>";
    $output .= ' <tr><th>' . t('Date') . '</th><td>' . format_date($access->timestamp, 'large') . '</td></tr>';
    $output .= ' <tr><th>' . t('User') . '</th><td>' . theme('username', $access) . '</td></tr>';
    $output .= ' <tr><th>' . t('Hostname') . '</th><td>' . check_plain($access->hostname) . '</td></tr>';
    $output .= '</table>';
    return $output;
  }
  else {
    drupal_not_found();
  }
}