$URL = 'modules.php?module=index&what=sponsor_reg&refid=';
// Do we have a referal id?
-if (!empty($GLOBALS['refid'])) {
+if (isValidUserId($GLOBALS['refid'])) {
// We have an refid here. So we simply add it
$URL .= $GLOBALS['refid'];
} else {