Difference between revisions of "MonitorUserLogin.php"
From Organic Design wiki
(Azzuro login monitor done and tested) |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | <? | + | {{legacy}} |
+ | {{info|Logging of user logins, logouts and login errors is now handled by the [[MW:Extension:UserLoginLog|UserLoginLog extension]]. The code for UserLoginLog is [[Extension:UserLoginLog.php]].}} | ||
+ | <php><? | ||
# Log user login activity | # Log user login activity | ||
function monitorUserLogin(&$text) { | function monitorUserLogin(&$text) { | ||
Line 5: | Line 7: | ||
if (preg_match('/<h2>Login error:<\\/h2>\\s*(.+?)\\s*<\\/div>/',$text,$error)) $entry = "'''Login Error:''' $error[1]"; | if (preg_match('/<h2>Login error:<\\/h2>\\s*(.+?)\\s*<\\/div>/',$text,$error)) $entry = "'''Login Error:''' $error[1]"; | ||
else if (preg_match('/<b>You are now logged in to .+? as "(.+?)".<\\/b>/',$text,$user)) | else if (preg_match('/<b>You are now logged in to .+? as "(.+?)".<\\/b>/',$text,$user)) | ||
− | $entry = "'''User Login:''' User:$user[1] has logged in sucecssfuly"; | + | $entry = "'''User Login:''' [[User:$user[1]]] has logged in sucecssfuly"; |
if ($entry) { | if ($entry) { | ||
$ts = $GLOBALS['wgLang']->timeanddate(wfTimestampNow(),true); | $ts = $GLOBALS['wgLang']->timeanddate(wfTimestampNow(),true); | ||
Line 18: | Line 20: | ||
} | } | ||
} | } | ||
− | ?> | + | ?></php> |
Latest revision as of 05:17, 23 July 2011
<php><?
- Log user login activity
function monitorUserLogin(&$text) { $entry = ;
if (preg_match('/