<!--#include file ="Conn.asp"-->
<!--#include file ="Check_Manager.asp"-->
<html>
<head>
<title>管理中心</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><LINK href="admin/admin.css" type=text/css rel=stylesheet><script language="JavaScript" src="admin/js.js"></SCRIPT></head>
<script language="JavaScript" type="text/JavaScript">
function change(obj,i) {
he=parseInt(obj.style.height);
if (he>=100&&he<=600)
   obj.style.height=he+i;
else 
   obj.style.height='280';
}

function CheckForm()
{
  if (document.myform.Content.value=="")
  {
    alert("文件内容不能为空！");
    document.myform.Content.focus();
    return false;
  }
    if (document.myform.fname.value=="")
  {
    alert("文件名称不能为空！");
    document.myform.fname.focus();
    return false;
  }
   if (document.myform.fpath.value=="")
  {
    alert("文件路径不能为空！");
    document.myform.fpath.focus();
    return false;
  }
}
</script>

<body text="#000000">
<br>
<%
Dim fasp
Dim strRootFolder
Dim fpath
Dim objFSO
Dim fname
Dim flo
strRootFolder = Server.MapPath("/") 
fasp = Split(Request.ServerVariables("SCRIPT_NAME"),"/") 
flo = strRootFolder&"\"&fasp(1)
erase fasp
If Request.QueryString("action")="do" Then
dim objtext,fullname
Dim Ctext
on error resume next
Ctext = Request.form("Content")
fpath = Trim(Request.form("fpath"))
If instr(Ctext,"Scripting.FileSystemObject") Then
  Response.write "<script language='javascript'>" & chr(13)
		Response.write "alert('安全问题禁止使用FSO!');" & Chr(13)
		response.write "javascript:history.go(-1);"&Chr(13)
		Response.write "</script>" & Chr(13)
    Response.End
Else
fname = request.form("fname")
if right(fname,3)<>"asp" Then
  Response.write "<script language='javascript'>" & chr(13)
		Response.write "alert('只能创建.ASP的文件!');" & Chr(13)
		response.write "javascript:history.go(-1);"&Chr(13)
		Response.write "</script>" & Chr(13)
    Response.End
Else
fullname=fpath & "\"& fname
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
set objtext=objFSO.CreateTextFile(fullname,True)
objtext.WriteLine (Ctext)
objtext.close
if err<>0 then
response.write "保存文件时发生错误,可能是您没有写入权限"
response.end
else
response.write "创建"&fullname&"文件成功!访问地址：你的URL+"&fname&" <a href=JaAcc_File.asp>返回编辑页面</a>"
Response.End
End if
End if
End If
End if
%>
<form method="POST" name="myform" onSubmit="return CheckForm();" action="?action=do">
<table width="87%" border="0" align="center" cellpadding="4" cellspacing="0" class=tableBorder>
  <tr> 
    <td height="25" background="admin/admin_bg_1.gif"><div align="center"><strong><font color="#FFFFFF">文件扩展编辑</font></strong></div></td>
  </tr>
   
  <tr>
      <td align="center"> 
        <table width="90%" border="0" cellspacing="0" cellpadding="0">
          <tr> 
            <td><div align="center">
                <textarea name="Content" cols="100" rows="20"></textarea>
    <BR> &nbsp;<A 
      href="javascript:change(document.all.Content,-20)"><IMG title=缩小文本框 
      src="admin/minus.gif" border=0></A>&nbsp;&nbsp;<A 
      href="javascript:change(document.all.Content,20)"><IMG title=放大文本框 
      src="admin/plus.gif" border=0></A>
              </div></td>
          </tr>
          <tr>
            <td height="30"><div align="center">文件名称(如：JaAcc.asp)： 
                <INPUT name=fname value="" size=20 maxlength="150"> 生成文件路径：<INPUT name=fpath value="<%=flo%>" size=25 maxlength="150">
              </div></td>
          </tr>
       <tr>
            <td height="30"> <div align="center">
               <INPUT type=submit value="保存文件" name=Submit></div>
              </td>
          </tr>
        
        </table> </td>
  </tr>
</table>
</FORM>
