gbooktemp.txt 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. require("../../class/connect.php");
  3. if(!defined('InEmpireCMS'))
  4. {
  5. exit();
  6. }
  7. require("../../class/db_sql.php");
  8. require("../../class/q_functions.php");
  9. require "../".LoadLang("pub/fun.php");
  10. $link=db_connect();
  11. $empire=new mysqlquery();
  12. $editor=1;
  13. eCheckCloseMods('gb');//关闭模块
  14. //分类id
  15. $bid=(int)$_GET['bid'];
  16. $gbr=$empire->fetch1("select bid,bname,groupid from {$dbtbpre}enewsgbookclass where bid='$bid'");
  17. if(empty($gbr['bid']))
  18. {
  19. printerror("EmptyGbook","",1);
  20. }
  21. //权限
  22. if($gbr['groupid'])
  23. {
  24. include("../../member/class/user.php");
  25. $user=islogin();
  26. include("../../data/dbcache/MemberLevel.php");
  27. if($level_r[$gbr[groupid]][level]>$level_r[$user[groupid]][level])
  28. {
  29. echo"<script>alert('您的会员级别不足(".$level_r[$gbr[groupid]][groupname]."),没有权限提交信息!');history.go(-1);</script>";
  30. exit();
  31. }
  32. }
  33. esetcookie("gbookbid",$bid,0);
  34. $bname=$gbr['bname'];
  35. $search="&bid=$bid";
  36. $page=(int)$_GET['page'];
  37. $page=RepPIntvar($page);
  38. $start=0;
  39. $line=$public_r['gb_num'];//每页显示条数
  40. $page_line=10;//每页显示链接数
  41. $offset=$start+$page*$line;//总偏移量
  42. $totalnum=(int)$_GET['totalnum'];
  43. if(!$public_r['usetotalnum'])
  44. {
  45. $totalnum=0;
  46. }
  47. if($totalnum>0)
  48. {
  49. $num=$totalnum;
  50. }
  51. else
  52. {
  53. $totalquery="select count(*) as total from {$dbtbpre}enewsgbook where bid='$bid' and checked=0";
  54. $num=$empire->gettotal($totalquery);//取得总条数
  55. }
  56. if($public_r['usetotalnum'])
  57. {
  58. $search.="&totalnum=$num";
  59. }
  60. //checkpageno
  61. eCheckListPageNo($page,$line,$num);
  62. $query="select lyid,name,email,`mycall`,lytime,lytext,retext from {$dbtbpre}enewsgbook where bid='$bid' and checked=0";
  63. $query=$query." order by lyid desc limit $offset,$line";
  64. $sql=$empire->query($query);
  65. $listpage=page1($num,$line,$page_line,$start,$page,$search);
  66. $url="<a href='".ReturnSiteIndexUrl()."'>".$fun_r['index']."</a>&nbsp;>&nbsp;".$fun_r['saygbook'];
  67. ?>
  68. <!--empire.listtemp.top-->
  69. <?
  70. while($r=$empire->fetch($sql))
  71. {
  72. $r['retext']=nl2br(stripSlashes($r[retext]));
  73. $r['lytext']=nl2br(stripSlashes($r[lytext]));
  74. ?>
  75. <!--empire.listtemp.center-->
  76. <?
  77. }
  78. ?>
  79. <!--empire.listtemp.footer-->
  80. <?php
  81. db_close();
  82. $empire=null;
  83. ?>