function formatControlValue($pControl, $pRecord, $pReport, $pGroup = 0)
{
    //---format a control's value
    $s = array();
    if ($pControl->type == 'PageBreak') {
        return $s;
    }
    if ($pControl->type == 'Graph') {
        $s[] = buildGraphImage($pControl, $pRecord);
        return $s;
    }
    if ($pControl->type == 'Label') {
        $s[] = $pControl->source;
        return $s;
    }
    if ($pControl->type == 'Field') {
        if ($pControl->can_grow) {
            $text = new nuText($pControl, $pRecord[$pControl->source]);
            $s = $text->lines;
        } else {
            $s[] = formatFields($pControl, $pRecord, $pGroup, $pReport);
        }
        return $s;
    }
}
        $setting = addslashes(trim($setting));
        $updS = 'update settings set setting="' . $setting . '" where opt="' . $opt . '"';
        mysql_query($updS) or print mysql_error();
    }
}
$selM = 'select * from settings order by opt';
$resM = mysql_query($selM, $conn);
while ($m = mysql_fetch_assoc($resM)) {
    $m['setting'] = stripslashes($m['setting']);
    $memOptions[$m['opt']] = $m['setting'];
}
//get product info
$selP = 'select * from products order by id';
$resP = mysql_query($selP, $conn) or die(mysql_error());
while ($p = mysql_fetch_assoc($resP)) {
    $p = formatFields($p);
    $pick = '';
    if ($p[id] == $memOptions[memUpsellProductID]) {
        $pick = 'selected';
        $itemName = $p[itemName];
    }
    $upsellProductOptions .= '<option value="' . $p[id] . '" ' . $pick . '>' . $p[itemName] . '</option>';
    $backupPick = '';
    if ($p[id] == $memOptions[memUpsellBackupID]) {
        $backupPick = 'selected';
    }
    $backupProductOptions .= '<option value="' . $p[id] . '" ' . $backupPick . '>' . $p[itemName] . '</option>';
}
//upsell is enabled
if ($memOptions['memAreaUpsell'] == 'on') {
    $upsellCheck = 'checked';
        $searchFor .= $fld . '="' . $_POST[$fld] . '" and ';
    }
}
//1 day
$oneDay = 60 * 60 * 24;
if ($_SESSION[before] == '') {
    $_SESSION[before] = date('Y-m-d', time() + $oneDay);
}
if ($_SESSION[after] == '') {
    $_SESSION[after] = $installDate;
}
$searchFor .= ' joinDate >= "' . $_SESSION[after] . ' 00:00:00" and joinDate <= "' . $_SESSION[before] . ' 23:59:59"';
$sel = 'select * from users where ' . $searchFor . ' ';
$res = mysql_query($sel, $conn) or die(mysql_error());
while ($u = mysql_fetch_assoc($res)) {
    $u = formatFields($u);
    $searchResults .= '<tr>
        <td><a href="updateProfile.php?id=' . $u[id] . '">' . $u[username] . '</a></td>
        <td><a href="updateProfile.php?id=' . $u[id] . '">' . shortenText($u[email], 30) . '</a></td>
        <td>' . shortenText($u[paypal], 30) . '</td>
        <td>' . $u[fname] . ' ' . $u[lname] . '</td>
        <td>' . $u[joinDate] . ' </td>
        </tr>';
}
?>
<form method=post>
    
<table>
<tr>
    <td>
        <div class="moduleBlue"><h1>Affiliate Search</h1>