<?php
    $conf_basedir	= "../../";	//相对主目录的位置
    $conf_where		= "admin";	//选择调用相应模块
    $directory		= basename(dirname(__FILE__));	//定义当前所在的目录，引入模块公用函数
    include_once($conf_basedir."base.inc.php");
    checkAuth('23');	//判断登录和权限


	if ($actiontype) doaction($actiontype,$actionid);

    $js = "<script type='text/javascript' src='http://esfadmin.house365.com/script/js/showpic.js'></script>
    <script type='text/javascript' src='http://esfadmin.house365.com/script/js/public.js'></script>";
    $tbl='esf_20131230_new_year_prize';
    //查询条件
    $wherecond = "1=1 ";
    //查询条件1
    if($conf&&$confvalue) {
        $wherecond .= " $conf = '$confvalue' ";
    }
    
    if($type) {
        $wherecond .= " and type='$type' ";
    }

    if($winTime) {
        $wherecond .= " and DATE_FORMAT(prizeTime, '%Y-%m-%d') = '$winTime' ";
    }

	//排序条件

	$orderby_arr=array();

	$orderby_arr["expiredate"]	="时间";




    //顶部查询部分结束

    //查询条件



    if(!empty($orderby_arr_s))
      {
         $ordercond= " order by ".$orderby_arr_s." ".$asc_desc_arr_s."";
      }else{
         $ordercond=" ORDER BY id asc ";
      }

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

    //获得数据总条数
    $sql = "select COUNT(*) from $tbl where ".$wherecond;
    $numrows = $dbback->GetOne($sql);

    //获得数据当前页面数据
    $sql = "select * from $tbl where  $wherecond $ordercond LIMIT ".$offset.",".$pagesize." ";
    //echo $sql;exit;
    $data_info = $dbback->GetAll($sql);
    //print_r($data_info);


    $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);
    }

    //读取权限组
     $q = "select id,groupname from broker_group ";
     $broker_group = $db->GetAssoc($q);

    //引用模版文件
    include_once(Template("header"));
    include_once(Template("js189/index"));
    include_once(Template("footer"));


?>