// Zero refid when empty (might be helpful!)
if (empty($ref)) $ref = 0;
+
if (($ref > 0) && ($GLOBALS['doubler_uid'] == $content['userid']) && (!empty($ref))) {
// Referal points found so add them and set line(s) to completed='Y'
$content['points'] += $ref;