url.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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,"downurl");
  20. //增加url地址
  21. function AddDownurl($add,$userid,$username){
  22. global $empire,$dbtbpre;
  23. if(empty($add[urlname]))
  24. {printerror("EmptyDownurl","history.go(-1)");}
  25. //验证权限
  26. CheckLevel($userid,$username,$classid,"downurl");
  27. $downtype=(int)$add['downtype'];
  28. $add['urlname']=hRepPostStr($add['urlname'],1);
  29. $add['url']=AddAddsData($add['url']);
  30. $sql=$empire->query("insert into {$dbtbpre}enewsdownurlqz(urlname,url,downtype) values('$add[urlname]','$add[url]','$downtype');");
  31. $urlid=$empire->lastid();
  32. if($sql)
  33. {
  34. //操作日志
  35. insert_dolog("urlid=".$urlid);
  36. printerror("AddDownurlSuccess","url.php".hReturnEcmsHashStrHref2(1));
  37. }
  38. else
  39. {printerror("DbError","history.go(-1)");}
  40. }
  41. //修改url地址
  42. function EditDownurl($add,$userid,$username){
  43. global $empire,$dbtbpre;
  44. $add[urlid]=(int)$add[urlid];
  45. if(empty($add[urlname])||empty($add[urlid]))
  46. {printerror("EmptyDownurl","history.go(-1)");}
  47. //验证权限
  48. CheckLevel($userid,$username,$classid,"downurl");
  49. $downtype=(int)$add['downtype'];
  50. $add['urlname']=hRepPostStr($add['urlname'],1);
  51. $add['url']=AddAddsData($add['url']);
  52. $sql=$empire->query("update {$dbtbpre}enewsdownurlqz set urlname='$add[urlname]',url='$add[url]',downtype='$downtype' where urlid='$add[urlid]'");
  53. if($sql)
  54. {
  55. //操作日志
  56. insert_dolog("urlid=".$add[urlid]);
  57. printerror("EditDownurlSuccess","url.php".hReturnEcmsHashStrHref2(1));
  58. }
  59. else
  60. {printerror("DbError","history.go(-1)");}
  61. }
  62. //删除url地址
  63. function DelDownurl($urlid,$userid,$username){
  64. global $empire,$dbtbpre;
  65. $urlid=(int)$urlid;
  66. if(empty($urlid))
  67. {printerror("NotChangeDownurlid","history.go(-1)");}
  68. //验证权限
  69. CheckLevel($userid,$username,$classid,"downurl");
  70. $sql=$empire->query("delete from {$dbtbpre}enewsdownurlqz where urlid='$urlid'");
  71. if($sql)
  72. {
  73. //操作日志
  74. insert_dolog("urlid=".$urlid);
  75. printerror("DelDownurlSuccess","url.php".hReturnEcmsHashStrHref2(1));
  76. }
  77. else
  78. {printerror("DbError","history.go(-1)");}
  79. }
  80. $enews=$_POST['enews'];
  81. if(empty($enews))
  82. {$enews=$_GET['enews'];}
  83. if($enews)
  84. {
  85. hCheckEcmsRHash();
  86. }
  87. //增加前缀
  88. if($enews=="AddDownurl")
  89. {
  90. AddDownurl($_POST,$logininid,$loginin);
  91. }
  92. //修改前缀
  93. elseif($enews=="EditDownurl")
  94. {
  95. EditDownurl($_POST,$logininid,$loginin);
  96. }
  97. //删除前缀
  98. elseif($enews=="DelDownurl")
  99. {
  100. $urlid=$_GET['urlid'];
  101. DelDownurl($urlid,$logininid,$loginin);
  102. }
  103. else
  104. {}
  105. $sql=$empire->query("select urlid,urlname,url,downtype from {$dbtbpre}enewsdownurlqz order by urlid desc");
  106. ?>
  107. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  108. <html>
  109. <head>
  110. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  111. <title>管理下载地址前缀</title>
  112. <link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
  113. </head>
  114. <body>
  115. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  116. <tr>
  117. <td>位置:<a href="url.php<?=$ecms_hashur['whehref']?>">管理下载地址前缀</a></td>
  118. </tr>
  119. </table>
  120. <form name="form1" method="post" action="url.php">
  121. <input type=hidden name=enews value=AddDownurl>
  122. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  123. <?=$ecms_hashur['form']?>
  124. <tr>
  125. <td height="25" class="header">增加下载地址前缀:</td>
  126. </tr>
  127. <tr>
  128. <td height="25" bgcolor="#FFFFFF"> 名称:
  129. <input name="urlname" type="text" id="urlname">
  130. 地址:
  131. <input name="url" type="text" id="url" value="http://" size="38">
  132. 下载方式: <select name="downtype" id="downtype">
  133. <option value="0">HEADER</option>
  134. <option value="1">META</option>
  135. <option value="2">READ</option>
  136. </select> <input type="submit" name="Submit" value="增加"> <input type="reset" name="Submit2" value="重置"></td>
  137. </tr>
  138. </table>
  139. </form>
  140. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  141. <tr class="header">
  142. <td width="74%" height="25">下载地址前缀管理:</td>
  143. <td width="26%" height="25"><div align="center">操作</div></td>
  144. </tr>
  145. <?
  146. while($r=$empire->fetch($sql))
  147. {
  148. ?>
  149. <form name=form2 method=post action=url.php>
  150. <?=$ecms_hashur['form']?>
  151. <input type=hidden name=enews value=EditDownurl>
  152. <input type=hidden name=urlid value=<?=$r[urlid]?>>
  153. <tr bgcolor="#FFFFFF" onmouseout="this.style.backgroundColor='#ffffff'" onmouseover="this.style.backgroundColor='#C3EFFF'">
  154. <td height="25">名称:
  155. <input name="urlname" type="text" id="urlname" value="<?=$r[urlname]?>">
  156. 地址:
  157. <input name="url" type="text" id="url" value="<?=$r[url]?>" size="30">
  158. <select name="downtype" id="downtype">
  159. <option value="0"<?=$r['downtype']==0?' selected':''?>>HEADER</option>
  160. <option value="1"<?=$r['downtype']==1?' selected':''?>>META</option>
  161. <option value="2"<?=$r['downtype']==2?' selected':''?>>READ</option>
  162. </select> </td>
  163. <td height="25"><div align="center">
  164. <input type="submit" name="Submit3" value="修改">&nbsp;
  165. <input type="button" name="Submit4" value="删除" onclick="if(confirm('确认要删除?')){self.location.href='url.php?enews=DelDownurl&urlid=<?=$r[urlid]?><?=$ecms_hashur['href']?>';}">
  166. </div></td>
  167. </tr>
  168. </form>
  169. <?
  170. }
  171. db_close();
  172. $empire=null;
  173. ?>
  174. </table>
  175. <br>
  176. <table width="100%" border="0" cellpadding="3" cellspacing="1" class=tableborder>
  177. <tr>
  178. <td height="26" bgcolor="#FFFFFF"><strong>下载方式说明:</strong></td>
  179. </tr>
  180. <tr>
  181. <td height="26" bgcolor="#FFFFFF"><strong>HEADER:</strong>使用header转向,通常设为这个。<br>
  182. <strong>META:</strong>直接转自,如果是FTP地址推荐选择这个。<br>
  183. <strong>READ:</strong>使用PHP程序读取,防盗链较强,但较占资源,服务器本地小文件可选择。</td>
  184. </tr>
  185. </table>
  186. </body>
  187. </html>