list.php
2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
require("../class/connect.php");
require("../class/db_sql.php");
require("../class/q_functions.php");
require("../data/dbcache/class.php");
require LoadLang("pub/fun.php");
require("../member/class/user.php");
$link=db_connect();
$empire=new mysqlquery();
$userid=0;
$username='';
$spacestyle='';
$search='';
require('CheckUser.php');//驗證用戶
$yhid=0;
$yhvar='qmlist';
//模型
$mid=intval($_GET['mid']);
if(!$mid)
{
printerror("ErrorUrl","",1);
}
$mr=$empire->fetch1("select tbname,qmname,sonclass from {$dbtbpre}enewsmod where mid='$mid'");
if(!$mr['tbname']||InfoIsInTable($mr['tbname']))
{
printerror("ErrorUrl","",1);
}
$yhid=$etable_r[$mr[tbname]][yhid];
$search.="&userid=$userid&mid=$mid";
//用戶
$add="userid='$userid'";
//顯示方式
if($public_r['qlistinfomod'])
{
$modnum=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsmod where tbname='$mr[tbname]'");
if($modnum>1)
{
$add.=' and ('.ReturnClass($mr['sonclass']).')';
}
}
//欄目
$classid=intval($_GET['classid']);
if($classid)
{
if($class_r[$classid][islast])
{
$add.=" and classid='$classid'";
}
else
{
$add.=' and '.ReturnClass($class_r[$classid][sonclass]);
}
$yhid=$class_r[$classid][yhid];
$search.="&classid=$classid";
}
//優化
$yhadd='';
if($yhid)
{
$yhadd=ReturnYhSql($yhid,$yhvar,1);
}
$start=0;
$page=intval($_GET['page']);
$page=RepPIntvar($page);
$line=$public_r['space_num'];//每行顯示
$page_line=10;
$offset=$page*$line;
$query="select ".ReturnSqlListF($mid)." from {$dbtbpre}ecms_".$mr['tbname']." where ".$yhadd.$add." and ismember=1";
$totalquery="select count(*) as total from {$dbtbpre}ecms_".$mr['tbname']." where ".$yhadd.$add." and ismember=1";
$totalnum=intval($_GET['totalnum']);
if($totalnum<1)
{
$num=$empire->gettotal($totalquery);//取得總條數
}
else
{
$num=$totalnum;
}
$search.="&totalnum=$num";
$query.=" order by newstime desc limit $offset,$line";
$sql=$empire->query($query);
$returnpage=page1($num,$line,$page_line,$start,$page,$search);
require('template/'.$spacestyle.'/list.temp.php');
db_close();
$empire=null;
?>