index.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php
  2. require("../../class/connect.php");
  3. require("../../class/db_sql.php");
  4. require("../../class/q_functions.php");
  5. require("../../member/class/user.php");
  6. require("../../data/dbcache/class.php");
  7. require("../../data/dbcache/MemberLevel.php");
  8. require("../class/DownSysFun.php");
  9. eCheckCloseMods('down');//关闭模块
  10. $link=db_connect();
  11. $empire=new mysqlquery();
  12. $editor=1;
  13. $ecmsreurl=2;
  14. //验证IP
  15. eCheckAccessDoIp('downinfo');
  16. $id=(int)$_GET['id'];
  17. $pathid=(int)$_GET['pathid'];
  18. $classid=(int)$_GET['classid'];
  19. if(!$classid||empty($class_r[$classid][tbname])||!$id)
  20. {
  21. echo"<script>alert('此信息不存在');window.close();</script>";
  22. exit();
  23. }
  24. $mid=$class_r[$classid][modid];
  25. $tbname=$class_r[$classid][tbname];
  26. $query="select * from {$dbtbpre}ecms_".$tbname." where id='$id' limit 1";
  27. $r=$empire->fetch1($query);
  28. if(!$r['id']||$r['classid']!=$classid)
  29. {
  30. echo"<script>alert('此信息不存在');window.close();</script>";
  31. exit();
  32. }
  33. //副表
  34. $finfor=$empire->fetch1("select ".ReturnSqlFtextF($mid)." from {$dbtbpre}ecms_".$tbname."_data_".$r[stb]." where id='$r[id]' limit 1");
  35. $r=array_merge($r,$finfor);
  36. //区分下载地址
  37. $path_r=explode("\r\n",$r[downpath]);
  38. if(!$path_r[$pathid])
  39. {
  40. echo"<script>alert('此信息不存在');window.close();</script>";
  41. exit();
  42. }
  43. $showdown_r=explode("::::::",$path_r[$pathid]);
  44. //下载权限
  45. $nockpass='';
  46. $user=array();
  47. $downgroup=$showdown_r[2];
  48. if($downgroup)
  49. {
  50. $user=islogin();
  51. //取得会员资料
  52. $u=$empire->fetch1("select ".eReturnSelectMemberF('*')." from ".eReturnMemberTable()." where ".egetmf('userid')."='$user[userid]' and ".egetmf('rnd')."='$user[rnd]' limit 1");
  53. if(empty($u['userid']))
  54. {
  55. echo"<script>alert('同一帐号,只能一人在线');window.close();</script>";
  56. exit();
  57. }
  58. $nockpass=qReturnLoginPassNoCK($user['userid'],$user['username'],$user['rnd'],0);
  59. //下载次数限制
  60. if($level_r[$u['groupid']]['daydown'])
  61. {
  62. $setuserday=DoCheckMDownNum($user['userid'],$u['groupid'],2);
  63. if($setuserday=='error')
  64. {
  65. echo"<script>alert('您的下载与观看次数已超过系统限制(".$level_r[$u['groupid']]['daydown']." 次)!');window.close();</script>";
  66. exit();
  67. }
  68. }
  69. if($downgroup>0)//会员组
  70. {
  71. if($level_r[$downgroup][level]>$level_r[$u['groupid']][level])
  72. {
  73. echo"<script>alert('您的会员级别不足(".$level_r[$downgroup][groupname]."),没有下载权限!');window.close();</script>";
  74. exit();
  75. }
  76. }
  77. else//访问组
  78. {
  79. $vgroupid=0-$downgroup;
  80. $ckvgresult=eMember_ReturnCheckViewGroup($u,$vgroupid);
  81. if($ckvgresult<>'empire.cms')
  82. {
  83. echo"<script>alert('您的会员级别不足,没有下载权限!');window.close();</script>";
  84. exit();
  85. }
  86. }
  87. //点数是否足够
  88. if($showdown_r[3])
  89. {
  90. //---------是否有历史记录
  91. $bakr=$empire->fetch1("select id,truetime from {$dbtbpre}enewsdownrecord where id='$id' and classid='$classid' and userid='$user[userid]' and pathid='$pathid' and online=0 order by truetime desc limit 1");
  92. if($bakr[id]&&(time()-$bakr[truetime]<=$public_r[redodown]*3600))
  93. {}
  94. else
  95. {
  96. //包月卡
  97. if($u['userdate']-time()>0)
  98. {}
  99. //点数
  100. else
  101. {
  102. if($showdown_r[3]>$u['userfen'])
  103. {
  104. echo"<script>alert('您的点数不足 $showdown_r[3] 点,无法下载');window.close();</script>";
  105. exit();
  106. }
  107. }
  108. }
  109. }
  110. }
  111. //变量
  112. $thisdownname=$showdown_r[0]; //当前下载地址名称
  113. $classname=$class_r[$r[classid]]['classname']; //栏目名
  114. $bclassid=$class_r[$r[classid]]['bclassid']; //父栏目ID
  115. $bclassname=$class_r[$bclassid]['classname']; //父栏目名
  116. $titleurl=sys_ReturnBqTitleLink($r); //信息链接
  117. $newstime=date('Y-m-d H:i:s',$r['newstime']);
  118. $titlepic=$r['titlepic']?$r['titlepic']:$public_r[newsurl]."e/data/images/notimg.gif";
  119. $ip=egetip();
  120. $pass=md5(md5($classid."-!ecms!".$id."-!ecms!".$pathid).ReturnDownSysCheckIp()."wm_chief".$public_r[downpass].$user[userid]); //验证码
  121. $url="../doaction.php?enews=DownSoft&classid=$classid&id=$id&pathid=$pathid&pass=".$pass."&p=".$user[userid].":::".$user[rnd].":::".$nockpass; //下载地址
  122. $trueurl=ReturnDSofturl($showdown_r[1],$showdown_r[4],'../../',1); //真实文件地址
  123. $fen=$showdown_r[3]; //下载点数
  124. $downuser=$downgroup?$level_r[$downgroup][groupname]:'游客'; //下载等级
  125. @include('../../data/template/downpagetemp.php');
  126. db_close();
  127. $empire=null;
  128. ?>