<?php
/*
* date last modified 03-10-2017
* Edited by PI-Digi Logical Solutions
* HTML Files - manage_staff.html.php
* Mysql Tables - tbl_admin, tbl_purchase_partner, tbl_admin_type
*/
require_once('./classes/class.noseo_pagination.php'); # pagination class
require_once('./includes/functions.php'); # general functions

if(isset($_REQUEST['p']) && $_REQUEST['p']!=''){
	$p = trim($_REQUEST['p']);
} else {
	$p = 1;
}

//get details from settings
$settingsRec = mysqli_fetch_array(mysqli_query($con, "SELECT referrer_commission, referrer_commission_amount, referee_commission, referee_commission_amount FROM tbl_settings WHERE id = '1'"));
$refCommission = $settingsRec['referrer_commission'];
$refCommissionAmount = $settingsRec['referrer_commission_amount'];
$refereeCommission = $settingsRec['referee_commission'];
$refereeCommissionAmount = $settingsRec['referee_commission_amount'];


$pageVars = '';
$showAssign = FALSE;

// Get All User details to list 
$where = ' id>0 ';

if(isset($_POST['clear'])) { ?>
<script language="javascript" type="text/javascript">			
	window.location='index.php?page=<?php echo $page;?>';
</script>
<?php }

/*if(isset($_REQUEST['searchvalue']) && strlen($_REQUEST['searchvalue'])>0) {
	$keyword = trim($_REQUEST['searchvalue']);
	$where.= " AND (name LIKE '%".$keyword."%' OR building_name LIKE '%".$keyword."%' OR email LIKE '%".$keyword."%' OR phone LIKE '%".$keyword."%' OR place LIKE '%".$keyword."%') ";
	$pageVars.= '&searchvalue='.$keyword;
}

if(isset($_REQUEST['status']) && strlen($_REQUEST['status'])>0) {
	$where .= " AND status='".$_REQUEST['status']."'";
	$status = $_REQUEST['status'];
	$pageVars.= '&status='.$status;
}*/

$select = "SELECT id, name, email FROM `tbl_user` WHERE `id` IN (SELECT DISTINCT `ref_id` FROM tbl_user) ORDER BY id";
//$select = "SELECT * FROM `tbl_user` WHERE ref_id > 0";


//echo $select;
// Using pagination class
$pagination = new pagination_noseo($select);
$execDetails = $pagination->createPages(30);

$pageLnk = 'index.php?page='.$page.'&'.$pageVars;
$pageNums = $pagination->pageNumber(5, $pageLnk);
?>