Ignore:
Timestamp:
Jul 17, 2005, 5:06:39 PM (19 years ago)
Author:
plg
Message:
  • new feature : use Apache authentication. If $confapache_authentication is set true : if no user matches $_SERVERREMOTE_USER in "users" table, PWG automatically creates one. This way, users can customize the behaviour of the application.
  • template : new organisation of identification menu (category.php). Simplification is required for Apache authentication (no logout link even if user is externally logged in)
  • new : usernames can contain quotes (required because Apache authentication authorized quotes in usernames)
File:
1 edited

Legend:

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

    r787 r804  
    9292}
    9393
     94// using Apache authentication override the above user search
     95if ($conf['apache_authentication'] and isset($_SERVER['REMOTE_USER']))
     96{
     97  $query = '
     98SELECT id
     99  FROM '.USERS_TABLE.'
     100  WHERE username = \''.mysql_escape_string($_SERVER['REMOTE_USER']).'\'
     101;';
     102  $result = pwg_query($query);
     103
     104  if (mysql_num_rows($result) == 0)
     105  {
     106    register_user($_SERVER['REMOTE_USER'], '', '', '');
     107
     108    $query = '
     109SELECT id
     110  FROM '.USERS_TABLE.'
     111  WHERE username = \''.mysql_escape_string($_SERVER['REMOTE_USER']).'\'
     112;';
     113    list($user['id']) = mysql_fetch_row(pwg_query($query));
     114  }
     115  else
     116  {
     117    list($user['id']) = mysql_fetch_row($result);
     118  }
     119
     120  $user['is_the_guest'] = false;
     121}
     122
    94123$query = '
    95124SELECT u.*, uf.*
Note: See TracChangeset for help on using the changeset viewer.