ViewMore.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. require("../../class/connect.php");
  3. require("../../class/db_sql.php");
  4. $link=db_connect();
  5. $empire=new mysqlquery();
  6. $id=(int)$_GET['id'];
  7. $classid=(int)$_GET['classid'];
  8. //变量
  9. $onclick=(int)$_GET['onclick'];
  10. $down=(int)$_GET['down'];
  11. $plnum=(int)$_GET['plnum'];
  12. $pfen=(int)$_GET['pfen'];
  13. $pfennum=(int)$_GET['pfennum'];
  14. $diggtop=(int)$_GET['diggtop'];
  15. $diggdown=(int)$_GET['diggdown'];
  16. $classf='tid,tbname';
  17. if($plnum)
  18. {
  19. $classf.=',checkpl';
  20. }
  21. $cr=$empire->fetch1("select ".$classf." from {$dbtbpre}enewsclass where classid='$classid' limit 1");
  22. if(empty($cr['tbname']))
  23. {
  24. exit();
  25. }
  26. $selectf='';
  27. $f=array();
  28. $divname=array();
  29. $dh='';
  30. if($onclick)//浏览数
  31. {
  32. $selectf.=$dh.'onclick';
  33. $dh=',';
  34. $f[]='onclick';
  35. $divname[]='onclick';
  36. }
  37. if($down)//下载数
  38. {
  39. $selectf.=$dh.'totaldown';
  40. $dh=',';
  41. $f[]='totaldown';
  42. $divname[]='down';
  43. }
  44. $pl=0;
  45. if($plnum)//评论数
  46. {
  47. if($cr['checkpl'])
  48. {
  49. $selectf.=$dh.'restb';
  50. }
  51. else
  52. {
  53. $selectf.=$dh.'plnum';
  54. }
  55. $dh=',';
  56. $f[]='plnum';
  57. $divname[]='plnum';
  58. }
  59. if($pfen)//评分数
  60. {
  61. $selectf.=$dh.'infopfen,infopfennum';
  62. $dh=',';
  63. $f[]='avepfen';
  64. $divname[]='pfen';
  65. }
  66. if($pfennum)//评分人数
  67. {
  68. if(!$pfen)
  69. {
  70. $selectf.=$dh.'infopfennum';
  71. $dh=',';
  72. }
  73. $f[]='infopfennum';
  74. $divname[]='pfennum';
  75. }
  76. if($diggtop)//digg顶数
  77. {
  78. $selectf.=$dh.'diggtop';
  79. $dh=',';
  80. $f[]='diggtop';
  81. $divname[]='diggtop';
  82. }
  83. if($diggdown)//digg踩数
  84. {
  85. $selectf.=$dh.'diggdown';
  86. $dh=',';
  87. $f[]='diggdown';
  88. $divname[]='diggdown';
  89. }
  90. if(empty($selectf))
  91. {
  92. exit();
  93. }
  94. $r=$empire->fetch1("select ".$selectf." from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1");
  95. //统计浏览次数
  96. if($_GET['addclick']==1)
  97. {
  98. $empire->query("update {$dbtbpre}ecms_".$cr['tbname']." set onclick=onclick+1 where id='$id' limit 1");
  99. }
  100. $r['onclick']=$r['onclick']+1;
  101. if($cr['checkpl'])
  102. {
  103. $pubid=ReturnInfoPubid(0,$id,$cr['tid']);
  104. $pl=$empire->gettotal("select count(*) as total from {$dbtbpre}enewspl_".$r['restb']." where pubid='$pubid' and checked=0");
  105. $r['plnum']=$pl;
  106. }
  107. if($pfen)
  108. {
  109. $r['avepfen']=$r['infopfennum']?round($r['infopfen']/$r['infopfennum']):0;
  110. }
  111. db_close();
  112. $empire=null;
  113. $count=count($divname);
  114. for($i=0;$i<$count;$i++)
  115. {
  116. $fname=$f[$i];
  117. echo 'document.getElementById("'.$divname[$i].'showdiv").innerHTML="'.$r[$fname].'";';
  118. }
  119. ?>