|
|
Line 21: |
Line 21: |
| } | | } |
| ?></php> | | ?></php> |
− | [[Category:MediaWiki]]
| |
Latest revision as of 05:17, 23 July 2011
|
Legacy: This article describes a concept that has been superseded in the course of ongoing development on the Organic Design wiki. Please do not develop this any further or base work on this concept, this is only useful for a historic record of work done. You may find a link to the currently used concept or function in this article, if not you can contact the author to find out what has taken the place of this legacy item.
|
|
<php><?
- Log user login activity
function monitorUserLogin(&$text) {
$entry = ;
if (preg_match('/
Login error:<\\/h2>\\s*(.+?)\\s*<\\/div>/',$text,$error)) $entry = "Login Error: $error[1]";
else if (preg_match('/You are now logged in to .+? as "(.+?)".<\\/b>/',$text,$user))
$entry = "User Login: [[User:$user[1]]] has logged in sucecssfuly";
if ($entry) {
$ts = $GLOBALS['wgLang']->timeanddate(wfTimestampNow(),true);
$la = new Article(Title::newFromText('Event log'));
$log = $la->fetchContent(0,false,false);
$log .= "\n*$ts: $entry";
$log .= "\n:IP Address: ".$_SERVER['REMOTE_ADDR'];
$log .= "\n:User Agent: ".$_SERVER['HTTP_USER_AGENT'];
$log .= "\n:Cookie: ".$_SERVER['HTTP_COOKIE'];
$log .= "\n:Query-string: ".$_SERVER['QUERY_STRING'];
$la->quickEdit($log);
}
}
?></php>