Ignore:
Timestamp:
Oct 19, 2006, 2:41:07 AM (18 years ago)
Author:
rvelices
Message:

feature 564: logs in the history table each user login
feature 562: possibility to log page visits for any combination of
administrators/users/guests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions.inc.php

    r1510 r1565  
    385385  global $conf, $user;
    386386
    387   if ($conf['log'])
    388   {
    389    if (($conf['history_admin']) or ((! $conf['history_admin'])
    390        and (!is_admin())))
    391     {
     387  if ( is_admin() )
     388  {
     389    $doit=$conf['history_admin'];
     390  }
     391  elseif ( $user['is_the_guest'] )
     392  {
     393    $doit=$conf['history_guest'];
     394  }
     395  else
     396  {
     397    $doit = $conf['log'];
     398  }
     399
     400  if ($doit)
     401  {
    392402    $login = ($user['id'] == $conf['guest_id'])
    393403      ? 'guest' : addslashes($user['username']);
    394 
    395     $query = '
     404    insert_into_history($login, $file, $category, $picture);
     405  }
     406}
     407
     408function pwg_log_login( $username )
     409{
     410  global $conf;
     411  if ( $conf['login_history'] )
     412  {
     413    insert_into_history($username, 'login', '', '');
     414  }
     415}
     416
     417// inserts a row in the history table
     418function insert_into_history( $login, $file, $category, $picture)
     419{
     420  $query = '
    396421INSERT INTO '.HISTORY_TABLE.'
    397422  (date,login,IP,file,category,picture)
     
    404429  \''.addslashes($picture).'\')
    405430;';
    406     pwg_query($query);
    407   }
    408   }
     431  pwg_query($query);
    409432}
    410433
     
    462485}
    463486
    464 function pwg_stripslashes($value) 
     487function pwg_stripslashes($value)
    465488{
    466489  if (get_magic_quotes_gpc())
     
    471494}
    472495
    473 function pwg_addslashes($value) 
     496function pwg_addslashes($value)
    474497{
    475498  if (!get_magic_quotes_gpc())
     
    480503}
    481504
    482 function pwg_quotemeta($value) 
     505function pwg_quotemeta($value)
    483506{
    484507  if (get_magic_quotes_gpc()) {
     
    700723{
    701724  global $conf;
    702  
     725
    703726  $error = '<pre>';
    704727  $error.= $header;
     
    945968{
    946969  global $conf;
    947  
     970
    948971  $query = '
    949972SELECT param,value
     
    960983  {
    961984    $conf[ $row['param'] ] = isset($row['value']) ? $row['value'] : '';
    962    
     985
    963986    // If the field is true or false, the variable is transformed into a
    964987    // boolean value.
Note: See TracChangeset for help on using the changeset viewer.