Thư viện tri thức trực tuyến
Kho tài liệu với 50,000+ tài liệu học thuật
© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

CT_NGUON.pdf
Nội dung xem thử
Mô tả chi tiết
Global.asa
************************************************************************
*
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
SUB Application_OnStart
' Dac ta nay duoc mo ra khi co khach hang dau tien vao WEB site
' Dong thoi mo file va dem so luong khac h hang truy cap WEB site
CustomersCount = Server.MapPath ("/ASPComputer") + "\Customers.txt"
Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
Set Out= FileObject.OpenTextFile (CustomersCountFN, 1, FALSE, FALSE)
' Chan bi viec theo doi khach hang vao web site.
Application("Customers") = Out.ReadLine
' Luu ten file vat ly cua file chua tong so khach hang truy cap.
Application("CustomersCountFN") = CustomersCountFN
END SUB
</SCRIPT>
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
SUB Application_OnEnd
' Thuc thi khi Server bi shuts down hoac co su thay doi cua file global.
' Cap nhat lai so khach hang hien dang trong web site vao file
Customers.txt.</pre>
Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
Set Out= FileObject.CreateTextFile (Application("CustomersCountFN"), TRUE,
FALSE)
Out.WriteLine(application("Customers"))
END SUB
</SCRIPT>
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
SUB Session_OnStart
const MaxShoppingCartItems = 10
const ShoppingCartAttributes = 7
' OnStart Event lam 4 viec sau:
' 1) Tang so luong khach hang vao web site.
' 2) Kiem tra so khach hang hien co trong web site va khach moi vao.
' 3) Tao lien ket den CSDL de truy xuat va noi luu tru so ID cua khach trong
Session object
' 4) Khi co su thay doi dot ngot qua trinh di chuyen trong web site cua khach hang
thi tra ve trang chinh.
' ----------------------------------
' Tang so ID cua Customers khi co truy cap web site.
Application.lock
Application("Customers")= application("Customers") + 1
I_Customers = application("Customers")
Application.unlock
Session("CustomersID") = I_Customers
' Luu so ID cua khach hang vao file Customers.txt theo thoi gian nhat dinh.
If I_Customers MOD 10 = 0 Then
SET FileObject = Server.CreateObject("Scripting.FileSystemObject")
Set Out= FileObject.CreateTextFile (Application("CustomersCountFN"), TRUE,
FALSE)
Application.lock
Out.WriteLine(I_Customers)
Application.unlock
End If
' Kiem tra so khach hang moi truy cap va so khach hang da co trong web site.
' Doi voi khach hang da co trong web site truy cap lai thi se goi lai
"Masokhachhang"
' no chinh la so ID dau tien cua Khach hang duoc luu trong CSDL o bang "Khach
hang"
Masokhachhang = Request.Cookies("Masokhachhang")
If Masokhachhang = "" Then ' Khach hang moi -- Cap so ID de theo doi qua trinh di
chuyen va mua thiet bi.
Masokhachhang = 0
Else ' Neu da ton tai -- Lay ho ten nguoi do trong Cookies hien thi tren Trang chinh web
site.
Session("Hovaten") = Request.Cookies("Hovaten").Item
End If
Session("Masokhachhang") = Masokhachhang ' Dat "Masokhachhang vao session de su
dung cho viec mua hang.
' Thiet lap ADO Connection string -- Tao lien ket den CSDL dung de
' thuc thi " mo,ghi,doc,dong " tren moi trang
Session("ConnectionString") = "dsn=DATABASE;uid=DATABASE"
' Tao Shopping cart
ReDim ARYShoppingCart(ShoppingCartAttributes,MaxShoppingCartItems)
Session("MyShoppingCart") = ARYShoppingCart
Session("ItemCount") = 0
' Kiem tra su truy cap cua khach hang co dung trinh tu lien kethay khong
Trangdautien = "/MainASP.asp"
Tranghienhanh = Request.ServerVariables("SCRIPT_NAME")
' So sanh trang truy cap cua khach hang neu khong hop le thi tra su truy cap
' ve trang dau tien cua web site
If strcomp(Tranghienhanh,Trangdautien,1) Then
Response.Redirect("/ASPComputer" & Trangdautien)
End If
END SUB
</SCRIPT>
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
SUB Session_OnEnd
END SUB
</SCRIPT>
************************************************************************
*
File Mainasp.asp
************************************************************************
*
<html>
<head>
<title>Asp Computer Menu</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<meta name="Microsoft Border" content="none">
<base target="rtop">
</head>
<body background="../Quangcao/Image16.jpg">
<p><img src="../Quangcao/Bieutuong.gif" width="163" height="62"
alt="Bieutuong.gif (890 bytes)"></p>
<table border="0" width="100%" cellspacing="0" cellpadding="0" height="190">
<tr>
<td width="100%" height="30"><a href="Gioithieu.html" target="rbottom"><img
src="../Quangcao/gthcuahang.gif" width="161" height="24" alt="gthcuahang.gif (302
bytes)"></a></td>
</tr>
<tr>
<td width="100%" height="26"><a href="Thongtin/Huongdan.asp"
target="_top"><img
src="../Quangcao/Hdmuahang.gif" alt="Hdmuahang.gif (316 bytes)" width="161"
height="24"></a></td>
</tr>
<tr>
<td width="100%" height="30"><a href="Category.asp" target="rbottom"><img
src="../Quangcao/Muahang.gif" alt="Muahang.gif (222 bytes)" width="161"
height="24"></a></td>
</tr>
<tr>
<td width="100%" height="26"><img src="../Quangcao/Thongtinmoi.gif"
alt="Thongtinmoi.gif (256 bytes)" width="161" height="24"></td>
</tr>
<tr>
<td width="100%" height="26"><img src="../Quangcao/Cachangmaytinh.gif"
alt="Cachangmaytinh.gif (288 bytes)" width="161" height="24"></td>
</tr>
<tr>
<td width="100%" height="26"><a href="../Dangky/Loginuser.asp"
target="_top"><img
src="../Quangcao/Dkkhachhang.gif" alt="Dkkhachhang.gif (320 bytes)" width="161"
height="24"></a></td>
</tr>
<tr>
<td width="100%" height="26"><a href="../Quanly/Report.asp" target="_top"><img
src="../Quangcao/Qlkhachhang.gif" alt="Qlkhachhang.gif (315 bytes)" width="161"
height="24"></a></td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</body>
</html>
************************************************************************
*
<html>
<head>
<title>Asp Computer Main</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<meta name="Microsoft Border" content="none">
</head>
<body background="../Quangcao/Image16.jpg" link="#FFFF00" vlink="#C0C0C0">
<form method="POST" action="../SearchPro.asp">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="54%"><div align="center"><center><p><font face="VNI-Times"
color="#000040"><strong><small>Tìm
kieám thieát bò :</small></strong></font></td>
<td width="50%" align="center"><div align="left"><p><input type="text"
name="txtTimkiem"
size="10" maxlength="15"></td>
<td width="26%" align="center"><div align="right"><p><input type="submit"
value="Tim Kiem"
name="Action"></td>
</tr>
</table>
</form>
<div align="center"><center>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td width="50%"><p align="center"><img src="../Quangcao/H2_smb~2.gif"
width="174"
height="75" alt="H2_smb~2.gif (5941 bytes)"></td>
<td width="50%"><p align="center"><img src="../Quangcao/H_pros~1.gif"
width="119"
height="162" alt="H_pros~1.gif (8528 bytes)"></td>
</tr>
</table>
</center></div><%
Randomize
Sotieude= Int(Rnd*5)
Set FileObject = Server.CreateObject("Scripting.FileSystemobject")
Set Instream = Fileobject.OpenTextFile (Server.Mappath
("/ASPComputer") & "\tieude.txt", 1 , false, false)
for i=1 to Sotieude -1
Instream.Skipline()
next
AdverOfDay= Instream.Readline%>
<div align="center"><center>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" align="center"><font face="VNI-TIMES" SIZE="8"
color="red"><%=AdverOfDay%></font> </td>
</tr>
</table>
</center></div><div align="center"><center>
<table border="0" width="100%">
<tr>
<td width="100%"><% If IsEmpty(Session("Hovaten")) Then %>
<p><font face="VNI-Times" color="#000080">Chaøo Baïn</font> <% Else%><font
face="VNI-Times"><font color="#000080">Vui Möøng Gaëp lai
</font><%=Session("Hovaten")%></font> <%End if%> <font
face="VNI-Times" color="#000080">Baïn Laø Khaùch Haøng
Thöù:</font><%=FormatNumber(Session("CustomersID"),0)%></td>
</tr>
</table>
</center></div>
</body>
</html>
************************************************************************
*
File Category.asp
************************************************************************
*
<html>
<head>
<title>Category</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
</head>
<body link="#00FFFF" vlink="#0000FF" alink="#FF0000"
background="../Quangcao/Image16.jpg">
<table border="0" width="101%" bgcolor="#77FFFF" cellspacing="0" cellpadding="0"
height="349">
<tr>
<td width="50%" align="center" colspan="2" height="39" bgcolor="#800000"><font
face="VNI-Bodon" color="#FFFFFF"><strong><big>Caùc loaïi thieát
bò</big></strong></font></td>
</tr>
<tr>
<td width="10"><%
If Session("ItemCount") > 0 then %>
<p><a href="Productbuy.asp"><img src="../Quangcao/Productbuy.gif"
width="70" heigth="30" alt="Product buy" border="0"></a> <% End if %> </td>
</tr>
<tr>
<td width="50%" height="26"><p align="center"><a
href="ProductGet.asp?ID_LOAI=CAS"
target="_top"><img src="../LoaiThietbi/Case.gif" width="98" height="24"
alt="Case.gif "></a></td>
<td width="50%" height="26"><p align="center"><a
href="ProductGet.asp?ID_LOAI=NOT"
target="_top"><img src="../LoaiThietbi/Notebook.gif" width="100" height="22"
alt="Notebook.gif "></a></td>
</tr>
<tr>
<td width="50%" height="26"><p align="center"><a
href="ProductGet.asp?ID_LOAI=CDR"
target="_top"><img src="../LoaiThietbi/Cdrom.gif" width="98" height="24"
alt="Cdrom.gif "></a></td>
<td width="50%" height="26"><p align="center"><a
href="ProductGet.asp?ID_LOAI=PRI"
target="_top"><img src="../LoaiThietbi/Printer.gif" width="96" height="23"
alt="Printer.gif "></a></td>
</tr>
<tr>
<td width="50%" height="25"><p align="center"><a
href="ProductGet.asp?ID_LOAI=CPU"
target="_top"><img src="../LoaiThietbi/Cpu.gif" width="100" height="22"
alt="Cpu.gif "></a></td>
<td width="50%" height="25"><p align="center"><a
href="ProductGet.asp?ID_LOAI=SCA"
target="_top"><img src="../LoaiThietbi/Scanner.gif" width="96" height="23"
alt="Scanner.gif "></a></td>
</tr>
<tr>
<td width="50%" height="26"><p align="center"><a
href="ProductGet.asp?ID_LOAI=UPS"
target="_top"><img src="../LoaiThietbi/Ups.gif" width="96" height="23"
alt="Ups.gif"></a></td>
<td width="50%" height="26"><p align="center"><a
href="ProductGet.asp?ID_LOAI=SOU"
target="_top"><img src="../LoaiThietbi/Soundcard.gif" width="98" height="24"
alt="Soundcard.gif "></a></td>
</tr>
<tr>
<td width="50%" height="26"><p align="center"><a
href="ProductGet.asp?ID_LOAI=RAM"
target="_top"><img src="../LoaiThietbi/Ram.gif" width="100" height="22"
alt="Ram.gif "></a></td>
<td width="50%" height="26"><p align="center"><a
href="ProductGet.asp?ID_LOAI=FAX"
target="_top"><img src="../LoaiThietbi/Faxmodem.gif" width="98" height="24"
alt="Faxmodem.gif "></a></td>
</tr>
<tr>
<td width="50%" height="26"><p align="center"><a
href="ProductGet.asp?ID_LOAI=GLA"
target="_top"><img src="../LoaiThietbi/Glass.gif" width="98" height="24"
alt="Glass.gif "></a></td>
<td width="50%" height="26"><p align="center"><a
href="ProductGet.asp?ID_LOAI=VGA"
target="_top"><img src="../LoaiThietbi/Vgacard.gif" width="98" height="24"
alt="Vgacard.gif "></a></td>
</tr>
<tr>
<td width="50%" height="24"><p align="center"><a
href="ProductGet.asp?ID_LOAI=SER"
target="_top"><img src="../LoaiThietbi/Server.gif" width="100" height="22"
alt="Server.gif "></a></td>
<td width="50%" height="24"><p align="center"><a
href="ProductGet?ID_LOAI=MNB"
target="_top"><img src="../LoaiThietbi/Mainboard.gif" width="100" height="22"
alt="Mainboard.gif "></a></td>
</tr>
<tr>
<td width="50%" height="25"><p align="center"><a
href="ProductGet.asp?ID_LOAI=HUB"
target="_top"><img src="../LoaiThietbi/Hub.gif" width="100" height="22"
alt="Hub.gif "></a></td>
<td width="50%" height="25"><p align="center"><a
href="ProductGet.asp?ID_LOAI=DES"
target="_top"><img src="../LoaiThietbi/Desktop.gif" width="113" height="23"
alt="Desktop.gif "></a></td>
</tr>
<tr>
<td width="50%" height="26"><p align="center"><a
href="ProductGet.asp?ID_LOAI=KEY"
target="_top"><img src="../LoaiThietbi/Keyboard.gif" width="98" height="24"
alt="Keyboard.gif"></a></td>
<td width="50%" height="26"><p align="center"><a
href="ProductGet.asp?ID_LOAI=HDD"