<?php
$conf_basedir	= "../../";	//相对主目录的位置
$conf_where		= "admin";	//选择调用相应模块
$directory		= basename(dirname(__FILE__));	//定义当前所在的目录，引入模块公用函数
include_once($conf_basedir."base.inc.php");
checkAuth('20');	//判断登录和权限
$title = "身份证审核";
$js = "<script type='text/javascript' src='http://esfadmin.house365.com/script/js/showpic.js'></script>";

//查询条件
$wherecond = " kind in ('p_2','p_2_3') ";

if($select_cond != "" && $select_cond_info != "")
{
	$uidstr = "";
	$uidarr = $dao->getAll("broker", " ".$select_cond." like '%".$select_cond_info."%' order by uid desc limit 10", " uid ");
	if(is_array($uidarr) && !empty($uidarr))
	{
		foreach($uidarr as $uid)
		{
			$uidstr .= $uidstr == '' ? $uid['uid'] : ','.$uid['uid'];
		}
	}

	if($uidstr != "")
	{
		$wherecond .= " and uid IN (".$uidstr.") ";
	}
}


if(isset($select_stat) && $select_stat!='*请选择*')
{
	$select_stat = intval($select_stat);
	$wherecond .= " and valid_flag = '".$select_stat."' ";
}elseif(empty($select_stat)){
    $wherecond .= " and valid_flag = '0' ";
}

//分页参数
$pagesize	= $display_rows ? intval($display_rows) : 10;
$page_now	= $page_now ? max(1, intval($page_now)) : 1 ; // 获取当前页数
$offset		= ( $page_now - 1 ) * $pagesize;

//获得数据总条数
$sql = "SELECT COUNT(*) FROM broker_certificate WHERE ".$wherecond;
$numrows = $dbback->GetOne($sql);
 
//获得数据当前页面数据
$sql = "SELECT * FROM broker_certificate WHERE $wherecond ORDER BY id DESC LIMIT ".$offset.",".$pagesize." ";;
//echo $sql;
$data_info = $dbback->GetAll($sql);

//获得详细信息
if($data_info)
{
	$brokerarr = array();
	foreach($data_info as $key=>$data)
	{
		$uid = intval($data['uid']);

		$memkey = $conf_cityflag."_brokerinfo_uid_".$uid;
		$memsec = 3600;
		$brokerinfo = $dao->getRow("broker", " uid = '".$uid."' ", " username,truename,idno ", $memkey, $memsec);

		$brokerarr[$uid] = $brokerinfo;
	}
}


$pagenum = count($data_info);//当前页面数量
$numrows = $numrows >0 ? $numrows : 0;
$time = time();
if( $numrows <= 0 || $pagenum <=0){
	$pages = 0 ;  //计算总页数
}else{
	$pages = ceil($numrows/$pagesize) ;  //计算总页数
	$new_pagenavi = new_pagenavi($page_now,$pages,$numrows);
}

//引用模版文件
include_once(Template("header"));
include_once(Template("broker/id_card_manage"));
include_once(Template("footer"));
?>