📄 file_edit.asp
字号:
<!--#include file="admin.asp"-->
<%
set rsuser=server.createobject("ADODB.Recordset")
sqluser="select * from [user] where username='"&Request.Cookies("admin_username")&"'"
rsuser.open sqluser,conn,1,1
groups=rsuser("groups")
set rshost=server.createobject("ADODB.Recordset")
sqlhost="select * from [host] where id="&cint(groups)
rshost.open sqlhost,conn,1,1
userdir=rshost("userdir")
dim filehtml, files , filetext
username=Request.Cookies("admin_username")
files=request("file")
if not fso.FileExists(userdir&files) then
response.write "<script>alert('对不起,找不到该文件!');location.href='javascript:history.back()'</script>"
response.end
end if
Set fs = fso.GetFile(userdir&files)
if fs.size>204800 then
response.write "<script>alert('对不起,最大允许编辑尺寸为200KB!');location.href='javascript:self.close()'</script>"
response.end
end if
' 如果文件名是空的
if files="" then
response.write "<script>alert('对不起,文件名不能为空!');location.href='javascript:self.close()'</script>"
response.end
end if
If files = "" or Instr(files,"..")>0 then
ErrMsg("处理URL时出错,请与系统管理员联系!")
Response.end
End if
dim fso, f
set f = fso.opentextfile(userdir&files, 1)
filetext = f.readall
f.close
set fso = nothing
set f = nothing
%>
<html>
<head>
<title>文件编辑</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../css/user.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="js/title.js"></script>
</head>
<body leftmargin="0" topmargin="0" onkeydown=return(!(event.keyCode==78&&event.ctrlKey))>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><table width="600" border="0" align="center" cellpadding="0" cellspacing="1" class="a2">
<tr class="a1">
<td height="12" align="center"><table width="94%" border="0" align="center" cellpadding="4" cellspacing="0">
<tr><form name="form2" method="post" action="file_edit.asp">
<td>
文件位置:
<input name="file" type="text" style="width:300" value="<%=files%>" size="1" maxlength="50">
<input name="Button" type="submit" value="读文件"></td>
</form>
</tr>
</table></td>
</tr>
<tr class="a3">
<td align="center"><form name="form1" method="post" action="file_save.asp">
<textarea name="html" cols="100" rows="25" style="background-color:ffffff"><%=Server.HTMLEncode(filetext)%></textarea><br>
<input type="hidden" name="file" value="<%=files%>">
<br>
<input type="submit" name="submit" value="保存">
<input type="reset" name="submit2" value="恢复">
</form></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -