ASP function library (all functions can be called directly, which is very convenient) 4

Source: Internet
Author: User
Tags mssqlserver

'*************************************** ***********
'Function name: listobjinfo
'Usage: List component installation information
'Parameter :----
'Return value: List component installation information
'Example: listobjinfo ()
'*************************************** ***********
Public Function listobjinfo ()
Dim tempbs, tempbsxx, tempobjtype, tmpobjs
Tempbs = "×"
Tempbsxx = ""
Tempobjtype = ""
Tmpobjs = ""
Tmpobjs = tmpobjs & "jmail. Message |"
Tmpobjs = tmpobjs & "ADODB. Stream |"
Tmpobjs = tmpobjs & "mswc. adrotator |"
Tmpobjs = tmpobjs & "mswc. browsertype |"
Tmpobjs = tmpobjs & "mswc. nextlink |"
Tmpobjs = tmpobjs & "mswc. Tools |"
Tmpobjs = tmpobjs & "mswc. Status |"
Tmpobjs = tmpobjs & "mswc. counters |"
Tmpobjs = tmpobjs & "mswc. permissionchecker |"
Tmpobjs = tmpobjs & "scripting. FileSystemObject |"
Tmpobjs = tmpobjs & "ADODB. Connection |"
Tmpobjs = tmpobjs & "SoftArtisans. fileup |"
Tmpobjs = tmpobjs & "SoftArtisans. filemanager |"
Tmpobjs = tmpobjs & "cdonts. newmail |"
Tmpobjs = tmpobjs & "persits. mailsender |"
Tmpobjs = tmpobjs & "lyfupload. uploadfile |"
Tmpobjs = tmpobjs & "persits. upload.1 |"
Tmpobjs = tmpobjs & "w3.upload |"
Tmpobjs = Split (tmpobjs, "| ")
Response. write "<center> <Table border = '1' bordercolor = '#000000 'cellspacing = '0' cellpadding = '0' style = 'font-size: 9pt; ""> '> <tr> <TD width = '000000' valign = 'middle' align = 'center' style = 'border-left: 1 solid # 33%; border-Right: 1 solid # ffffff; border-top: 1 solid # ffffff; border-bottom: 1 solid #808080; padding-left: 2; padding-Right: 2; padding-top: 1; padding-bottom: 1 '> component id </TD> <TD width = '000000' valign = 'middle' align = 'center' style = 'border-left: 1 solid # 33%; border-Right: 1 solid # ffffff; border-top: 1 solid # ffffff; border-bottom: 1 solid #808080; padding-left: 2; padding-Right: 2; padding-top: 1; padding-bottom: 1 '> √ | × </TD> <TD width = '000000' valign = 'middle' align = 'center' style = 'border-left: 1 solid # 34%; border-Right: 1 solid # ffffff; border-top: 1 solid # ffffff; border-bottom: 1 solid #808080; padding-left: 2; padding-Right: 2; padding-top: 1; padding-bottom: 1'> version </TD> </tr> "& vbcrlf
For I = lbound (tmpobjs) to ubound (tmpobjs)
If trim (tmpobjs (I) <> "then
If isobjinstalled (tmpobjs (I) then
Tempobjtype = tmpobjs (I)
Tempbs = "√"
Tempbsxx = getobjver (tmpobjs (I ))
If tempbsxx = "" Then tempbsxx = "& nbsp ;"
Else
Tempobjtype = "<font color = '#800000'>" & tmpobjs (I) & "</font>"
Tempbs = "<font color = '#800000'> × </font>"
Tempbsxx = "& nbsp ;"
End if
Response. Write "<tr>" & vbcrlf
Response. write "<TD valign = 'middle' style = 'border-left: 1 solid #808080; border-Right: 1 solid # ffffff; border-top: 1 solid # ffffff; border-bottom: 1 solid #808080; padding-left: 2; padding-Right: 2; padding-top: 1; padding-bottom: 1 '> "& tempobjtype &" </TD> "& vbcrlf
Response. write "<TD valign = 'middle' align = 'center' style = 'border-left: 1 solid #808080; border-Right: 1 solid # ffffff; border-top: 1 solid # ffffff; border-bottom: 1 solid #808080; padding-left: 2; padding-Right: 2; padding-top: 1; padding-bottom: 1 '> "& tempbs &" </TD> "& vbcrlf
Response. write "<TD valign = 'middle' align = 'center' style = 'border-left: 1 solid #808080; border-Right: 1 solid # ffffff; border-top: 1 solid # ffffff; border-bottom: 1 solid #808080; padding-left: 2; padding-Right: 2; padding-top: 1; padding-bottom: 1 '> "& tempbsxx &" </TD> "& vbcrlf
Response. Write "</tr>" & vbcrlf
End if
Next
Response. Write "</table> </center>" & vbcrlf
End Function
'*************************************** ***********
'Function ID: 0024 [File Upload window]
'Function name: posimagewin
'Usage: In the upload and select file window, the file name and type can be automatically extracted.
'Parameter: pfurlstr ---- URL address for processing binary file information
'Return value: webpage HTML file
'Example: database structure example create table [images] ([ID] int identity () not null primary key, [MC] varchar (50 ), [lx] varchar (20), [mem] Text, [IMGs] image)
'*************************************** ***********
Public Function posimagewin (byval pfurlstr)
Posimagewin = ""
Posimagewin = posimagewin & "<center> <Table border = '0' width = '0' cellspacing = '0' cellpadding = '0' style = 'font-size: 9pt '> "& vbcrlf
Posimagewin = posimagewin & "<script language = JavaScript>" & vbcrlf
Posimagewin = posimagewin & "function ckfilelx () {" & vbcrlf
Posimagewin = posimagewin & "tempwjm = pofile. imagefs. value;" & vbcrlf
Posimagewin = posimagewin & "fgwjm = tempwjm. Split ('.');" & vbcrlf
Posimagewin = posimagewin & "newwjm = fgwjm. Reverse ();" & vbcrlf
Posimagewin = posimagewin & "pomem. imagetype. value = newwjm [0]. touppercase ();" & vbcrlf
Posimagewin = posimagewin & "tempwjm = newwjm [1]. touppercase ();" & vbcrlf
Posimagewin = posimagewin & "fgwjm = tempwjm. Split ('\');" & vbcrlf
Posimagewin = posimagewin & "newwjm = fgwjm. Reverse ();" & vbcrlf
Posimagewin = posimagewin & "pomem. imagename. value = newwjm [0]. touppercase ();" & vbcrlf
Posimagewin = posimagewin & "pomem. imagereadme. value = newwjm [0]. touppercase ();" & vbcrlf
Posimagewin = posimagewin & "}" & vbcrlf
Posimagewin = posimagewin & "function reedit () {pofile. Reset (); pomem. Reset () ;}" & vbcrlf
Posimagewin = posimagewin & "function postdo () {If (pofile. imagefs. value ='') {alert ('No file selected! ');} Else {BC. innerhtml = 'Uploading... please wait... '; pofile. action = pofile. action + '& Mc =' + pomem. imagename. value + '& Lx =' + pomem. imagetype. value + '& mem =' + pomem. imagereadme. value; BC. style. visibility = 'visible '; Reed. disabled = true; pose. disabled = true; pofile. submit (); pofile. imagefs. disabled = true ;}} "& vbcrlf
Posimagewin = posimagewin & "</SCRIPT>" & vbcrlf
Posimagewin = posimagewin & "<tr> <form method = 'post' name = 'pofile' enctype = 'multipart/form-data' action = '" & pfurlstr & "'target = 'templa'> <TD width = '000000' valign = 'middle'> "& vbcrlf
Posimagewin = posimagewin & "select a file: <input type = 'file' name = 'imagefs' onchange = 'ckfilelx (); 'style = 'font-size: 9pt; width: 300; '> "& vbcrlf
Posimagewin = posimagewin & "</TD> </form> </tr>" & vbcrlf
Posimagewin = posimagewin & "<tr> <form method = 'post' name = 'pomem '> <TD width = '000000' valign = 'middle'>" & vbcrlf
Posimagewin = posimagewin & "File ID: <input type = 'text' name = 'imageid' readonly style = 'font-size: 9pt; width: 300; '> <br> "& vbcrlf
Posimagewin = posimagewin & "File Name: <input type = 'text' name = 'imagename' style = 'font-size: 9pt; width: 300; '> <br> "& vbcrlf
Posimagewin = posimagewin & "file type: <input type = 'text' name = 'imagetype 'readonly style = 'font-size: 9pt; width: 300; '> <br> "& vbcrlf
Posimagewin = posimagewin & "file Introduction: <textarea rows = '8' name = 'imagereadme 'Cols = '20' style = 'font-size: 9pt; width: 300; '> NO </textarea> "& vbcrlf
Posimagewin = posimagewin & "</TD> </form> </tr>" & vbcrlf
Posimagewin = posimagewin & "<tr> <TD width = '000000' valign = 'middle' align = 'center'>" & vbcrlf
Posimagewin = posimagewin & "<input type = 'button 'value = 'reset 'name = 'reed 'onclick = 'reedit ();'> & nbsp; <input type = 'button 'value = 'upload 'name = 'pose 'onclick = 'postdo (); '> "& vbcrlf
Posimagewin = posimagewin & "</TD> </tr> </table> </center> <Div id = 'bc' name = 'bc' style = 'position: absolute; left: 45%; top: 40%; Z-index: 0; Background-color: # eaeaea; visibility: hidden; 'valign = 'middle' align = 'center'> </div> "& vbcrlf
Posimagewin = posimagewin & "<IFRAME src ='' id = 'tempa' name = 'tempa' frameborder = '0' width = '0' Height = '0' style = 'width: 0; Height: 0; '> "& vbcrlf
End Function
'*************************************** ***********
'Function ID: 0025 [Retrieving Database Link strings]
'Function name: getconnstr
'Usage: Obtain the database link string to generate the msaccess and MSSQLServer link strings.
'Parameter: lx ---- 0 is msaccess, and 1 is MSSQLServer
'Parameter: dbiporpath ---- database IP address or path
'Parameter: dbmc ---- Database Name
'Parameter: dbuid ---- Database User Name
'Parameter: dbupwd ---- Database User Password
'Return value: link string
'Example: http://www.knowsky.com/
'*************************************** ***********
Public Function getconnstr (byval lx, byval dbiporpath, byval dbmc, byval dbuid, byval dbupwd)
Getconnstr = ""
If Lx = 0 then
If right (dbiporpath, 1) <> "\" then dbiporpath = dbiporpath &"\"
Getconnstr = "provider = Microsoft. Jet. oledb.4.0; Data Source =" & dbiporpath & dbmc & "; Jet oledb: Database Password =" & dbupwd &";"
End if
If Lx = 1 then
Getconnstr = "driver = SQL Server; uid =" & dbuid & "; database =" & dbmc & "; server =" & dbiporpath & "; Pwd =" & dbupwd &";"
End if
End Function
'*************************************** ***********
'Function ID: 0026 [obtain the multipart/form-data form to upload files]
'Function name: getimagedata
'Usage: Get multipart/form-data to upload files
'Parameter: maxsize ---- the maximum size of the upload. Unit: m (MB)
'Return value: binary data
'Example:
'*************************************** ***********
Public Function getimagedata (byval maxsize)
Getimagedata = ""
Dim formsize, formdata, bncrlf, divider, datastart, dataend, mydata
Formsize = request. totalbytes
If (formsize <= (maxsize * 1024*1024) then
Formdata = request. binaryread (formsize)
Pos_ts = lenb (getbytestring (CHR (13) & CHR (10) & CHR (13) & CHR (10 )))
Pos_ B = Response B (formdata, getbytestring (CHR (13) & CHR (10) & CHR (13) & CHR (10) + pos_ts
Nformdata = midb (formdata, pos_ B)
Pos_ts = fig B (nformdata, getbytestring (CHR (13) & CHR (10 )&"--"))
Nnformdata = midb (nformdata, pos_ts)
Pos_e = lenb (formdata)-lenb (nnformdata)-pos_ B + 1
Datastart = pos_ B
Dataend = pos_e
Mydata = midb (formdata, datastart, dataend)
End if
Getimagedata = mydata
End Function
''' Convert the string into a binary string.
Function getbytestring (stringstr)
For I = 1 to Len (stringstr)
Char = mid (stringstr, I, 1)
Getbytestring = getbytestring & chrb (ASCB (char ))
Next
End Function
'*************************************** ***********
'Function ID: 0027 [Save or view the data uploaded to the database, with the call upload window]
'Function name: goimgtodb
'Usage: Save or view the data uploaded to the database, with the call upload window
'Parameter: pplx ---- execution type (empty: Save, ID: view the ID file)
'Parameter: purl ---- URL part of the main execution Program
'Parameter: connstr ---- database link string of the file to be uploaded
'Parameter: imagtbname ---- name of the data table saved in the file
'Parameter: Did ---- File ID field name
'Parameter: DMC ---- File Name field name
'Parameter: DLX ---- file type field name
'Parameter number: ",". "----", "indicates the field name.
'Parameter: dData ---- field name of the binary data of the file
'Parameter: maxsize ---- the maximum size of the upload. Unit: m (MB)
'Parameter: idlx ---- type of the ID field (0-digit-type 1 value (non-self-increment type) 2-digit-type (self-increment type ))
'Return value: successfully saved JavaScript note that the length of the identified field should exceed 20 characters in non-automatic increments
'Example: goimgtodb ("17", "http: // 127.0.0.1/function. ASP ", getconnstr (1," 127.0.0.1 "," Temp "," sa "," mzy1029 ")," IMG "," ID "," Mc "," lx ", "mem", "data", 20)
'Example: goimgtodb ("", "http: // 127.0.0.1/function. ASP ", getconnstr (1," 127.0.0.1 "," Temp "," sa "," mzy1029 ")," IMG "," ID "," Mc "," lx ", "mem", "data", 20)
'*************************************** ***********
Public Function goimgtodb (byval pplx, byval Purl, byval connstr, byval imagtbname, byval did, byval DMC, byval DLX, byval F8, byval dData, byval maxsize, byval idlx)
Dim pjobs, pjurl
Tempimg_conn_str = connstr
Set fu_conn = server. Createobject ("ADODB. Connection ")
Set fu_rs = server. Createobject ("ADODB. recordset ")
Fu_conn.open tempimg_conn_str
If jcid (pplx) = 0 then
Pjobs = request ("IMG ")
If instr (Purl ,"? ")> 0 then
Pjurl = purl & "& IMG = sav"
Else
Pjurl = purl &"? IMG = sav"
End if
If pjobs = "" Then response. Write posimagewin (pjurl)
If pjobs = "SAV" then
SQL _str = "select" & did & "," & DMC & "," & DLX & "," & DMEM & "," & dData & "from" & imagtbname
Fu_rs.open SQL _str, fu_conn, 3,3
Fu_rs.addnew
If idlx <2 then
Fu_rs (did) = maketheid ()
End if
Fu_rs (DMC) = request ("MC ")
Fu_rs (DLX) = request ("lx ")
Fu_rs (F8) = request ("mem ")
Fu_rs (dData). AppendChunk getimagedata (jcid (maxsize ))
Fu_rs.update
Fu_rs.close
Fu_rs.open SQL _str, fu_conn, 3,3
Fu_rs.movelast
Response. Write "<script language = JavaScript>" & vbcrlf
Response. Write "parent. pomem. imageid. value = '" & fu_rs (did) & "';" & vbcrlf
Response. Write "parent. bc. innerhtml = 'the data is successfully saved! ';"
Response. Write "</SCRIPT>" & vbcrlf
End if
Else
If idlx> 0 then
SQL _str = "select" & did & "," & DMC & "," & DLX & "," & moodle &", "& dData &" from "& imagtbname &" where ("& did &" = "& pplx &")"
Else
SQL _str = "select" & did & "," & DMC & "," & DLX & "," & moodle &", "& dData &" from "& imagtbname &" where ("& did &" = '"& pplx &"')"
End if
Fu_rs.open SQL _str, fu_conn, 1, 1
If fu_rs.recordcount> 0 then
Tempaa = trim (fu_rs (DLX ))
Response. Clear
Response. expires =-9999
Response. addheader "Pragma", "No-Cache"
Response. addheader "cache-ctrol", "No-Cache"
Response. Buffer = true
Response. addheader "content-Disposition:", "attachment; filename =" & fu_rs (DMC) & "." & tempaa
Response. contenttype = "application/" & trim (fu_rs (DLX ))
Response. Flush
Response. binarywrite fu_rs (dData)
Response. End
End if
End if
Fu_rs.close
Fu_conn.close
Set fu_rs = nothing
Set fu_conn = nothing
End Function
'*************************************** ***********''''

Related Article

Contact Us

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

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

A Free Trial That Lets You Build Big!

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

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

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