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

    $memkey = $conf_cityflag."_idnext".$sort;
    $cache = $mc->get($memkey);
    //$mc->delete($memkey);
    if(!empty($cache))
    {
        $array_id=$cache;
    }else{
        //为了获得下一个id，只能把所有数据读出来循环！！！
        $sql = "select * from admin_pic_entry where  sort=$sort group by blockid ORDER BY id DESC ";
        $data_info = $dbback->GetAll($sql);
        for ($i = 0; $i < count($data_info); $i++) {
            $array_id[$data_info[$i]['blockid']]=$data_info[$i+1]['blockid'];
        }      
        $mc->add($memkey, $array_id, false, 600);
    }
    //var_dump($array_id);exit;
    $wherecond="";
    if($sort == 0){
        if($hall!=""){
            $wherecond.="and hall='".$hall."'";
        }
        if($room!=""){
            $wherecond.="and room='".$room."'";
        }
         $wherecond .=" and sort=0";
         $tpl = "block/audit_img";
    }else{
         $wherecond .=" and sort=1";
         $tpl = "block/audit_img1";
    }    

    //获得小区待入图库
    $q = "select * from admin_pic_entry where blockid='" . $id . "' ".$wherecond."";

    $entryimg = $dbback->GetAll($q);
    $entry_num=count($entryimg);

    //引用模版文件
    include_once(Template($tpl));

?>