ViewMore.php
2.35 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
require("../../class/connect.php");
require("../../class/db_sql.php");
$link=db_connect();
$empire=new mysqlquery();
$id=(int)$_GET['id'];
$classid=(int)$_GET['classid'];
//變量
$onclick=(int)$_GET['onclick'];
$down=(int)$_GET['down'];
$plnum=(int)$_GET['plnum'];
$pfen=(int)$_GET['pfen'];
$pfennum=(int)$_GET['pfennum'];
$diggtop=(int)$_GET['diggtop'];
$diggdown=(int)$_GET['diggdown'];
$classf='tid,tbname';
if($plnum)
{
$classf.=',checkpl';
}
$cr=$empire->fetch1("select ".$classf." from {$dbtbpre}enewsclass where classid='$classid' limit 1");
if(empty($cr['tbname']))
{
exit();
}
$selectf='';
$f=array();
$divname=array();
$dh='';
if($onclick)//瀏覽數
{
$selectf.=$dh.'onclick';
$dh=',';
$f[]='onclick';
$divname[]='onclick';
}
if($down)//下載數
{
$selectf.=$dh.'totaldown';
$dh=',';
$f[]='totaldown';
$divname[]='down';
}
$pl=0;
if($plnum)//評論數
{
if($cr['checkpl'])
{
$selectf.=$dh.'restb';
}
else
{
$selectf.=$dh.'plnum';
}
$dh=',';
$f[]='plnum';
$divname[]='plnum';
}
if($pfen)//評分數
{
$selectf.=$dh.'infopfen,infopfennum';
$dh=',';
$f[]='avepfen';
$divname[]='pfen';
}
if($pfennum)//評分人數
{
if(!$pfen)
{
$selectf.=$dh.'infopfennum';
$dh=',';
}
$f[]='infopfennum';
$divname[]='pfennum';
}
if($diggtop)//digg頂數
{
$selectf.=$dh.'diggtop';
$dh=',';
$f[]='diggtop';
$divname[]='diggtop';
}
if($diggdown)//digg踩數
{
$selectf.=$dh.'diggdown';
$dh=',';
$f[]='diggdown';
$divname[]='diggdown';
}
if(empty($selectf))
{
exit();
}
$r=$empire->fetch1("select ".$selectf." from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1");
//統計瀏覽次數
if($_GET['addclick']==1)
{
$empire->query("update {$dbtbpre}ecms_".$cr['tbname']." set onclick=onclick+1 where id='$id' limit 1");
}
$r['onclick']=$r['onclick']+1;
if($cr['checkpl'])
{
$pubid=ReturnInfoPubid(0,$id,$cr['tid']);
$pl=$empire->gettotal("select count(*) as total from {$dbtbpre}enewspl_".$r['restb']." where pubid='$pubid' and checked=0");
$r['plnum']=$pl;
}
if($pfen)
{
$r['avepfen']=$r['infopfennum']?round($r['infopfen']/$r['infopfennum']):0;
}
db_close();
$empire=null;
$count=count($divname);
for($i=0;$i<$count;$i++)
{
$fname=$f[$i];
echo 'document.getElementById("'.$divname[$i].'showdiv").innerHTML="'.$r[$fname].'";';
}
?>