index.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. $down=(int)$_GET['down'];
  9. $shownum=0;
  10. $classf='tid,tbname';
  11. if($down==2)
  12. {
  13. $classf.=',checkpl';
  14. }
  15. if($down==7)//专题
  16. {
  17. $cr=$empire->fetch1("select restb from {$dbtbpre}enewszt where ztid='$classid' limit 1");
  18. if(!$cr['restb'])
  19. {
  20. exit();
  21. }
  22. }
  23. else
  24. {
  25. $cr=$empire->fetch1("select ".$classf." from {$dbtbpre}enewsclass where classid='$classid' limit 1");
  26. if(empty($cr['tbname']))
  27. {
  28. exit();
  29. }
  30. }
  31. //浏览数
  32. if($down==0)
  33. {
  34. $r=$empire->fetch1("select onclick from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1");
  35. $shownum=$r['onclick']+1;
  36. if($_GET['addclick']==1)
  37. {
  38. $usql=$empire->query("update {$dbtbpre}ecms_".$cr['tbname']." set onclick=onclick+1 where id='$id' limit 1");
  39. }
  40. }
  41. //下载数
  42. elseif($down==1)
  43. {
  44. $r=$empire->fetch1("select totaldown from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1");
  45. $shownum=$r['totaldown'];
  46. }
  47. //评论数
  48. elseif($down==2)
  49. {
  50. if($cr['checkpl'])
  51. {
  52. $r=$empire->fetch1("select restb from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1");
  53. if(!$r['restb'])
  54. {
  55. exit();
  56. }
  57. $pubid=ReturnInfoPubid(0,$id,$cr['tid']);
  58. $shownum=$empire->gettotal("select count(*) as total from {$dbtbpre}enewspl_".$r['restb']." where pubid='$pubid' and checked=0");
  59. }
  60. else
  61. {
  62. $r=$empire->fetch1("select plnum from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1");
  63. $shownum=$r['plnum'];
  64. }
  65. }
  66. //评分数
  67. elseif($down==3)
  68. {
  69. $r=$empire->fetch1("select infopfen,infopfennum from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1");
  70. $shownum=$r[infopfennum]?round($r[infopfen]/$r[infopfennum]):0;
  71. }
  72. //评分人数
  73. elseif($down==4)
  74. {
  75. $r=$empire->fetch1("select infopfennum from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1");
  76. $shownum=$r['infopfennum'];
  77. }
  78. //digg顶数
  79. elseif($down==5)
  80. {
  81. $r=$empire->fetch1("select diggtop from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1");
  82. $shownum=$r['diggtop'];
  83. }
  84. //digg踩数
  85. elseif($down==6)
  86. {
  87. $r=$empire->fetch1("select diggdown from {$dbtbpre}ecms_".$cr['tbname']." where id='$id' limit 1");
  88. $shownum=$r['diggdown'];
  89. }
  90. //专题评论数
  91. elseif($down==7)
  92. {
  93. $pubid='-'.$classid;
  94. $shownum=$empire->gettotal("select count(*) as total from {$dbtbpre}enewspl_".$cr['restb']." where pubid='$pubid' and checked=0");
  95. }
  96. db_close();
  97. $empire=null;
  98. echo"document.write('".$shownum."');";
  99. ?>