2011-02-25, 08:27 AM
function iplog_exec(), in file iplog.php @ line 72, only works if the login attempt succeeded; otherwise, $user['uid'] is empty, causing an SQL error upon Insert of the
Note that
Proposed fix (which I've just tried successfully):
Thanks.
uid
column data (i.e., '' ) into table iplogs
.Note that
iplogs
.uid
is an Integer column; and besides, what good is logging the IP if you don't know what the uid
(or who the user) is.Proposed fix (which I've just tried successfully):
function iplog_exec()
{
global $user, $db;
// ***** Added if() condition to prevent SQL error after failed login
if ( isset( $user['uid'] ) && !empty( $user['uid'] ) ) {
$values = array(
'uid' => $db->escape_string( $user['uid'] ),
'ipaddress' => $db->escape_string( get_ip() ),
'dateline' => $db->escape_string( time() )
);
$db->insert_query( 'iplogs', $values );
}
}
Thanks.