[pmwiki-users] {(...)} markup recipe available
Hans
design5 at softflow.co.uk
Sun Apr 15 17:34:43 CDT 2007
Sunday, April 15, 2007, 11:23:54 PM, The wrote:
> No, it contains the first random number once the captcha has been set.
> All future occurrences of {(captcha)} will return that number rather
> than generating a new random number. Works fine..
I see. Thanks. so here I got this slightly shortened and standardised
form to do the work:
$MarkupExpr['captcha'] = 'Captcha($args[0],$args[1])';
$Captcha = '';
function Captcha($x, $y) {
global $Captcha;
if ($Captcha != '') return $Captcha;
if ($x=='') {
$x = 1000;
$y = 9999;
}
$Captcha = rand($x, $y);
return $Captcha;
} // }}}
And I have been using this form all along, using a PV:
$FmtPV['$AccessCode'] = RandomAccess();
function RandomAccess() {
return rand(100,999);
}
A lot less code for the same work. I might as well stick with it,
since {(rand 100 999)} is giving different numbers on the same page.
~Hans
More information about the pmwiki-users
mailing list