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

📄 module_config.asp

📁 JTBC网站内容管理系统是一套可扩充的网站内容管理系统
💻 ASP
字号:
<%
'****************************************************
' Jetiben CMS Power by Jetiben.com
' Email: jetiben@hotmail.com
' Web: http://www.jetiben.com/
'****************************************************
Function jtb_cms_module_view()
  Dim tid: tid = get_num(request.querystring("id"), 0)
  sqlstr = "select * from " & ndatabase & " where " & nidfield & "=" & tid
  Set rs = conn.Execute(sqlstr)
  If not rs.EOF Then
    Dim tmpstr, tmpastr, tmptstr, tmprstr
    tmpstr = ireplace("module.view", "tpl")
    tmpstr = replace(tmpstr, "{$vtopic}", rs(cfname("topic")))
    Dim tdatabase, tidfield, tfpre
    tdatabase = cndatabase(ngenre & "." & nsort, "data")
    tidfield = cnidfield(ngenre & "." & nsort, "data")
    tfpre = cnfpre(ngenre & "." & nsort, "data")
    Dim ti, tary, taryt, tacount
    ti = 0: tacount = 0
    Dim trs, tsqlstr
    Set trs = server.CreateObject("adodb.recordset")
    tsqlstr = "select * from " & tdatabase & " where " & cfnames(tfpre, "fid") & "=" & tid
    trs.open tsqlstr, conn, 1, 3
    redim tary(trs.recordcount - 1)
    redim taryt(trs.recordcount - 1)
    Do While Not trs.EOF
      tary(ti) = trs(cfnames(tfpre, "count"))
      taryt(ti) = trs(cfnames(tfpre, "topic"))
      tacount = tacount + trs(cfnames(tfpre, "count"))
      trs.movenext
      ti = ti + 1
    loop
    tmpastr = ctemplate(tmpstr, "{$recurrence_ida}")
    For ti = 0 to UBound(tary)
      tmptstr = Replace(tmpastr, "{$topic}", taryt(ti))
      tmptstr = Replace(tmptstr, "{$count}", tary(ti))
      tmptstr = Replace(tmptstr, "{$per}", cper(tary(ti), tacount))
      tmprstr = tmprstr & tmptstr
    Next
    tmpstr = Replace(tmpstr, jtbc_cinfo, tmprstr)
  End If
  Set rs = Nothing
  jtb_cms_module_view = tmpstr
End Function

Function jtb_cms_module()
  Select case request.querystring("type")
    Case "view"
      jtb_cms_module = jtb_cms_module_view
  End Select
End Function

Sub jtb_cms_module_votedisp()
  Dim tid: tid = get_num(request.querystring("id"), 0)
  If get_num(request.cookies("vote")(CStr(tid)), 0) = 1 Then Call client_alert(itake("module.vote_failed", "lng"), -1)
  Dim tvotes: tvotes = get_str(request.form("votes"))
  If check_null(tvotes) Then Call client_alert(itake("module.vote_error6", "lng"), -1)
  sqlstr = "select * from " & ndatabase & " where " & nidfield & "=" & tid
  Set rs = conn.Execute(sqlstr)
  If not rs.EOF Then
    If rs(cfname("lock")) = 1 Then Call client_alert(itake("module.vote_error2", "lng"), -1)
    If DateDiff("d", rs(cfname("starttime")), Now()) < 0 Then Call client_alert(itake("module.vote_error3", "lng"), -1)
    If DateDiff("d", rs(cfname("endtime")), Now()) > 0 Then Call client_alert(itake("module.vote_error4", "lng"), -1)
    If rs(cfname("type")) = 0 Then
      tvotes = get_num(tvotes, 0)
      If tvotes = 0 Then Call client_alert(itake("module.vote_error0", "lng"), -1)
    Else
      tvotes = format_checkbox(tvotes)
      If Not cidary(tvotes) Then Call client_alert(itake("module.vote_error0", "lng"), -1)
    End If
  Else
    Call client_alert(itake("module.vote_error1", "lng"), -1)
  End If
  Set rs = Nothing
  Dim tdatabase, tidfield, tfpre
  tdatabase = cndatabase(ngenre & "." & nsort, "voter")
  tidfield = cnidfield(ngenre & "." & nsort, "voter")
  tfpre = cnfpre(ngenre & "." & nsort, "voter")
  sqlstr = "select * from " & tdatabase & " where " & cfnames(tfpre, "fid") & "=" & tid & " and " & cfnames(tfpre, "ip") & "='" & nuserip & "'"
  Set rs = server.CreateObject("adodb.recordset")
  rs.open sqlstr, conn, 1, 3
  If Not rs.EOF Then
    Call client_alert(itake("module.vote_error5", "lng"), -1)
  Else
    rs.addnew
    rs(cfnames(tfpre, "fid")) = tid
    rs(cfnames(tfpre, "ip")) = nuserip
    rs(cfnames(tfpre, "username")) = nusername
    rs(cfnames(tfpre, "data")) = tvotes
    rs(cfnames(tfpre, "time")) = Now()
    rs.update
  End If
  Set rs = Nothing
  tdatabase = cndatabase(ngenre & "." & nsort, "data")
  tidfield = cnidfield(ngenre & "." & nsort, "data")
  tfpre = cnfpre(ngenre & "." & nsort, "data")
  sqlstr = "update " & tdatabase & " set " & cfnames(tfpre, "count") & "=" & cfnames(tfpre, "count") & "+1 where " & cfnames(tfpre, "fid") & "=" & tid & " and " & tidfield & " in (" & tvotes & ")"
  If run_sqlstr(sqlstr) Then
    response.cookies("vote")(CStr(tid)) = "1"
    Call client_alert(itake("module.vote_succeed", "lng"), -1)
  Else
    Call client_alert(itake("module.vote_error0", "lng"), -1)
  End If
End Sub

Sub jtb_cms_module_action()
  Select Case request.querystring("action")
    Case "vote"
      Call jtb_cms_module_votedisp
  End Select
End Sub

Call jtb_cms_module_action
'****************************************************
' Jetiben CMS Power by Jetiben.com
' Email: jetiben@hotmail.com
' Web: http://www.jetiben.com/
'****************************************************
%>

⌨️ 快捷键说明

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