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

📄 common.asp

📁 BugTrack is a basic, yet fully functional web based Bug Tracking system that you may use as a framew
💻 ASP
字号:
<!-- #INCLUDE FILE="adovbs.inc" -->
<!-- #INCLUDE FILE="TemplateObj.asp" -->
<%

'
'         Filename: Common.asp
'         Generated with CodeCharge 1.2.0
'         ASPTemplates.ccp build 5/9/2001
'

CRLF = chr(13) & chr(10)

bDebug = false

sAppPath = left(Request("PATH_TRANSLATED"), instrrev(Request("PATH_TRANSLATED"), "\"))

sHeaderFileName = sAppPath & "Header.html"
' Bug Management Connection begin

Set cn = Server.CreateObject("ADODB.Connection")
'Database connection string


strConn = "Provider=;User ID=;Data Source=;Persist Security Info="
strLogin = ""
strPassword = ""
cn.open strConn, strLogin, strPassword
' Bug Management Connection end


sub openrs(rs, sql)
  Set rs = Server.CreateObject("ADODB.Recordset")
  rs.CursorLocation = adUseServer
  rs.Open sql, cn, adOpenForwardOnly, adLockReadOnly, adCmdText
end sub

sub openrsex(rs, sql, cursortype, locktype, options)
  Set rs = Server.CreateObject("ADODB.Recordset")
  rs.CursorLocation = adUseServer
  rs.Open sql, cn, cursortype, locktype, options
end sub

function ToHTML(strValue)

  if IsNull(strValue) then 
    ToHTML = ""
  else
    ToHTML = Server.HTMLEncode(strValue)
  end if

end function

function ToURL(strValue)
  if IsNull(strValue) then strValue = ""
  ToURL = Server.URLEncode(strValue)
end function

function GetValueHTML(rs, strFieldName)
  GetValueHTML = ToHTML(GetValue(rs, strFieldName))
end function

function GetValue(rs, strFieldName)
  on error resume next
  if rs is nothing then
  	GetValue = ""
  elseif (not rs.EOF) and (strFieldName <> "") then
    res = rs(strFieldName)
    if isnull(res) then 
      res = ""
    end if
    if VarType(res) = vbBoolean then
      if res then res = "1" else res = "0"
    end if
    GetValue = res
  else
    GetValue = ""
  end if
  if bDebug then response.write err.Description
end function

function GetParam(ParamName)
  if Request.QueryString(ParamName).Count > 0 then 
    Param = Request.QueryString(ParamName)
  elseif Request.Form(ParamName).Count > 0 then
    Param = Request.Form(ParamName)
  else 
    Param = ""
  end if
  if Param = "" then
    GetParam = Empty
  else
    GetParam = Param
  end if
end function

Function ToSQL(Value, sType)
  Param = Value
  if Param = "" then
    ToSQL = "Null"
  else
    if sType = "Number" then
      ToSQL = replace(CDbl(Param), ",", ".")
    else
      ToSQL = "'" & Replace(Param, "'", "''") & "'"
    end if
  end if
end function

function DLookUp(Table, fName, sWhere)
  on error resume next
  Res = cn.execute("select " & fName & " from " & Table & " where " & sWhere).Fields(0).Value
  if IsNull(Res) then Res = ""
  DLookUp = Res
end function

function getCheckBoxValue(sVal, CheckedValue, UnCheckedValue, sType)
  if isempty(sVal) then
    if UnCheckedValue = "" then
      getCheckBoxValue = "Null"
    else
      if sType = "Number" then
        getCheckBoxValue = UnCheckedValue
      else
        getCheckBoxValue = "'" & Replace(UnCheckedValue, "'", "''") & "'"
      end if
    end if
  else
    if CheckedValue = "" then
      getCheckBoxValue = "Null"
    else
      if sType = "Number" then
        getCheckBoxValue = CheckedValue
      else
        getCheckBoxValue = "'" & Replace(CheckedValue, "'", "''") & "'"
      end if
    end if
  end if
end function

function getValFromLOV(sVal, aArr)
  sRes = ""

  if (ubound(aArr) mod 2) = 1 then
    for i = 0 to ubound(aArr) step 2
      if cstr(sVal) = cstr(aArr(i)) then sRes = aArr(i+1)
    next
  end if

  getValFromLOV = sRes  
end function

Function ProceedError()
  if cn.Errors.Count > 0 then
    ProceedError = cn.Errors(0).Description & " (" & cn.Errors(0).Source & ")"
  elseif not (Err.Description = "") then
    ProceedError = Err.Description
  else
    ProceedError = ""
  end if
end Function


function CheckSecurity(iLevel)
  if Session("UserID") = "" then
    response.redirect("Login.asp?QueryString=" & toURL(request.serverVariables("QUERY_STRING")) & "&ret_page=" & toURL(request.serverVariables("SCRIPT_NAME")))
  else
    if CLng(Session("UserRights")) < CLng(iLevel) then response.redirect("Login.asp?QueryString=" & toURL(request.serverVariables("QUERY_STRING")) & "&ret_page=" & toURL(request.serverVariables("SCRIPT_NAME"))) 
  End if
end function


'  GlobalFuncs Start
'  GlobalFuncs End

%>

⌨️ 快捷键说明

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