Works great!
however I'm having security issues with users trying to log in to other peoples accounts. Failing, But trying. I've had several email complaints from the users who had emails sent to them stating someone tried logging into their account.
Actually, I just wrote it myself. using your code as a base. Here are the mods I did.
My hack for Logging Failed attempts
Two files now need to be modified to enable it. (Backup everything first)
First
./includes/function_login.php
Now look for the section for "Exec_strike_User". there will be a query inserting a strike into the system. Right before or after the code "$strikes++;" add the following code.
Code:
$vbulletin->db->query_write("INSERT INTO " . TABLE_PREFIX . "logins (userid, username, ipaddress, phpdate, logintype) VALUES (" . $vbulletin->userinfo['userid'] . ", '" . $vbulletin->db->escape_string($vbulletin->userinfo['username']) . "', '" . $vbulletin->db->escape_string(IPADDRESS) . "', " . TIMENOW . ", 'FAILED ATTEMPT')");
Save and update the file.
Now modify the following file
./adminCP/loginlog.php
Find the while loop
Code:
while ($log = $db->fetch_array($logs))
and add
Code:
else if ($log['logintype'] == 'FAILED ATTEMPT')
{
$log['logintype'] = "FAILED LOGIN";
}
now when you view the page, all failed logins will appear.