It always sounds so understandable in ones own head, doesn't it? Here are the relevant parts from register.php:
197 $language = $pun_config['o_default_lang'];
198 }
199
-----------------------------------------------------
200 // anti-spam code variable checked here. Customise to suit your needs.
201 if ($_POST['spamcode'] != $answer) {
202 message("$register_failed");
203 }
------------------------------------------------------
204
205 $timezone = round($_POST['timezone'], 1);
206 $save_pass = (!isset($_POST['save_pass']) || $_POST['save_pass'] != '1') ? '0' : '1';
332 <?php if ($pun_config['o_regs_verify'] == '1'): ?> <label><strong><?php echo $lang_register['Confirm e-mail'] ?></strong><br />
333 <input type="text" name="req_email2" size="50" maxlength="50" /><br/>
</label>
334 <?php endif; ?> </div>
335 </fieldset>
336 </div>
337
------------------------------------------------------
338 <div class="inform">
339 <fieldset>
340 <legend>Spambot prevention</legend>
341 <div class="infldset">
342 <p><?php echo ("$question"); ?></p>
343 <p><?php echo ("$hint"); ?></p>
344 <input method="post" type="text" name="spamcode" size="10" maxlength="10" /><br/>
345 </div>
346 </fieldset>
347 </div>
-------------------------------------------------------
348
349 <div class="inform">
350 <fieldset>
351 <legend><?php echo $lang_prof_reg['Localisation legend'] ?></legend>
The sections between the dotted lines are the new code. I've left extra code above/below as markers of placement. With that bottom section of code, if I add:
<?php
require PUN_ROOT.'include/user/register.php';
?>
just before it, that require will pull the variables required from that script. However, when it gets to the $_POST check back up the top of the register.php file, (that first block of code), the variables aren't carried over to that check. If I put the require at the top of register.php, the script would appear to be being called twice, as the random(ish) variables it produces don't match. So, the question being, how do I carry the variables over to the post check? That include/user/register.php is merely arrays with a rand call to set a value for $hint, $answer and $question, i.e:
$number = rand(1, 2);
$hint = $hints[$number];
$answer = $answers[$number];
$question = $questions[$number];
Have I managed to explain it okay this time?
Thanks again,
Matt