index.php
2.55 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
<?php
require("../../class/connect.php");
require("../../class/db_sql.php");
$link=db_connect();
$empire=new mysqlquery();
$id=(int)$_GET['id'];
$classid=(int)$_GET['classid'];
$down=(int)$_GET['down'];
$shownum=0;
$classf='tid,tbname';
if($down==2)
{
$classf.=',checkpl';
}
if($down==7)//專題
{
$cr=$empire->fetch1("select restb from {$dbtbpre}enewszt where ztid='$classid' limit 1");
if(!$cr['restb'])
{
exit();
}
}
else
{
$cr=$empire->fetch1("select ".$classf." from {$dbtbpre}enewsclass where classid='$classid' limit 1");
if(empty($cr['tbname']))
{
exit();
}
}
//瀏覽數
if($down==0)
{
$r=$empire->fetch1("select onclick from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1");
$shownum=$r['onclick']+1;
if($_GET['addclick']==1)
{
$usql=$empire->query("update {$dbtbpre}ecms_".$cr['tbname']." set onclick=onclick+1 where id='$id' limit 1");
}
}
//下載數
elseif($down==1)
{
$r=$empire->fetch1("select totaldown from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1");
$shownum=$r['totaldown'];
}
//評論數
elseif($down==2)
{
if($cr['checkpl'])
{
$r=$empire->fetch1("select restb from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1");
if(!$r['restb'])
{
exit();
}
$pubid=ReturnInfoPubid(0,$id,$cr['tid']);
$shownum=$empire->gettotal("select count(*) as total from {$dbtbpre}enewspl_".$r['restb']." where pubid='$pubid' and checked=0");
}
else
{
$r=$empire->fetch1("select plnum from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1");
$shownum=$r['plnum'];
}
}
//評分數
elseif($down==3)
{
$r=$empire->fetch1("select infopfen,infopfennum from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1");
$shownum=$r[infopfennum]?round($r[infopfen]/$r[infopfennum]):0;
}
//評分人數
elseif($down==4)
{
$r=$empire->fetch1("select infopfennum from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1");
$shownum=$r['infopfennum'];
}
//digg頂數
elseif($down==5)
{
$r=$empire->fetch1("select diggtop from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1");
$shownum=$r['diggtop'];
}
//digg踩數
elseif($down==6)
{
$r=$empire->fetch1("select diggdown from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1");
$shownum=$r['diggdown'];
}
//專題評論數
elseif($down==7)
{
$pubid='-'.$classid;
$shownum=$empire->gettotal("select count(*) as total from {$dbtbpre}enewspl_".$cr['restb']." where pubid='$pubid' and checked=0");
}
db_close();
$empire=null;
echo"document.write('".$shownum."');";
?>