📄 file_edit.asp
字号:
<!--#include file="chkuser.asp"-->
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/user.asp"-->
<%
dim filehtml, files , filetext
username=Request.Cookies("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
response.redirect("error.asp?error=baderror")
Response.end
End if
checkpath="/"&Request.Cookies("username")
if lcase(checkpath)<>lcase(left(files,len("/"&Request.Cookies("username")))) then
response.redirect("error.asp?error=baderror")
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/style.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="js/title.js"></script>
</head>
<body bgcolor="#dddddd" 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="0">
<tr>
<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" class="input" style="width:300" value="<%=files%>" size="1" maxlength="50">
<input name="Button" type="submit" class="button" value="读文件">
<%
select case rshost("html")
case True
Response.Write("<input name=Submit type=button class=button value=HTML编辑器 onClick=location.href='editor.asp?file="&files&"'>")
case False
Response.Write("<input name=Submit type=button class=button value=HTML编辑器 title='已经关闭此项功能' disabled>")
end select
%>
</td>
</form>
</tr>
</table></td>
</tr>
<tr>
<td align="center"><form name="form1" method="post" action="file_save.asp">
<textarea name="html" cols="70" rows="25" style="background-color:ffffff"><%=Server.HTMLEncode(filetext)%></textarea><br>
<input type="hidden" name="file" value="<%=files%>">
<br>
<input type="submit" name="submit" class="button" value="保存">
<input type="reset" name="submit2" class="button" value="恢复">
</form></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -