Fix account_id use in update_lastlogin to use get_account_id; formatting

This commit is contained in:
Miles Lott 2001-03-26 21:36:32 +00:00
parent 5f06d2940e
commit e2afce4073
4 changed files with 134 additions and 125 deletions

View File

@ -26,8 +26,8 @@
class auth class auth
{ {
function authenticate($username, $passwd)
function authenticate($username, $passwd) { {
global $phpgw_info, $phpgw, $PHP_AUTH_USER; global $phpgw_info, $phpgw, $PHP_AUTH_USER;
if (isset($PHP_AUTH_USER)) { if (isset($PHP_AUTH_USER)) {
@ -36,6 +36,7 @@
return False; return False;
} }
} }
function change_password($old_passwd, $new_passwd) { function change_password($old_passwd, $new_passwd) {
global $phpgw_info, $phpgw; global $phpgw_info, $phpgw;
return False; return False;

View File

@ -26,7 +26,6 @@
class auth class auth
{ {
function authenticate($username, $passwd) { function authenticate($username, $passwd) {
global $phpgw_info, $phpgw; global $phpgw_info, $phpgw;
// error_reporting MUST be set to zero, otherwise you'll get nasty LDAP errors with a bad login/pass... // error_reporting MUST be set to zero, otherwise you'll get nasty LDAP errors with a bad login/pass...
@ -82,15 +81,16 @@
return $encrypted_passwd; return $encrypted_passwd;
} }
function update_lastlogin($account_lid, $ip) function update_lastlogin($account_id, $ip)
{ {
global $phpgw; global $phpgw;
$account_id = get_account_id($account_id);
$now = time(); $now = time();
$phpgw->db->query("update phpgw_accounts set account_lastloginfrom='" $phpgw->db->query("update phpgw_accounts set account_lastloginfrom='"
. "$ip', account_lastlogin='" . $now . "$ip', account_lastlogin='" . $now
. "' where account_lid='$account_lid'",__LINE__,__FILE__); . "' where account_id='$account_id'",__LINE__,__FILE__);
} }
} }
?> ?>

View File

@ -25,25 +25,31 @@
class auth class auth
{ {
function authenticate($username, $passwd)
function authenticate($username, $passwd) { {
global $phpgw_info, $phpgw; global $phpgw_info, $phpgw;
error_reporting(error_reporting() - 2); error_reporting(error_reporting() - 2);
if ($phpgw_info['server']['mail_login_type'] == 'vmailmgr')
if ($phpgw_info['server']['mail_login_type'] == 'vmailmgr') { {
$username = $username . '@' . $phpgw_info['server']['mail_suffix']; $username = $username . '@' . $phpgw_info['server']['mail_suffix'];
} }
if ($phpgw_info['server']['mail_server_type']=='imap') { if ($phpgw_info['server']['mail_server_type']=='imap')
{
$phpgw_info['server']['mail_port'] = '143'; $phpgw_info['server']['mail_port'] = '143';
} elseif ($phpgw_info['server']['mail_server_type']=='pop3') { }
elseif ($phpgw_info['server']['mail_server_type']=='pop3')
{
$phpgw_info['server']['mail_port'] = '110'; $phpgw_info['server']['mail_port'] = '110';
} }
if( $phpgw_info['server']['mail_server_type']=='pop3') { if( $phpgw_info['server']['mail_server_type']=='pop3')
{
$mailauth = imap_open('{'.$phpgw_info['server']['mail_server'].'/pop3' $mailauth = imap_open('{'.$phpgw_info['server']['mail_server'].'/pop3'
.':'.$phpgw_info['server']['mail_port'].'}INBOX', $username , $passwd); .':'.$phpgw_info['server']['mail_port'].'}INBOX', $username , $passwd);
} else { //assume imap }
else
{ //assume imap
$mailauth = imap_open('{'.$phpgw_info['server']['mail_server'] $mailauth = imap_open('{'.$phpgw_info['server']['mail_server']
.':'.$phpgw_info['server']['mail_port'].'}INBOX', $username , $passwd); .':'.$phpgw_info['server']['mail_port'].'}INBOX', $username , $passwd);
} }
@ -56,6 +62,7 @@
return True; return True;
} }
} }
function change_password($old_passwd, $new_passwd) { function change_password($old_passwd, $new_passwd) {
global $phpgw_info, $phpgw; global $phpgw_info, $phpgw;
return False; return False;

View File

@ -26,7 +26,6 @@
class auth class auth
{ {
function authenticate($username, $passwd) function authenticate($username, $passwd)
{ {
global $phpgw_info, $phpgw; global $phpgw_info, $phpgw;
@ -62,6 +61,8 @@
{ {
global $phpgw; global $phpgw;
$account_id = get_account_id($account_id);
$phpgw->db->query("update phpgw_accounts set account_lastloginfrom='" $phpgw->db->query("update phpgw_accounts set account_lastloginfrom='"
. "$ip', account_lastlogin='" . time() . "$ip', account_lastlogin='" . time()
. "' where account_id='$account_id'",__LINE__,__FILE__); . "' where account_id='$account_id'",__LINE__,__FILE__);