 |
| LINK |
|
Chip
Mikrodata
e-BStore
Merchandising
<% Set conn = Server.CreateObject("ADODB.Connection")
conn.open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("database\dbelex.mdb"),"",""
set rstemp=Server.CreateObject("ADODB.Recordset")
rstemp.open "Select Distinct Tanggal_terbit from TBuku Order by Tanggal_terbit DESC",conn
'rstemp.activeconnection = nothing
response.write "Data terbaru tanggal : "
response.write rstemp.Fields("Tanggal_terbit")
rstemp.close
set rstemp = nothing
'conn.close
'set conn = nothing
%>
Hit Page
<%
Dim ObjCounterFile, ReadCounterFile, WriteCounterFile
Dim CounterFile
Dim CounterHits
Set ObjCounterFile = Server.CreateObject("Scripting.FileSystemObject")
CounterFile = Server.MapPath ("counter.txt")
Set ReadCounterFile= ObjCounterFile.OpenTextFile (CounterFile, 1, True)
If Not ReadCounterFile.AtEndOfStream Then
CounterHits = Trim(ReadCounterFile.ReadLine)
If CounterHits = "" Then CounterHits = 0
Else
CounterHits = 0
End If
ReadCounterFile.Close
Set ReadCounterFile = Nothing
CounterHits = CounterHits + 1
Set WriteCounterFile= ObjCounterFile.CreateTextFile (CounterFile, True)
WriteCounterFile.WriteLine(CounterHits)
WriteCounterFile.Close
Set WriteCounterFile = Nothing
Set ObjCounterFile = Nothing
%> <% =CounterHits %>
|
|
 |
 |
<% Set conn = Server.CreateObject("ADODB.Connection")
conn.open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("database\dbelex.mdb"),"",""
sqltemp="select * from TBuku"
mypage=request("whichpage")
If mypage="" then mypage=1
mypagesize=request("pagesize")
If mypagesize="" then mypagesize=3
myjudul=request.form("T1")
judl=request("judl")
IF myjudul<>"" THEN
mySQL=SQLtemp & " WHERE Judul LIKE '%" & myjudul & "%' ORDER BY Tanggal_Terbit DESC, Produk_ID ASC"
ELSEIF judl<>"" THEN
mySQL=SQLtemp & " WHERE Judul LIKE '%" & judl & "%' ORDER BY Tanggal_Terbit DESC, Produk_ID ASC"
ELSE
mySQL=SQLtemp & " ORDER BY Tanggal_Terbit DESC, Produk_ID ASC"
END IF
set rstemp=Server.CreateObject("ADODB.Recordset")
set rs3=Server.CreateObject("ADODB.Recordset")
rstemp.cursorlocation=3
rstemp.cachesize=5
rstemp.open mySQL,conn
set rstemp.activeconnection=nothing
if rstemp.recordcount > 0 then 'jika hasil cari buku ada
rstemp.movefirst
rstemp.pagesize=mypagesize
maxpages=cint(rstemp.pagecount)
maxrecs=cint(rstemp.pagesize)
rstemp.absolutepage=mypage
howmanyrecs=0
howmanyfields=rstemp.fields.count -1
call PageNavBar
DO UNTIL rstemp.eof OR howmanyrecs>=maxrecs
rs3.Open "select * from TKategori where Kode='" & rstemp.Fields("Kode_Kategori") & "'",conn
response.write ""
call bacafilegambar
response.write ""
response.write rstemp.Fields("Judul")
response.write " "
response.write ""
response.write " Pengarang : "
response.write rstemp.Fields("Pengarang")
response.write " Kategori : "
response.write rs3.Fields("Nama")
response.write " Produk ID : "
response.write rstemp.Fields("Produk_ID")
response.write " Harga : Rp "
call cetakharga(rstemp.Fields("Harga"))
response.write " "
response.write ""
call bacafiletext
response.write " | "
rstemp.movenext
howmanyrecs=howmanyrecs+1
if howmanyrecs < maxrecs then
response.write " | "
end if
rs3.close
LOOP
set rs3=nothing
response.write " "
rstemp.close
set rstemp=nothing
conn.close
set conn=nothing
sub bacafilegambar
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists(mypath(cstr(server.mappath("coverplus"))) +"/" + rstemp.Fields("Produk_ID") + ".jpg")) then
response.write " "
else
response.write " "
end if
end sub
sub bacafiletext
Dim fso, f, lastbrs, currentbrs
Set fso = CreateObject("Scripting.FileSystemObject")
If (fso.FileExists(mypath(cstr(server.mappath("coverplus"))) +"/" + rstemp.Fields("Produk_ID") + ".txt")) Then
Set f = fso.OpenTextFile(mypath(cstr(server.mappath("coverplus"))) + "/" + rstemp.Fields("Produk_ID") + ".txt", 1, True)
lastbrs = ""
while not f.AtEndOfStream
currentbrs = trim(f.ReadLine)
if currentbrs = "" and lastbrs = "" then
response.write " "
else
response.write currentbrs
end if
lastbrs = currentbrs
wend
f.Close
response.write " "
else
response.write "
"
end if
end sub
sub cetakharga(byVal nharga)
myprice = CStr(nharga)
hargaformat = ",-"
for iCount = len(myprice) to 1 step -1
if (len(myprice) - iCount + 1) mod 3 = 0 then
hargaformat = "." + mid(myprice,iCount,1) + hargaformat
else
hargaformat = mid(myprice,iCount,1) + hargaformat
end if
next
response.write hargaformat
end sub
function mypath(byVal filespec)
dim hasil
hasil = ""
for i = 1 to len(filespec)
if mid(filespec,i,1)="\" then
hasil = hasil + "/"
else
hasil = hasil + mid(filespec,i,1)
end if
next
mypath = hasil
end function
sub PageNavBar()
pad=""
scriptname=request.servervariables("script_name")
response.write ""
response.write "| "
response.write ""
counterstart = mypage
counterend = counterstart + 1
if counterstart <> 1 then
ref=" "
response.write ""
Response.Write ref
response.write ""
ref=" "
response.write ""
Response.Write ref
response.write ""
end if
if counterend < maxpages + 1 then
ref=" "
response.write ""
Response.Write ref
response.write ""
ref=" "
response.write ""
Response.Write ref
response.write ""
end if
response.write ""
response.write " | "
response.write " "
end sub
else 'jika tidak ada buku yang dicari
response.write " Maaf, kategori buku yang anda cari tidak ditemukan !!
"
response.write "Klik di sini jika anda mempunyai pertanyaan, saran, ataupun keluhan tentang produk Elex.
"
rstemp.close
set rstemp=nothing
conn.close
set conn=nothing
end if
%> |
 |
|
|