index.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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('movie');//关闭模块
  10. $link=db_connect();
  11. $empire=new mysqlquery();
  12. $editor=1;
  13. $ecmsreurl=2;
  14. //验证IP
  15. eCheckAccessDoIp('onlineinfo');
  16. $id=(int)$_GET['id'];
  17. $pathid=(int)$_GET['pathid'];
  18. $classid=(int)$_GET['classid'];
  19. //扣点函数
  20. function ViewOnlineKFen($showdown_r,$u,$userid,$classid,$id,$pathid,$r){
  21. global $level_r,$class_r,$dbtbpre,$public_r,$empire,$have_bak,$have_fen;
  22. $userid=(int)$userid;
  23. $classid=(int)$classid;
  24. $id=(int)$id;
  25. $pathid=(int)$pathid;
  26. if($showdown_r[2])
  27. {
  28. $u['groupid']=(int)$u['groupid'];
  29. $u['username']=RepPostVar($u['username']);
  30. $r[title]=RepPostStr($r[title]);
  31. //下载次数限制
  32. $setuserday="";
  33. if($level_r[$u['groupid']][daydown])
  34. {
  35. $setuserday=DoCheckMDownNum($userid,$u['groupid'],1);
  36. }
  37. //点数是否足够
  38. $showdown_r[3]=intval($showdown_r[3]);
  39. if($showdown_r[3])
  40. {
  41. if($have_fen==1)
  42. {
  43. //去除点数
  44. $usql=$empire->query("update ".eReturnMemberTable()." set ".egetmf('userfen')."=".egetmf('userfen')."-".$showdown_r[3]." where ".egetmf('userid')."='$userid'");
  45. }
  46. if($have_bak==0)
  47. {
  48. //备份下载记录
  49. $utfusername=$u['username'];
  50. BakDown($classid,$id,$pathid,$userid,$utfusername,$r[title],$showdown_r[3],1);
  51. }
  52. }
  53. //更新用户下载次数
  54. if($setuserday)
  55. {
  56. $usql=$empire->query($setuserday);
  57. }
  58. }
  59. //总下载数据增一
  60. $usql=$empire->query("update {$dbtbpre}ecms_".$class_r[$classid][tbname]." set totaldown=totaldown+1 where id='$id'");
  61. }
  62. /*
  63. 来源识别
  64. if(!strstr($_SERVER['HTTP_REFERER'],$public_r[newsurl]))
  65. {
  66. exit();
  67. }
  68. */
  69. if(!$classid||empty($class_r[$classid][tbname])||!$id)
  70. {
  71. echo"<script>alert('此视频不存在');window.close();</script>";
  72. exit();
  73. }
  74. $mid=$class_r[$classid][modid];
  75. $tbname=$class_r[$classid][tbname];
  76. $query="select * from {$dbtbpre}ecms_".$tbname." where id='$id' limit 1";
  77. $r=$empire->fetch1($query);
  78. if(!$r['id']||$r['classid']!=$classid)
  79. {
  80. echo"<script>alert('此视频不存在');window.close();</script>";
  81. exit();
  82. }
  83. //副表
  84. $finfor=$empire->fetch1("select ".ReturnSqlFtextF($mid)." from {$dbtbpre}ecms_".$tbname."_data_".$r[stb]." where id='$r[id]' limit 1");
  85. $r=array_merge($r,$finfor);
  86. //区分下载地址
  87. $path_r=explode("\r\n",$r[onlinepath]);
  88. if(!$path_r[$pathid])
  89. {
  90. echo"<script>alert('此视频不存在');window.close();</script>";
  91. exit();
  92. }
  93. $showdown_r=explode("::::::",$path_r[$pathid]);
  94. //下载权限
  95. $have_bak=0;
  96. $have_fen=0;
  97. $setuserday="";
  98. $nockpass='';
  99. $user=array();
  100. $u=array();
  101. $downgroup=$showdown_r[2];
  102. if($downgroup)
  103. {
  104. $user=islogin();
  105. //取得会员资料
  106. $u=$empire->fetch1("select ".eReturnSelectMemberF('*')." from ".eReturnMemberTable()." where ".egetmf('userid')."='$user[userid]' and ".egetmf('rnd')."='$user[rnd]' limit 1");
  107. if(empty($u['userid']))
  108. {
  109. echo"<script>alert('同一帐号,只能一人在线');window.close();</script>";
  110. exit();
  111. }
  112. $nockpass=qReturnLoginPassNoCK($user['userid'],$user['username'],$user['rnd'],0);
  113. //下载次数限制
  114. if($level_r[$u['groupid']][daydown])
  115. {
  116. $setuserday=DoCheckMDownNum($user[userid],$u['groupid'],2);
  117. if($setuserday=='error')
  118. {
  119. echo"<script>alert('您的下载与观看次数已超过系统限制(".$level_r[$u['groupid']][daydown]." 次)!');window.close();</script>";
  120. exit();
  121. }
  122. }
  123. if($downgroup>0)//会员组
  124. {
  125. if($level_r[$downgroup][level]>$level_r[$u['groupid']][level])
  126. {
  127. echo"<script>alert('您的会员级别不足(".$level_r[$downgroup][groupname]."),没有观看此视频的权限!');window.close();</script>";
  128. exit();
  129. }
  130. }
  131. else//访问组
  132. {
  133. $vgroupid=0-$downgroup;
  134. $ckvgresult=eMember_ReturnCheckViewGroup($u,$vgroupid);
  135. if($ckvgresult<>'empire.cms')
  136. {
  137. echo"<script>alert('您的会员级别不足,没有观看此视频的权限!');window.close();</script>";
  138. exit();
  139. }
  140. }
  141. //点数是否足够
  142. $have_bak=0;
  143. $have_fen=0;
  144. if($showdown_r[3])
  145. {
  146. //---------是否有历史记录
  147. $bakr=$empire->fetch1("select id,truetime from {$dbtbpre}enewsdownrecord where id='$id' and classid='$classid' and userid='$user[userid]' and pathid='$pathid' and online=1 order by truetime desc limit 1");
  148. if($bakr[id]&&(time()-$bakr[truetime]<=$public_r[redodown]*3600))
  149. {
  150. $have_bak=1;
  151. }
  152. else
  153. {
  154. //包月卡
  155. if($u['userdate']-time()>0)
  156. {}
  157. //点数
  158. else
  159. {
  160. if($showdown_r[3]>$u['userfen'])
  161. {
  162. echo"<script>alert('您的点数不足 $showdown_r[3] 点,无法观看此视频');window.close();</script>";
  163. exit();
  164. }
  165. $have_fen=1;
  166. }
  167. }
  168. }
  169. }
  170. //验证码
  171. $ip=egetip();
  172. $pass=md5(md5($classid."-!ecms!".$id."-!ecms!".$pathid).ReturnDownSysCheckIp()."wm_chief".$public_r[downpass].$user[userid]);
  173. $op=GetOnlinePass();
  174. $url="../doaction.php?enews=GetSofturl&classid=$classid&id=$id&pathid=$pathid&pass=".$pass."&p=".$user[userid].":::".$user[rnd].":::".$nockpass."&onlinetime=".$op[0]."&onlinepass=".$op[1];
  175. $trueurl=ReturnDSofturl($showdown_r[1],$showdown_r[4],'../../',0);//实际地址
  176. $playerpass="wm_chief";
  177. //自动识别播放器
  178. $jwplayertype=',.flv,.mp4,';
  179. $htmlvideotype=',.ogg,.mp4,.webm,';
  180. $htmlaudiotype=',.ogg,.mp3,.wav,';
  181. if(empty($r[playerid]))
  182. {
  183. $ftype=GetFiletype($showdown_r[1]);
  184. if($ftype=='.swf')
  185. {
  186. @include("flasher.php");
  187. }
  188. elseif(stristr($htmlvideotype,','.$ftype.','))
  189. {
  190. @include("htmlvideo.php");
  191. }
  192. elseif(stristr($htmlaudiotype,','.$ftype.','))
  193. {
  194. @include("htmlaudio.php");
  195. }
  196. elseif(stristr($jwplayertype,','.$ftype.','))
  197. {
  198. @include("jwplayer.php");
  199. }
  200. elseif($ftype=='.flv')
  201. {
  202. @include("flver.php");
  203. }
  204. elseif(stristr($ecms_config['sets']['realplayertype'],','.$ftype.','))
  205. {
  206. @include("realplayer.php");
  207. }
  208. else
  209. {
  210. @include("mediaplayer.php");
  211. }
  212. }
  213. else
  214. {
  215. $playerr=$empire->fetch1("select filename from {$dbtbpre}enewsplayer where id='$r[playerid]'");
  216. if($playerr['filename'])
  217. {
  218. @include($playerr[filename]);
  219. }
  220. }
  221. db_close();
  222. $empire=null;
  223. ?>