Difference between revisions of "Nobots.php"
(Better comments) |
m |
||
| Line 19: | Line 19: | ||
$xwBot = $_REQUEST['wpName']; | $xwBot = $_REQUEST['wpName']; | ||
if ( $_REQUEST['xwSpecies'] != 'meat' ) { | if ( $_REQUEST['xwSpecies'] != 'meat' ) { | ||
| − | + | $url = $_SERVER['HTTP_HOST']."/wiki/index.php?title=No+Bots!&xwBot=$xwBot"; | |
| + | header( "Location: http://$url" ); | ||
exit; | exit; | ||
} | } | ||
Revision as of 09:45, 3 March 2006
<?
- Add an "I am a human" checkbox to stop spambots for a while
global $xwUserName; $comment = ;
if ( $event == 'view' ) { # Called after rendering login form $article = preg_replace( "/(Your email\\*:.+?)<\\/tr>/is",
"$1<input type='checkbox' name='xwSpecies' value='meat'>Yes I'm a meat creature",
$article ); $article = str_replace( '(new users only)', '(new users only - no robots!)', $article ); } elseif ( $event == 'init' ) { # Called before processing posted login form xwSetProperty( $properties, 'xpath:/properties:view', $tTitle ); if ( $_REQUEST['wpCreateaccount'] ) { $xwBot = $_REQUEST['wpName']; if ( $_REQUEST['xwSpecies'] != 'meat' ) { $url = $_SERVER['HTTP_HOST']."/wiki/index.php?title=No+Bots!&xwBot=$xwBot"; header( "Location: http://$url" ); exit; } $comment = "User:$xwBot successfully created from IP $xwUserName"; } } elseif ( $event == 'data' && ( $xwBot = $_REQUEST['xwBot'] ) ) { # This is called from the "No Bots!" page $comment = "Attempt from IP $xwUserName to create user \"$xwBot\" denied ;-)"; }
- Append the XmlWiki log article if there's a comment
if ( $comment ) { global $wgLang; $ts = $wgLang->timeanddate( wfTimestampNow(), true ); $log = xwArticleContent( 'XmlWiki Log' )."\n*$ts : $comment"; $a = new Article( Title::makeTitle( 0, 'XmlWiki Log' ) ); $a->quickEdit( $log ); } ?>



