Wow! This turned out to be a tad more complicated than I first thought.
However, my web host customer service are brilliant and the script is now working well.
This part of their initial reply explains the problem
register_globals is not enabled, as it shouldn't be, so this won't work. You should always code for this being disabled; as of PHP5 the default state of register_globals is off.
So with a bit of testing and tweaking this is the revised script that did the trick:
<?php // thankyou.php
function cbValid($rcpt, $time, $item, $cbpop){
$key='ABCDE';
$xxpop=sha1("$key|$rcpt|$time|$item");
$xxpop=strtoupper(substr($xxpop,0,8));
if ($cbpop==$xxpop){
return 1;
} else {
return 0;
}
}
// ===== Sanitise the input (only allow GET for security) =====
$rcpt = trim(addslashes($GET['cbreceipt']));
$time = trim(addslashes($GET['time']));
$item = trim(addslashes($GET['item']));
$cbpop = trim(addslashes($GET['cbpop']));
// ===== Redirect if invalid and exit =====
if (!cbValid($rcpt, $time, $item, $cbpop)) {
// redirect
header ("Location: http://thejester.biz/");
exit;
}
// no need to do an ELSE because the exit will terminate further processing
// if a valid transaction is not confirmed
// now have the thank you page html
?>
Anyway, thanks for pointing me in the right direction.