Ejemplo n.º 1
0
    $parameter = 'action=photo&doing=view_photo&photo_id=7&';
    $pagebar = pagebar(get_self(), $parameter, $page_current, $page_size, $count);
    $smarty = new smarty();
    smarty_header();
    $smarty->assign('pagebar', $pagebar);
    $smarty->assign('photo', $rows);
    $smarty->display('admin_photo_list.html');
}
if ($doing == 'manage_photo') {
    check_browser();
    check_user();
    $format = "SELECT * FROM `{$db_prefix}photo`";
    $query = $db->query($format);
    $page_size = 10;
    $page_current = isset($_GET['page']) && is_numeric($_GET['page']) ? intval($_GET['page']) : 1;
    $count = $db->getCount($format);
    $res = $db->getAll($format . " LIMIT " . ($page_current - 1) * $page_size . "," . $page_size);
    $rows = array();
    if ($count > 1) {
        foreach ($res as $value) {
            $rows[] = $value;
        }
    }
    $parameter = 'action=photo&doing=manage_photo&';
    $pagebar = pagebar(get_self(), $parameter, $page_current, $page_size, $count);
    $smarty = new smarty();
    smarty_header();
    $smarty->assign('pagebar', $pagebar);
    $smarty->assign('photo', $rows);
    $smarty->display('admin_manage_photo.html');
}
Ejemplo n.º 2
0
function search_cityinline()
{
    global $_MooClass, $dbTablePre, $user_arr, $userid, $last_login_time;
    if (isset($user_arr['province'])) {
        $province = $user_arr['province'];
    }
    if (isset($user_arr['city'])) {
        $city = $user_arr['city'];
    }
    //页码
    $page = 1;
    if (isset($_GET['page'])) {
        $page = intval(max(1, $_GET['page']));
    }
    $pagesize = 4;
    $offset = ($page - 1) * $pagesize;
    //note sql语句
    $sql_gender = '';
    if (isset($user_arr['gender']) && $user_arr['gender'] == '0') {
        //$gender = '1';
        //$sql_gender = " and m.gender='1'";
        $index = 'members_women';
    } else {
        //$gender = '0';
        //$sql_gender = " and m.gender='0'";
        $index = 'members_man';
    }
    $cl = searchApi($index);
    //note 地区sql语句
    //	$sql_area = '';
    //	if($province == -1) $province = 0;
    //	if($city == -1) $city = 0;
    //	if($province != 0 && $city != 0){
    //		$sql_area = " and m.province='$province' and m.city='$city' ";
    //	}elseif($province == 0 && $city != 0){
    //		$sql_area = " and m.province='$province'";
    //	}elseif($province != 0 && $city == 0){
    //		$sql_area = " and m.city='$city'";
    //	}elseif($province == 0 && $city == 0){
    //		$sql_area = '';
    //	}else{
    //		$sql_area = '';
    //	}
    $cond = array();
    $cond[] = array('usertype', '1', false);
    //获得在线用户数据
    if (is_array($province) || is_array($city)) {
        $lastvisit = array();
    } else {
        $lastvisit = MooUserOnlineArea($province, $city);
    }
    //$lastvisit = array($province => array('1098212','1215687','1743145','1744119','1744358','1096623','1097401','1097732','1216122','1216529'));
    if (!is_array($lastvisit) || empty($lastvisit)) {
        MooMessage("对不起,当前没有在线的会员", "index.php?n=search");
    } else {
        $lastvisit_str = '';
        if (isset($lastvisit[$province]) && !empty($lastvisit[$province])) {
            $lastvisit_str = implode('|', $lastvisit[$province]);
        }
        if (isset($lastvisit[$city]) && !empty($lastvisit[$city])) {
            if ($lastvisit_str) {
                $lastvisit_str .= '|' . implode('|', $lastvisit[$city]);
            } else {
                $lastvisit_str = implode('|', $lastvisit[$city]);
            }
        }
        $cond[] = array('@id', $lastvisit_str, false);
    }
    if ($province) {
        $cond[] = array('province', $province, false);
    }
    if ($city) {
        $cond[] = array('city', $city, false);
    }
    //note 照片显示
    //$sql_photo = " and m.images_ischeck='1' and is_lock='1'";
    $cond[] = array('is_lock', '1', false);
    $cond[] = array('images_ischeck', '1', false);
    $sort_str = '@weight desc,s_cid desc,city_star desc,images_ischeck desc';
    //	$timestamp = time();
    //    $expiretime2 = $timestamp - 300;//过期时间
    //note 当前在线时间
    //	$time = time();
    //	$timemark = $time - 300;
    //	$sql_time = '';
    //	$sql_time = "m.lastvisit>'$timemark' ";
    //	$sql = " and usertype='1'".$sql_area.$sql_photo.$sql_gender;
    //	echo $sql;die;
    //	$sql_md5 = md5($sql); //md5保存sql
    //	$sql_search = "select id from `{$dbTablePre}member_tmp` where `condition_md5`='{$sql_md5}' and expiretime > '$expiretime2'";
    //    $ret_search = $_MooClass['MooMySQL']->getOne($sql_search);
    //	if($ret_search){
    //		$search_id = $ret_search['id'];
    //		cityinline_index($search_id);
    //	}else{
    $limit = array($offset, $pagesize);
    $rs = $cl->getResultOfReset($cond, $limit, $sort_str);
    if (isset($rs['total_found']) && $rs['total_found']) {
        //有数据
        $total = $rs['total_found'];
        $total_pages = ceil($total / $pagesize);
        $ids = $cl->getIds();
    } else {
        //没有数据降低条件
        $cond = array();
        $cond[] = array('usertype', '1', false);
        $cond[] = array('is_lock', '1');
        $cond[] = array('images_ischeck', '1');
        $cond[] = array('@id', $lastvisit_str, false);
        $rs = $cl->getResult($cond, $limit, $sort_str);
        if (isset($rs['total_found']) && $rs['total_found']) {
            $total = $rs['total_found'];
            $total_pages = ceil($total / $pagesize);
            $ids = $cl->getIds();
        }
    }
    //note 找不到匹配的结果返回单独提示页面
    if (!isset($ids) || empty($ids)) {
        include MooTemplate('public/search_error', 'module');
        exit;
    }
    $user_list = is_array($ids) && !empty($ids) ? implode(",", $ids) : '';
    if ($user_list) {
        $page = min($page, $total_pages);
        $order_by = "order by s_cid desc ,city_star desc, pic_num desc,images_ischeck desc ";
        $user = $_MooClass['MooMySQL']->getAll("select s.*,b.mainimg from `{$dbTablePre}members_search` s left join `{$dbTablePre}members_base` b on s.uid=b.uid where s.uid in ({$user_list}) {$order_by}");
    }
    if (!isset($html)) {
        $html = '';
    }
    if ($total > 4) {
        $url = 'index.php?n=search&h=cityinline';
        $pagebar = pagebar($page, $total_pages, $url, $html);
    }
    include MooTemplate('public/search_cityinline', 'module');
    exit;
    //		$total_count = $_MooClass['MooMySQL']->getOne("select count(*) as count from `{$dbTablePre}members` m where "."m.lastvisit>'$timemark'".$sql);
    //		$total = $total_count["count"];
    //		//echo $total;die;
    //		if($total>=1){
    //			if($total>=4){
    //				$user = $_MooClass['MooMySQL']->getAll("select m.uid from `{$dbTablePre}members` m where "."m.lastvisit>'$timemark'".$sql);
    //			}else{
    //				$sql_province = " and usertype='1'"." and m.province='{$province}'".$sql_photo.$sql_gender;
    //				$user = $_MooClass['MooMySQL']->getAll("select m.uid from `{$dbTablePre}members` m where "."m.lastvisit>'$timemark'".$sql);
    //			}
    //		}else{
    //			$sql1 = " and usertype='1'".$sql_photo.$sql_gender;
    //			$total1 = $_MooClass['MooMySQL']->getOne("select count(*) as count from `{$dbTablePre}members` m where "."m.lastvisit>'$timemark'".$sql1);
    //			if($total1<1){
    //				MooMessage("对不起,当前没有在线的会员", "index.php?n=search");
    //			}
    //			$user1 = $_MooClass['MooMySQL']->getAll("select m.uid from `{$dbTablePre}members` m where "."m.lastvisit>'$timemark'".$sql1);
    //		}
    //		$user_list = "";
    //		if(!empty($user)){
    //			foreach ($user as $v) {
    //				$user_uid .= $v['uid'].',';
    //			}
    //			if(!empty($user_uid))
    //				$user_uid = substr($user_uid,0,-1);
    //			$user_list .= $user_uid;
    //		}
    //
    //		if(!empty($user1)){
    //			foreach ($user1 as $v){
    //				$user_uid2 .= $v['uid'].',';
    //			}
    //			if(!empty($user_uid2))
    //				$user_uid2 = substr($user_uid2,0,-1);
    //			$user_list .= '|'.$user_uid2;
    //		}
    //echo $user_list;die;
    //		$addtime = time();
    //        $expiretime = $addtime;
    //        $sql = "select id from `{$dbTablePre}member_tmp` where condition_md5 = '$sql_md5'";
    //        $ret = $_MooClass['MooMySQL']->getOne($sql);
    //        if (isset($ret['id']) && $ret['id']) {  //有则更新
    //            $search_id = $ret['id'];
    //            $_MooClass['MooMySQL']->query("update `{$dbTablePre}member_tmp` set search_uid='$userid' , uid_list='$user_list', addtime='$addtime',expiretime='$expiretime' where id='$search_id'");
    //        } else {    //无则插入
    //            $sql = "insert into `{$dbTablePre}member_tmp` set search_uid='$userid',condition_md5='$sql_md5',uid_list='$user_list',addtime='$addtime',expiretime='$expiretime'";
    //            $_MooClass['MooMySQL']->query($sql);
    //            $search_id = $_MooClass['MooMySQL']->insertId();
    //        }
    //		cityinline_index($search_id);
    //	}
}