%
Server.Execute "/NoHACK1.asp"
dim Time1, sql, rs, Errh, LoopFlag, outTmp, picTmp, outTmp1, urlTmp, urlTmp1
dim rs1, GoodUrl, GoodType
dim ToPage, NowPage, Ipage, Hp, i
dim Mo_Type1, Mo_Type2
dim TypeName1(), TypeName2(), TypeCode1(), TypeCode2()
Mo_Type1 = ReqNum(Request("Type1"))
Mo_Type2 = ReqNum(Request("Type2"))
' 找出大分類
sql = "select AutoID, T_Name from ML_Class where T_Show='Y' and AutoID in(select distinct TID from ML_Class2 where T_Show='Y' and AutoID in (select distinct G_Type from ML_Goods)) order by AutoID"
Set rs = GetRecordset( sql )
if not(rs.BOF and rs.EOF) then
Redim TypeName1(rs.recordcount), TypeCode1(rs.recordcount)
' 置入陣列
For i = 1 to UBound(TypeName1)
TypeName1(i) = Trim(rs("T_Name")) : TypeCode1(i) = CStr(rs("AutoID"))
rs.movenext
Next
end if
rs.close
if Mo_Type1 = "" then Mo_Type1 = "0"
' 找出小分類
sql = "select AutoID, T_Name from ML_Class2 where T_Show='Y' and TID = " & Mo_Type1 & " and AutoID in (select distinct G_Type from ML_Goods) order by AutoID"
Set rs = GetRecordset( sql )
if not(rs.BOF and rs.EOF) then
Redim TypeName2(rs.recordcount), TypeCode2(rs.recordcount)
' 置入陣列
For i = 1 to UBound(TypeName2)
TypeName2(i) = Trim(rs("T_Name")) : TypeCode2(i) = CStr(rs("AutoID"))
rs.movenext
Next
end if
rs.close
if Mo_Type2 = "" then Mo_Type2 = "0"
if Mo_Type1 <> "0" then
if Mo_Type2 = "0" then
sql = "select * from ML_Goods where G_Show='Y' and G_Type in ("
For i = 1 to UBound(TypeName2)
sql = sql & TypeCode2(i) & ","
Next
sql = Left(sql,len(sql)-1) & ") order by G_Kind, G_Type, AddTime desc"
else
sql = "select * from ML_Goods where G_Show='Y' and G_Type=" & Mo_Type2 & " order by G_Kind, AddTime desc"
end if
else
sql = "select * from ML_Goods where G_Show='Y' order by G_Kind, G_Type, AddTime desc"
end if
set rs1 = GetRecordset(sql)
if rs1.BOF and rs1.EOF then
response.Redirect "/main.asp"
response.End
end if
Hp = "allitem.asp"
rs1.PageSize = 35
'----分頁處理
ToPage = request.QueryString("ToPage")
if ToPage = "" then
NowPage = 1
else
NowPage = CInt(ToPage)
end if
if NowPage > rs1.PageCount then
NowPage = rs1.PageCount
elseif NowPage < 1 then
NowPage = 1
end if
if not (rs1.bof and rs1.eof) then rs1.AbsolutePage = NowPage
%>
完美商城乾坤袋
<%
dim RecCount, BannerID(5), BannerPic(5), BannerUrl(5), Idx
sql = "Select AutoID,PicName,Url from TOP_Banner Where ShowMall='Y' And BannerType='A' And " & _
"DateDiff(d, StartDay, GetDate())>=0 And DateDiff(d, EndDay, GetDate())<=0 Order By AddTime desc, AutoID desc"
Set rs = GetRecordset( sql )
if rs.BOF and rs.EOF then
RecCount = 0
else
RecCount = rs.RecordCount
end if
' 若資料小於五筆 直接全列出
if RecCount < 6 then
For LoopFlag = 1 to 5
if rs.EOF then
BannerID(LoopFlag) = ""
BannerPic(LoopFlag) = ""
BannerUrl(LoopFlag) = ""
else
BannerID(LoopFlag) = CStr(rs(0).value)
BannerPic(LoopFlag) = rs(1).value
BannerUrl(LoopFlag) = Trim(rs(2).value)
rs.movenext
end if
Next
else ' 隨機取資料
Randomize ' 取亂數將隨機五筆存入Array
For LoopFlag = 1 to 5
rs.AbsolutePosition = Int((RecCount * Rnd) + 1)
BannerID(LoopFlag) = CStr(rs(0).value)
BannerPic(LoopFlag) = rs(1).value
BannerUrl(LoopFlag) = Trim(rs(2).value)
' 過濾重覆的
For Idx = 1 to LoopFlag - 1
if BannerID(LoopFlag) = BannerID(Idx) then
LoopFlag = LoopFlag - 1
exit For
end if
Next
Next
end if
rs.close
set rs = nothing
%>
<%if Mo_Type1<>"0" then%>
<%end if%>
<%if not (rs1.BOF and rs1.EOF) then
i = 0
Do Until i >= rs1.PageSize
%>
<%
dim p, O, R, Q, S
IF ToPage = empty or ToPage = "" Then
P = 1
else
P = Cint(ToPage)
End If
O = P + 5
R = O + 1
Q = P - 5
S = Q - 1
If O > rs1.PageCount Then O = rs1.PageCount
If R > rs1.PageCount Then R = rs1.PageCount
If Q < 1 Then Q = 1
If S < 1 Then S = 1
%>