player.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <?php
  2. define('EmpireCMSAdmin','1');
  3. require("../../class/connect.php");
  4. require("../../class/db_sql.php");
  5. require("../../class/functions.php");
  6. $link=db_connect();
  7. $empire=new mysqlquery();
  8. $editor=1;
  9. //验证用户
  10. $lur=is_login();
  11. $logininid=$lur['userid'];
  12. $loginin=$lur['username'];
  13. $loginrnd=$lur['rnd'];
  14. $loginlevel=$lur['groupid'];
  15. $loginadminstyleid=$lur['adminstyleid'];
  16. //ehash
  17. $ecms_hashur=hReturnEcmsHashStrAll();
  18. //验证权限
  19. CheckLevel($logininid,$loginin,$classid,"player");
  20. //验证文件
  21. function CheckPlayerFilename($filename){
  22. if(strstr($filename,"\\")||strstr($filename,"/")||strstr($filename,".."))
  23. {
  24. printerror("PlayerFileNotExist","history.go(-1)");
  25. }
  26. //文件是否存在
  27. if(!file_exists("../../DownSys/play/".$filename))
  28. {
  29. printerror("PlayerFileNotExist","history.go(-1)");
  30. }
  31. }
  32. //------------------增加播放器
  33. function AddPlayer($add,$userid,$username){
  34. global $empire,$dbtbpre;
  35. if(!$add[player]||!$add[filename])
  36. {
  37. printerror("EmptyPlayerName","history.go(-1)");
  38. }
  39. CheckPlayerFilename($add[filename]);
  40. $add['player']=hRepPostStr($add['player'],1);
  41. $add['bz']=hRepPostStr($add['bz'],1);
  42. $sql=$empire->query("insert into {$dbtbpre}enewsplayer(player,filename,bz) values('".$add['player']."','".eaddslashes($add[filename])."','".$add[bz]."');");
  43. $id=$empire->lastid();
  44. if($sql)
  45. {
  46. //操作日志
  47. insert_dolog("id=$id<br>player=$add[player]");
  48. printerror("AddPlayerSuccess","player.php".hReturnEcmsHashStrHref2(1));
  49. }
  50. else
  51. {printerror("DbError","history.go(-1)");}
  52. }
  53. //----------------修改播放器
  54. function EditPlayer($add,$userid,$username){
  55. global $empire,$dbtbpre;
  56. $add[id]=(int)$add[id];
  57. if(!$add[player]||!$add[filename]||!$add[id])
  58. {
  59. printerror("EmptyPlayerName","history.go(-1)");
  60. }
  61. CheckPlayerFilename($add[filename]);
  62. $add['player']=hRepPostStr($add['player'],1);
  63. $add['bz']=hRepPostStr($add['bz'],1);
  64. $sql=$empire->query("update {$dbtbpre}enewsplayer set player='".$add['player']."',filename='".eaddslashes($add[filename])."',bz='".$add['bz']."' where id='$add[id]'");
  65. if($sql)
  66. {
  67. //操作日志
  68. insert_dolog("id=$add[id]<br>player=$add[player]");
  69. printerror("EditPlayerSuccess","player.php".hReturnEcmsHashStrHref2(1));
  70. }
  71. else
  72. {printerror("DbError","history.go(-1)");}
  73. }
  74. //---------------删除播放器
  75. function DelPlayer($id,$userid,$username){
  76. global $empire,$dbtbpre;
  77. $id=(int)$id;
  78. if(!$id)
  79. {
  80. printerror("NotDelPlayerID","history.go(-1)");
  81. }
  82. $r=$empire->fetch1("select id,player from {$dbtbpre}enewsplayer where id='$id'");
  83. if(!$r[id])
  84. {
  85. printerror("NotDelPlayerID","history.go(-1)");
  86. }
  87. $sql=$empire->query("delete from {$dbtbpre}enewsplayer where id='$id'");
  88. if($sql)
  89. {
  90. //操作日志
  91. insert_dolog("id=$id<br>player=$r[player]");
  92. printerror("DelPlayerSuccess","player.php".hReturnEcmsHashStrHref2(1));
  93. }
  94. else
  95. {printerror("DbError","history.go(-1)");}
  96. }
  97. $enews=$_POST['enews'];
  98. if(empty($enews))
  99. {$enews=$_GET['enews'];}
  100. if($enews)
  101. {
  102. hCheckEcmsRHash();
  103. }
  104. //增加播放器
  105. if($enews=="AddPlayer")
  106. {
  107. AddPlayer($_POST,$logininid,$loginin);
  108. }
  109. //修改播放器
  110. elseif($enews=="EditPlayer")
  111. {
  112. EditPlayer($_POST,$logininid,$loginin);
  113. }
  114. //删除播放器
  115. elseif($enews=="DelPlayer")
  116. {
  117. $id=$_GET['id'];
  118. DelPlayer($id,$logininid,$loginin);
  119. }
  120. $sql=$empire->query("select id,player,filename,bz from {$dbtbpre}enewsplayer order by id");
  121. ?>
  122. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  123. <html>
  124. <head>
  125. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  126. <title>增加播放器</title>
  127. <link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
  128. </head>
  129. <body>
  130. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  131. <tr>
  132. <td>位置:<a href="player.php<?=$ecms_hashur['whehref']?>">管理播放器</a></td>
  133. </tr>
  134. </table>
  135. <form name="addplayerform" method="post" action="player.php">
  136. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  137. <?=$ecms_hashur['form']?>
  138. <tr class="header">
  139. <td height="25" colspan="4">增加播放器: <input type=hidden name=enews value=AddPlayer></td>
  140. </tr>
  141. <tr>
  142. <td width="14%" height="25" bgcolor="#FFFFFF">播放器名称</td>
  143. <td width="33%" bgcolor="#FFFFFF">文件名</td>
  144. <td width="13%" bgcolor="#FFFFFF">说明</td>
  145. <td width="40%" bgcolor="#FFFFFF">&nbsp;</td>
  146. </tr>
  147. <tr>
  148. <td height="25" bgcolor="#FFFFFF">
  149. <input name="player" type="text" id="player" value="">
  150. </td>
  151. <td bgcolor="#FFFFFF">e/DownSys/play/
  152. <input name="filename" type="text" id="filename" value="">
  153. <a href="#ecms" onclick="window.open('ChangePlayerFile.php?returnform=opener.document.addplayerform.filename.value<?=$ecms_hashur['ehref']?>','','width=400,height=500,scrollbars=yes');">[选择]</a></td>
  154. <td bgcolor="#FFFFFF"><input name="bz" type="text" id="bz"></td>
  155. <td bgcolor="#FFFFFF"><input type="submit" name="Submit" value="增加"></td>
  156. </tr>
  157. </table>
  158. </form>
  159. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  160. <tr class="header">
  161. <td width="8%">
  162. <div align="center">ID</div></td>
  163. <td width="14%" height="25">播放器名称</td>
  164. <td width="33%">文件名</td>
  165. <td width="13%">说明</td>
  166. <td width="32%" height="25"> 操作</td>
  167. </tr>
  168. <?
  169. while($r=$empire->fetch($sql))
  170. {
  171. ?>
  172. <form name="playerform<?=$r[id]?>" method=post action=player.php>
  173. <?=$ecms_hashur['form']?>
  174. <input type=hidden name=enews value=EditPlayer>
  175. <input type=hidden name=id value=<?=$r[id]?>>
  176. <tr bgcolor="#FFFFFF" onmouseout="this.style.backgroundColor='#ffffff'" onmouseover="this.style.backgroundColor='#C3EFFF'">
  177. <td><div align="center"><?=$r[id]?></div></td>
  178. <td height="25"> <input name="player" type="text" value="<?=$r[player]?>">
  179. </td>
  180. <td>e/DownSys/play/
  181. <input name="filename" type="text" value="<?=$r[filename]?>">
  182. <a href="#ecms" onclick="window.open('ChangePlayerFile.php?returnform=opener.document.playerform<?=$r[id]?>.filename.value<?=$ecms_hashur['ehref']?>','','width=400,height=500,scrollbars=yes');">[选择]</a></td>
  183. <td><input name="bz" type="text" value="<?=$r[bz]?>"></td>
  184. <td height="25"> <div align="left">
  185. <input type="submit" name="Submit3" value="修改">
  186. &nbsp;
  187. <input type="button" name="Submit4" value="删除" onclick="if(confirm('确认要删除?')){self.location.href='player.php?enews=DelPlayer&id=<?=$r[id]?><?=$ecms_hashur['href']?>';}">
  188. </div></td>
  189. </tr>
  190. </form>
  191. <?
  192. }
  193. db_close();
  194. $empire=null;
  195. ?>
  196. </table>
  197. </body>
  198. </html>