📄 clsdalushop.asp
字号:
<%
'=======================================================================
' CLASS NAME: 大路购物系统常用函数类
' DESIGN BY : 吕鑫
' DATE: 2005-01-14
' WEBSITE: http://www.dtdoor.com/
' EMAIL: golddonkey@sina.com
'=======================================================================
dim XML,lanID,config,Page,PageTrueUrl,pageNum,totalNum,PageEnd
dim User,Info,OrderNum,TopInfo,AdsChg,AdsNumChg,AdsID,Style1,Style2,UserLevelNum,UserLevelName
dim UserTitleNum,UserFace,UserLoginDate,Order
dim conn,ArrayNum
Class dalu
public rs,query
sub webconfig()
query="select WebName,WebUrl,WebLogo,WebBanner,WebAddress,WebCode,WebTel,WebCZ,WebQQ,WebQQflag,WebFu,WebFuflag,WebGua,WebGuaflag,WebContent,TuijianNum,XinpinNum,TejiaNum,PageNum,WebBannerUrl,WebFuUrl,Email,JifenChange,WebQQType,TitleColor,mailFrom,mailname,mailusername,mailuserpass,bbsText,WebGuaUrl,WebGua1,WebGua1Url,AliPayflag,BUSSflag,metakey,meta,lan from Webconfig"
config = DBClass(query)
end sub
sub DBOpen()
Set conn = Server.CreateObject("ADODB.Connection")
conn.open constr
end sub
function DBClass(query)
call DBOpen()
set rs = conn.execute(query)
if not rs.eof then
DBClass = rs.getrows
ArrayNum = ubound(DBClass,2)
else
ArrayNum = -1
end if
call DBClose()
call connClose()
end function
sub DBExecute(query)
call DBOpen()
conn.execute(query)
call connClose()
end sub
sub DBClose()
rs.close
set rs = nothing
end sub
sub connClose()
conn.close
set conn = nothing
end sub
function connectXml(Path,nodepath)
dim objDom,sel,selectednode,nodelength,node
set objDom=server.CreateObject("MSXML2.DOMDocument")
objDom.async=false
objDom.load(server.mappath(path))
if not objDom.load(server.mappath(path)) then
response.Write("找不到相关的XML文件")
response.End()
end if
objDom.setProperty "SelectionLanguage", "XPath"
sel=nodepath
set selectednode = objDom.selectSingleNode(sel)
nodelength = selectednode.childNodes.length
for node = 1 to nodelength
if connectXml = "" then
connectXml = selectednode.selectSingleNode("title"&node).text
else
connectXml = connectXml&"|"&selectednode.selectSingleNode("title"&node).text
end if
next
connectXml = split(connectXml,"|")
end function
sub language()
'0为中文,1为英文
dim language,lan
lan = request.QueryString("lan")
if request.Cookies("dalu")("language") = "" then
response.Cookies("dalu")("language") = config(37,0)
XML = "language/chinese.xml"
lanID = 1
elseif request.Cookies("dalu")("language") = 0 then
XML = "language/chinese.xml"
lanID = 1
elseif request.Cookies("dalu")("language") = 1 then
XML = "language/english.xml"
lanID = 0
end if
if lan <> "" then
response.Cookies("dalu")("language") = lan
response.Redirect("index.asp")
end if
end sub
function checkPic(pic,width,width1)
if right(pic,3) = "jpg" or right(pic,3) = "gif" then
checkPic ="<img src='"&pic&"' border='0' "&checkAds(width,width1)&">"
end if
if right(pic,3) = "swf" then
checkPic ="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' "&checkAds(width,width1)&"><param name='movie' value='"&pic&"'><param name='quality' value='high'><param name='wmode' value='transparent'><embed src='"&pic&"' width='"&width&"' height='"&width1&"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' wmode='transparent'></embed></object>"
end if
end function
function checkAds(Width,Width1)
if Width <> 0 then
checkAds = "width = '"&Width&"'"
end if
if Width1 <> 0 then
checkAds = checkAds&" Height = '"&Width1&"'"
end if
end function
function sqlchg(key)
if instr(key,"'") or instr(key,"script") or instr(key,"chr") or instr(key,";") or instr(key,"<") or instr(key,">") or instr(key,"#") or instr(key,"(") or instr(key,")") then
response.Write("<script language='javascript'>window.location.href='error.asp?errorMsg=请不要输入非法字符';</script>")
response.End()
end if
sqlchg=key
end function
function sqlcheck(key)
if not isnumeric(key) then
response.Write("<script language='javascript'>window.location.href='error.asp?errorMsg=传递非数字型参数出错';</script>")
response.End()
end if
sqlcheck=key
end function
function pageNow()
dim PageUrl,PageQuery,LeftPageUrl,RightPageUrl
'读取该执行文件
PageUrl=Request.ServerVariables("URL")
PageUrl=split(PageUrl,"/")
LeftPageUrl=PageUrl(Ubound(PageUrl))
'读取字符串
PageQuery=Request.ServerVariables("QUERY_STRING")
if instr(PageQuery,"&") then
'多字符
if instr(PageQuery,"&page=") then
'非头一次读
PageQuery=split(PageQuery,"&page=")
RightPageUrl="?"&PageQuery(0)&"&"
else
'头次读
RightPageUrl="?"&PageQuery&"&"
end if
else
'单字符或者无字符
if PageQuery<>"" then
'单字符
if instr(PageQuery,"page=") then
RightPageUrl="?"
else
RightPageUrl="?"&PageQuery&"&"
end if
else
'无字符
RightPageUrl="?"
end if
end if
'页面地址OK
pageNow = LeftPageUrl&RightPageUrl
end function
sub pageTable(pageNum,totalNum,DataName)
dim MaxPage
dim pageTitle
pageTitle = connectXml(XML,"/language/page")
PageTrueUrl = pageNow()
if DataName = 10 then
DataName = pageTitle(10)
elseif DataName = 11 then
DataName = pageTitle(11)
end if
'判断页面最大值
if totalNum mod PageNum = 0 then
MaxPage=int(totalNum/PageNum)
else
MaxPage=int(totalNum/PageNum)+1
end if
%>
<div class="page" id="page">
<%=pageTitle(0)%> <%=totalNum%><%=DataName%> <%=pageTitle(1)%> <%=MaxPage%> <%=pageTitle(2)%> <%=Page%> <%=pageTitle(3)%>
<a href="<%=PageTrueUrl%>page=1"><%=pageTitle(4)%></a>
<%
if Cint(Page) <> 1 then
%>
<a href="<%=PageTrueUrl%>page=<%=Page-1%>"><%=pageTitle(5)%></a>
<%
else
%>
<%=pageTitle(5)%>
<%
end if
%>
<%
if Cint(MaxPage)>Cint(Page) then
%>
<a href="<%=PageTrueUrl%>page=<%=Page+1%>"><%=pageTitle(6)%></a>
<%
else
%>
<%=pageTitle(6)%>
<%
end if
%>
<a href="<%=PageTrueUrl%>page=<%=MaxPage%>"><%=pageTitle(7)%></a>
<%=pageTitle(8)%>
<select onchange="window.open(options[selectedIndex].value,'_self')">
<%
for PageNum = 1 to MaxPage
%>
<option value="<%=PageTrueUrl%>page=<%=PageNum%>" <%if Cint(PageNum) = Cint(Page) then%>selected<%end if%>><%=PageNum%></option>
<%
next
%>
</select><%=pageTitle(9)%>
</div>
<%
end sub
sub setPage(Num,Num1)
PageNum = Num
totalNum = Num1
Page=sqlCheck(Request.QueryString("Page"))
if Page <= 0 or Page = "" then
Page = 1
end if
if Cint(Page*PageNum-1)<Cint(totalNum-1) then
PageEnd = Page*PageNum-1
else
PageEnd = totalNum-1
end if
end sub
sub UserInfo()
dim u_query
OrderNum = 0
UserLevelNum = 100
UserLevelName = "普通会员"
User = Session("Username")
'客户段数据初始化
if Request.Cookies("ProductNum") = "" then
Response.Cookies("ProductNum") = 0
end if
if Request.Cookies("ProductPrice") = "" then
Response.Cookies("ProductPrice") = 0
end if
dim u_info
u_info = connectXml(XML,"/language/uinfo")
if User <> "" then
Style1 = "none"
Style2 = "inline"
'读用户数据
u_query = "Select l.LevelName,u.UserJifen,l.levelNum,u.UserTitleNum,u.UserFace,u.UserLoginDate from [User] u inner join [Level] l on u.UserFlag = l.LevelOrder where u.Username = '"&User&"'"
Info = shop.DBClass(u_query)
UserLevelNum = Info(2,0)
UserLevelName = Info(0,0)
UserTitleNum = Info(3,0)
UserFace = Info(4,0)
UserLoginDate = Info(5,0)
TopInfo = u_info(0)&User&Info(0,0)&","&u_info(1)&Info(1,0)&","&u_info(2)&UserLevelNum&"% <a href='userlogout.asp' style='text-decoration:underline'>["&u_info(3)&"]</a>"
else
TopInfo = u_info(4)&config(0,0)&","&u_info(5)&" <A href='user_reg.asp' style='text-decoration:underline' target='_blank'>["&u_info(6)&"]</a>"
end if
end sub
sub adv()
'读广告
AdsChg = shop.DBClass("Select AdsLink,AdsPic,AdsPartID,AdsWidth,AdsHeight from Advertisement")
AdsNumChg = ArrayNum
end sub
end Class
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -