ASP Online Notepad Program

Source: Internet
Author: User
Tags save file

<!--#include file= "conn/conn.asp"-->
<%
If session ("username") = "" or Session ("Use_type") <> "Super Administrator" then
Response. Write ("<script language= ' JavaScript ' >alert (' does not have sufficient permissions to operate the site file! '); History.back ();</script> ")
Response.End
End If
Dim Path,filename,filetype,fileconten,fso
Path=request ("path")
Filename=html_encode (Request ("filename"))
Filecontent=request ("Filecontent")
Filetype=request ("filetype")
If InStr (FileName, "*") >0 or InStr (filename, "?") >0 or InStr (filename, "&") >0 or len (filename) <0 or filename= "" Then
Response. Write ("<script language= ' JavaScript ' >alert (' illegal filename! '); History.back ();</script> ")
Response.End
Else
Set Fso=server.createobject ("Scripting.FileSystemObject")
If Fso.fileexists (Path&filename&filetype) Then
Response. Write ("<script language= ' JavaScript" >alert (' filename has been saved, please choose again! '); History.back ();</script> ")
Response. End ()
End If
Set Input=fso.createtextfile (Server.MapPath (Path&filename&filetype), true)
Input.writeline (filecontent)
Input.close
If Err Then
Response. Write (' <script language= ' JavaScript ' >alert (' unexpected error! ' Save file failed! '); History.back ();</script> ")
Else
%>
<script language= "" >
var pathh= "<%=replace" (Session ("ScriptName"), "", "/")%> ";
Alert ("File success!");
window.location= "Try/mange_page.asp?pathh=" +PATHH;
</script>

<%
' Response.Redirect ("try/mange_page.asp")
End If
End If
%>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.