Difference between revisions of "Nobots.php"

From Organic Design wiki
m
m
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<?
+
{{legacy}}
# Add an "I am a human" checkbox to stop spambots for a while
+
<php><?
 +
# Add a Human Detector to the create-account section of login form
 
global $xwUserName;
 
global $xwUserName;
 
$comment = '';
 
$comment = '';
Line 22: Line 23:
 
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
 
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
 
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
 
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
width=155 height=50 id=/wiki/nobots.swf align=""
+
width=155 height=50 id=/wiki/images/c/c4/Nobots.swf align=""
type="application/x-shockwave-flash" data=/wiki/nobots.swf>
+
type="application/x-shockwave-flash" data=/wiki/images/c/c4/Nobots.swf>
 
<param name=flashvars value="'.$code.'">
 
<param name=flashvars value="'.$code.'">
<param name=movie value=/wiki/nobots.swf>
+
<param name=movie value=/wiki/images/c/c4/Nobots.swf>
 
<param name=quality value=low>
 
<param name=quality value=low>
<param name=bgcolor value=cccccc>
+
<param name=bgcolor value=ffffff>
<embed src=/wiki/nobots.swf quality=low bgcolor=cccccc
+
<embed src=/wiki/images/c/c4/Nobots.swf quality=low bgcolor=ffffff
 
width=155 height=50 align="" flashvars="'.$code.'"
 
width=155 height=50 align="" flashvars="'.$code.'"
name=/wiki/nobots.swf type="application/x-shockwave-flash"
+
name=/wiki/images/c/c4/Nobots.swf type="application/x-shockwave-flash"
 
pluginspage="http://www.macromedia.com/go/getflashplayer" />
 
pluginspage="http://www.macromedia.com/go/getflashplayer" />
 
</object></td></tr>
 
</object></td></tr>
 
<tr><td align=right><i>Enter the characters above&nbsp;<br>to prove you\'re not a robot&nbsp;</i></td>
 
<tr><td align=right><i>Enter the characters above&nbsp;<br>to prove you\'re not a robot&nbsp;</i></td>
<td align=left valign=middle><input type=text name=xwSpecies size=20>&nbsp;&nbsp;&nbsp;&nbsp;</td>
+
<td align=left valign=bottom><input type=text name=xwSpecies size=20>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
 
<td align=left><b><i>No robots allowed!</i></b></td>',
 
<td align=left><b><i>No robots allowed!</i></b></td>',
 
$article
 
$article
Line 58: Line 59:
  
 
# Append the XmlWiki log article if there's a comment
 
# Append the XmlWiki log article if there's a comment
if ( $comment ) {
+
if ($comment) xwLog($comment);
global $wgLang;
+
?></php>
$ts = $wgLang->timeanddate( wfTimestampNow(), true );
 
$log = xwArticleContent( 'XmlWiki Log' )."\n*$ts : $comment";
 
$a = new Article( Title::makeTitle( 0, 'XmlWiki Log' ) );
 
$a->quickEdit( $log );
 
}
 
?>
 

Latest revision as of 09:47, 14 March 2009

Legacy.svg 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><?

  1. Add a Human Detector to the create-account section of login form

global $xwUserName; $comment = ; $code = array(); for ( $i = 1; $i < 5; $i++ ) $code[] = rand(0,1) ? rand(65,90) : rand(49,57); $code = 'code='.join( '.', $code );

if ( $event == 'view' ) { # "optional" instead of asterisk $article = preg_replace( '/(email|name)\\*/', '$1 (optional)', $article ); # Remove mail-buttons and bullshit text $article = preg_replace( '/<input[^<]+?wpCreateaccountMail.+?(<\\/table>)/s', '$1', $article ); # Add "new users:" heading

$article = preg_replace( '/(<td.+?Retype password:)/', "

New users:

$1", $article );

# Add Human-detector and SadGir-image $article = preg_replace( '/<td.+?\\(new users only\\)/',

'<a href="http://en.wikipedia.org/wiki/GIR_(Invader_Zim)"><img src="http://www.organicdesign.co.nz/wiki/images/a/a2/SadGir.jpg" /></a>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width=155 height=50 id=/wiki/images/c/c4/Nobots.swf align="" type="application/x-shockwave-flash" data=/wiki/images/c/c4/Nobots.swf> <param name=flashvars value="'.$code.'"> <param name=movie value=/wiki/images/c/c4/Nobots.swf> <param name=quality value=low> <param name=bgcolor value=ffffff> <embed src=/wiki/images/c/c4/Nobots.swf quality=low bgcolor=ffffff width=155 height=50 align="" flashvars="'.$code.'" name=/wiki/images/c/c4/Nobots.swf type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />

</object> Enter the characters above 
to prove you\'re not a robot 
<input type=text name=xwSpecies size=20>             No robots allowed!',

$article ); } elseif ( $event == 'init' ) { # Called before processing posted login form xwSetProperty( $properties, 'xpath:/properties:view', $tTitle ); if ( $_REQUEST['wpCreateaccount'] ) { $xwBot = $_REQUEST['wpName']; if ( !ereg( '^[1-9A-Z]{4}$', $_REQUEST['xwSpecies'] ) ) { $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 ;-)"; }

  1. Append the XmlWiki log article if there's a comment

if ($comment) xwLog($comment); ?></php>