Difference between revisions of "Nobots.php"
m |
(Log robot login attempts) |
||
| Line 9: | Line 9: | ||
$article = str_replace( '(new users only)', '(new users only - no robots!)', $article ); | $article = str_replace( '(new users only)', '(new users only - no robots!)', $article ); | ||
} | } | ||
| − | + | elseif ( $event == 'init' ) { | |
xwSetProperty( $properties, 'xpath:/properties:view', $tTitle ); | xwSetProperty( $properties, 'xpath:/properties:view', $tTitle ); | ||
if ( $_REQUEST['wpCreateaccount'] ) { | if ( $_REQUEST['wpCreateaccount'] ) { | ||
if ( $_REQUEST['xwSpecies'] != 'meat' ) { | if ( $_REQUEST['xwSpecies'] != 'meat' ) { | ||
| − | header( "Location: http://" .$_SERVER['HTTP_HOST'].'/No+Bots!' ); | + | header( "Location: http://" .$_SERVER['HTTP_HOST'].'/index.php?title=No+Bots!&xwBot='.$_REQUEST['wpName'] ); |
exit; | exit; | ||
} | } | ||
} | } | ||
} | } | ||
| + | elseif ( $event == 'data' ) { | ||
| + | # This is called from the "No Bots!" page | ||
| + | $log = '*'.wfTimestampNow().' : Attempt to create user "'.$_REQUEST['xwBot']."\" denied ;-)\n"; | ||
| + | $a = new Article( Title::makeTitle( 0, 'XmlWiki_Log' ) ); | ||
| + | if ( $append ) $newContent = xwArticleContent( $newTitle ).$log; | ||
| + | $a->quickEdit( $log ); | ||
| + | } | ||
| + | |||
?> | ?> | ||
Revision as of 06:29, 3 March 2006
<?
- Add an "I am a human" checkbox to stop spambots for a while
if ( $event == 'view' ) { $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' ) { xwSetProperty( $properties, 'xpath:/properties:view', $tTitle ); if ( $_REQUEST['wpCreateaccount'] ) { if ( $_REQUEST['xwSpecies'] != 'meat' ) { header( "Location: http://" .$_SERVER['HTTP_HOST'].'/index.php?title=No+Bots!&xwBot='.$_REQUEST['wpName'] ); exit; } } } elseif ( $event == 'data' ) { # This is called from the "No Bots!" page $log = '*'.wfTimestampNow().' : Attempt to create user "'.$_REQUEST['xwBot']."\" denied ;-)\n"; $a = new Article( Title::makeTitle( 0, 'XmlWiki_Log' ) ); if ( $append ) $newContent = xwArticleContent( $newTitle ).$log; $a->quickEdit( $log ); }
?>



