SetSafe.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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,"setsafe");
  20. if($ecms_config['esafe']['openonlinesetting']==0||$ecms_config['esafe']['openonlinesetting']==1)
  21. {
  22. echo"没有开启后台在线配置参数,如果要使用在线配置先修改/e/config/config.php文件的\$ecms_config['esafe']['openonlinesetting']变量设置开启";
  23. exit();
  24. }
  25. $enews=$_POST['enews'];
  26. if(empty($enews))
  27. {$enews=$_GET['enews'];}
  28. if($enews)
  29. {
  30. hCheckEcmsRHash();
  31. include('setfun.php');
  32. }
  33. if($enews=='SetSafe')
  34. {
  35. SetSafe($_POST,$logininid,$loginin);
  36. }
  37. db_close();
  38. $empire=null;
  39. ?>
  40. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  41. <html>
  42. <head>
  43. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  44. <title>安全参数配置</title>
  45. <link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
  46. </head>
  47. <body>
  48. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  49. <tr>
  50. <td>位置:<a href="SetSafe.php<?=$ecms_hashur['whehref']?>">安全参数配置</a>
  51. <div align="right"> </div></td>
  52. </tr>
  53. </table>
  54. <form name="setform" method="post" action="SetSafe.php" onsubmit="return confirm('确认设置?');" autocomplete="off">
  55. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  56. <?=$ecms_hashur['form']?>
  57. <tr class="header">
  58. <td height="25" colspan="2">安全参数配置
  59. <input name="enews" type="hidden" id="enews" value="SetSafe"> </td>
  60. </tr>
  61. <tr>
  62. <td height="25" colspan="2">后台安全相关配置</td>
  63. </tr>
  64. <tr>
  65. <td width="17%" height="25" bgcolor="#FFFFFF"> <div align="left">后台登录认证码</div></td>
  66. <td width="83%" height="25" bgcolor="#FFFFFF"> <input name="loginauth" type="password" id="loginauth" value="<?=$ecms_config['esafe']['loginauth']?>" size="35">
  67. <font color="#666666">(如果设置登录需要输入此认证码才能通过)</font></td>
  68. </tr>
  69. <tr>
  70. <td height="25" bgcolor="#FFFFFF"> <div align="left">后台登录COOKIE认证码</div></td>
  71. <td height="25" bgcolor="#FFFFFF"> <input name="ecookiernd" type="text" id="ecookiernd" value="<?=$ecms_config['esafe']['ecookiernd']?>" size="35">
  72. <input type="button" name="Submit3" value="随机" onclick="document.setform.ecookiernd.value='<?=make_password(36)?>';">
  73. <font color="#666666">(填写10~50个任意字符,最好多种字符组合)</font></td>
  74. </tr>
  75. <tr>
  76. <td height="25" bgcolor="#FFFFFF">后台开启验证登录IP</td>
  77. <td height="25" bgcolor="#FFFFFF"> <input type="radio" name="ckhloginip" value="1"<?=$ecms_config['esafe']['ckhloginip']==1?' checked':''?>>
  78. 开启
  79. <input type="radio" name="ckhloginip" value="0"<?=$ecms_config['esafe']['ckhloginip']==0?' checked':''?>>
  80. 关闭 <font color="#666666">(如果上网的IP是变动的,不要开启)</font></td>
  81. </tr>
  82. <tr>
  83. <td height="25" bgcolor="#FFFFFF">后台启用SESSION验证</td>
  84. <td height="25" bgcolor="#FFFFFF"><input type="radio" name="ckhsession" value="1"<?=$ecms_config['esafe']['ckhsession']==1?' checked':''?>>
  85. 开启
  86. <input type="radio" name="ckhsession" value="0"<?=$ecms_config['esafe']['ckhsession']==0?' checked':''?>>
  87. 关闭 <font color="#666666">(更安全,需空间支持SESSION)</font></td>
  88. </tr>
  89. <tr>
  90. <td height="25" bgcolor="#FFFFFF">记录登陆日志</td>
  91. <td height="25" bgcolor="#FFFFFF"> <input type="radio" name="theloginlog" value="0"<?=$ecms_config['esafe']['theloginlog']==0?' checked':''?>>
  92. 开启
  93. <input type="radio" name="theloginlog" value="1"<?=$ecms_config['esafe']['theloginlog']==1?' checked':''?>>
  94. 关闭</td>
  95. </tr>
  96. <tr>
  97. <td height="25" bgcolor="#FFFFFF">记录操作日志</td>
  98. <td height="25" bgcolor="#FFFFFF"> <input type="radio" name="thedolog" value="0"<?=$ecms_config['esafe']['thedolog']==0?' checked':''?>>
  99. 开启
  100. <input type="radio" name="thedolog" value="1"<?=$ecms_config['esafe']['thedolog']==1?' checked':''?>>
  101. 关闭</td>
  102. </tr>
  103. <tr>
  104. <td height="25" bgcolor="#FFFFFF">开启访问来源验证</td>
  105. <td height="25" bgcolor="#FFFFFF"><select name="ckfromurl" id="ckfromurl">
  106. <option value="0"<?=$ecms_config['esafe']['ckfromurl']==0?' selected':''?>>不开启验证</option>
  107. <option value="1"<?=$ecms_config['esafe']['ckfromurl']==1?' selected':''?>>开启前后台验证</option>
  108. <option value="2"<?=$ecms_config['esafe']['ckfromurl']==2?' selected':''?>>仅开启后台验证</option>
  109. <option value="3"<?=$ecms_config['esafe']['ckfromurl']==3?' selected':''?>>仅开启前台验证</option>
  110. <option value="4"<?=$ecms_config['esafe']['ckfromurl']==4?' selected':''?>>开启前后台验证(严格)</option>
  111. <option value="5"<?=$ecms_config['esafe']['ckfromurl']==5?' selected':''?>>仅开启后台验证(严格)</option>
  112. <option value="6"<?=$ecms_config['esafe']['ckfromurl']==6?' selected':''?>>仅开启前台验证(严格)</option>
  113. </select>
  114. <font color="#666666">(设置禁止非本站访问地址来源)</font></td>
  115. </tr>
  116. <tr>
  117. <td height="25" bgcolor="#FFFFFF">开启后台来源认证码</td>
  118. <td height="25" bgcolor="#FFFFFF"><select name="ckhash" id="ckhash">
  119. <option value="0"<?=$ecms_config['esafe']['ckhash']==0?' selected':''?>>金刚模式</option>
  120. <option value="1"<?=$ecms_config['esafe']['ckhash']==1?' selected':''?>>刺猬模式</option>
  121. <option value="2"<?=$ecms_config['esafe']['ckhash']==2?' selected':''?>>关闭验证</option>
  122. </select>
  123. <font color="#666666">(推荐启用“金刚模式”,对外部访问与提交进行防御)</font></td>
  124. </tr>
  125. <tr>
  126. <td height="25" bgcolor="#FFFFFF">&nbsp;</td>
  127. <td height="25" bgcolor="#FFFFFF">访问变量名:
  128. <input name="ckhashename" type="text" id="ckhashename" value="<?=$ecms_config['esafe']['ckhashename']?>" size="12">
  129. ,提交变量名:
  130. <input name="ckhashrname" type="text" id="ckhashrname" value="<?=$ecms_config['esafe']['ckhashrname']?>" size="12">
  131. <font color="#666666">(必须字母开头,并且只能由字母、数字、下划线组成)</font></td>
  132. </tr>
  133. <tr>
  134. <td height="25" bgcolor="#FFFFFF">后台访问的UserAgent包含</td>
  135. <td height="25" bgcolor="#FFFFFF"><input name="ckhuseragent" type="text" id="ckhuseragent" value="<?=$ecms_config['esafe']['ckhuseragent']?>" size="35">
  136. <font color="#666666">(区分大小写,多个用“||”半角双竖线隔开,设置后UserAgent信息必须包含这些字符才能访问后台)</font></td>
  137. </tr>
  138. <tr>
  139. <td height="25" colspan="2">COOKIE配置</td>
  140. </tr>
  141. <tr>
  142. <td height="25" bgcolor="#FFFFFF">COOKIE作用域</td>
  143. <td height="25" bgcolor="#FFFFFF"> <input name="cookiedomain" type="text" id="fw_pass3" value="<?=$ecms_config['cks']['ckdomain']?>" size="35"> </td>
  144. </tr>
  145. <tr>
  146. <td height="25" bgcolor="#FFFFFF">COOKIE作用路径</td>
  147. <td height="25" bgcolor="#FFFFFF"><input name="cookiepath" type="text" id="cookiedomain" value="<?=$ecms_config['cks']['ckpath']?>" size="35"></td>
  148. </tr>
  149. <tr>
  150. <td height="25" bgcolor="#FFFFFF">COOKIE的HttpOnly属性</td>
  151. <td height="25" bgcolor="#FFFFFF"><select name="ckhttponly" id="ckhttponly">
  152. <option value="0"<?=$ecms_config['cks']['ckhttponly']==0?' selected':''?>>关闭</option>
  153. <option value="1"<?=$ecms_config['cks']['ckhttponly']==1?' selected':''?>>开启</option>
  154. <option value="2"<?=$ecms_config['cks']['ckhttponly']==2?' selected':''?>>只后台开启</option>
  155. <option value="3"<?=$ecms_config['cks']['ckhttponly']==3?' selected':''?>>只前台开启</option>
  156. </select> </td>
  157. </tr>
  158. <tr>
  159. <td height="25" bgcolor="#FFFFFF">COOKIE的secure属性</td>
  160. <td height="25" bgcolor="#FFFFFF"><select name="cksecure" id="cksecure">
  161. <option value="0"<?=$ecms_config['cks']['cksecure']==0?' selected':''?>>自动识别</option>
  162. <option value="1"<?=$ecms_config['cks']['cksecure']==1?' selected':''?>>关闭</option>
  163. <option value="2"<?=$ecms_config['cks']['cksecure']==2?' selected':''?>>开启</option>
  164. <option value="3"<?=$ecms_config['cks']['cksecure']==3?' selected':''?>>只后台开启</option>
  165. <option value="4"<?=$ecms_config['cks']['cksecure']==4?' selected':''?>>只前台开启</option>
  166. </select>
  167. <font color="#666666">(开启需要https支持)</font></td>
  168. </tr>
  169. <tr>
  170. <td height="25" bgcolor="#FFFFFF">前台COOKIE变量前缀</td>
  171. <td height="25" bgcolor="#FFFFFF"><input name="cookievarpre" type="text" id="cookievarpre" value="<?=$ecms_config['cks']['ckvarpre']?>" size="35">
  172. <font color="#666666">(由英文字母组成,5~12个字符组成)</font></td>
  173. </tr>
  174. <tr>
  175. <td height="25" bgcolor="#FFFFFF">后台COOKIE变量前缀</td>
  176. <td height="25" bgcolor="#FFFFFF"><input name="cookieadminvarpre" type="text" id="cookieadminvarpre" value="<?=$ecms_config['cks']['ckadminvarpre']?>" size="35">
  177. <font color="#666666">(由英文字母组成,5~12个字符组成)</font></td>
  178. </tr>
  179. <tr>
  180. <td height="25" bgcolor="#FFFFFF">COOKIE验证随机码</td>
  181. <td height="25" bgcolor="#FFFFFF"> <input name="cookieckrnd" type="text" id="cookieckrnd" value="<?=$ecms_config['cks']['ckrnd']?>" size="35">
  182. <input type="button" name="Submit32" value="随机" onclick="document.setform.cookieckrnd.value='<?=make_password(36)?>';">
  183. <font color="#666666">(填写10~50个任意字符,最好多种字符组合)</font></td>
  184. </tr>
  185. <tr>
  186. <td height="25" bgcolor="#FFFFFF">COOKIE验证随机码2</td>
  187. <td height="25" bgcolor="#FFFFFF"><input name="cookieckrndtwo" type="text" id="cookieckrndtwo" value="<?=$ecms_config['cks']['ckrndtwo']?>" size="35">
  188. <input type="button" name="Submit322" value="随机" onclick="document.setform.cookieckrndtwo.value='<?=make_password(36)?>';">
  189. <font color="#666666">(填写10~50个任意字符,最好多种字符组合)</font></td>
  190. </tr>
  191. <tr>
  192. <td height="25" bgcolor="#FFFFFF">COOKIE验证随机码3</td>
  193. <td height="25" bgcolor="#FFFFFF"><input name="cookieckrndthree" type="text" id="cookieckrndthree" value="<?=$ecms_config['cks']['ckrndthree']?>" size="35">
  194. <input type="button" name="Submit3222" value="随机" onclick="document.setform.cookieckrndthree.value='<?=make_password(36)?>';">
  195. <font color="#666666">(填写10~50个任意字符,最好多种字符组合)</font></td>
  196. </tr>
  197. <tr>
  198. <td height="25" bgcolor="#FFFFFF">COOKIE验证随机码4</td>
  199. <td height="25" bgcolor="#FFFFFF"><input name="cookieckrndfour" type="text" id="cookieckrndfour" value="<?=$ecms_config['cks']['ckrndfour']?>" size="35">
  200. <input type="button" name="Submit32222" value="随机" onclick="document.setform.cookieckrndfour.value='<?=make_password(36)?>';">
  201. <font color="#666666">(填写10~50个任意字符,最好多种字符组合)</font></td>
  202. </tr>
  203. <tr>
  204. <td height="25" bgcolor="#FFFFFF">COOKIE验证随机码5</td>
  205. <td height="25" bgcolor="#FFFFFF"><input name="cookieckrndfive" type="text" id="cookieckrndfive" value="<?=$ecms_config['cks']['ckrndfive']?>" size="35">
  206. <input type="button" name="Submit322222" value="随机" onclick="document.setform.cookieckrndfive.value='<?=make_password(36)?>';">
  207. <font color="#666666">(填写10~50个任意字符,最好多种字符组合)</font></td>
  208. </tr>
  209. <tr>
  210. <td height="25" bgcolor="#FFFFFF"></td>
  211. <td height="25" bgcolor="#FFFFFF"> <input type="submit" name="Submit" value=" 设 置 ">
  212. &nbsp;&nbsp;&nbsp; <input type="reset" name="Submit2" value="重置"></td>
  213. </tr>
  214. </table>
  215. </form>
  216. </body>
  217. </html>