$between_date2 = strtotime($_POST['tr_between_date2']);
        }
        $tr['between_date1'] = process_pass_data($_POST['tr_between_date1']);
        $tr['between_date2'] = process_pass_data($_POST['tr_between_date2']);
        if ($between_date1 != -1 && $between_date2 != -1) {
            $tr_query = "SELECT `ID`, `IDMember`, `IDProvider`, `gtwTransactionID`, DATE_FORMAT(`Date`,  '{$date_format}' ) AS 'Date', `Amount`, `Currency`, `Status`, `Data`, `Description`, `Note` FROM `Transactions` INNER JOIN `aff_members` ON (`idProfile` = `IDMember`) WHERE `idAff` = {$affID} AND ( TO_DAYS( FROM_UNIXTIME({$between_date1}) ) <= TO_DAYS( `Date` ) AND TO_DAYS( FROM_UNIXTIME({$between_date2}) ) >= TO_DAYS( `Date` ) ) AND `Status` = 'approved' ORDER BY `Date` DESC";
        } else {
            $tr_query = "";
            $tr['error_text'] = "Please specify correct dates";
        }
        $between_disabled = "";
        break;
}
// Calculations
if (strlen($tr_query)) {
    $fin = getFinanceAffStat($affID, $tr);
}
// Transactions
if (strlen($tr_query)) {
    $tr_res = db_res($tr_query);
    $tr_num = mysql_num_rows($tr_res);
} else {
    $tr_num = 0;
}
$_page['header'] = "Finance";
$_page['header_text'] = "Calculations and transactions";
send_headers_page_changed();
ob_start();
?>

<div id="helpDivId" style="width: 200px; height: auto; background-color: #F5F5F5; color: #000000; border: 1px solid silver; position: absolute; left: 0px; top: 0px; z-index: 1000; display: none;">
$logged['aff'] = member_auth(2);
if ((int) $_GET['admin_categ']) {
    TopCodeAdmin();
    getAdminCategIndex();
    BottomCode();
}
$status_arr[0] = "Unconfirmed";
$status_arr[1] = "Approval";
$status_arr[2] = "Active";
$status_arr[3] = "Rejected";
$status_arr[4] = "Suspended";
$AFF = (int) $_COOKIE['affID'];
$n_arr = db_arr("SELECT COUNT(*) FROM `Profiles` INNER JOIN `aff_members` ON (`idProfile` = `ID`) WHERE `idAff` = {$AFF}");
// Finance
$tr_array = array();
$fin = getFinanceAffStat($AFF, $tr_array);
$full_amount = $fin['total'];
$_page['header'] = "Affiliate Panel";
//$_page['header_text'] = "Control Panel</b> (Server time: " . date( "H:i, d-M-Y" ) . ")";
TopCodeAdmin();
ContentBlockHead("Profiles");
?>
								<center>
								<table cellspacing=1 cellpadding=3 border=0 width="70%" align="center" bgcolor="#cccccc" >
									<tr>
										<td bgcolor=E5E5E5 class="text" align="left"><a href="<?php 
echo $site['url_aff'];
?>
profiles.php">Profiles</a></td>
										<td bgcolor=E5E5E5 width=50 class="text" align="right"><b><?php 
echo $n_arr[0];