Top Banner
ONLINE SHOPPING Submitted By: Roll no: 3-15-07-0452 Roll no: 3-15-07-0459 Roll no: 3-15-07-0498 Project supervisor: Prof. Siladitya Mukherjee Department of Computer Science St. Xavier’s College (Autonomous) 30, Mother Teresa Sarani Kolkata-700016
69
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Online Shopping

ONLINE SHOPPING

Submitted By:

Roll no: 3-15-07-0452Roll no: 3-15-07-0459Roll no: 3-15-07-0498

Project supervisor:

Prof. Siladitya Mukherjee

Department of Computer ScienceSt. Xavier’s College (Autonomous)

30, Mother Teresa SaraniKolkata-700016

Page 2: Online Shopping

CERTIFICATE

This is to certify that the project entitled “ONLINE SHOPPING” submitted to the M.Sc. Computer Science Department of St.Xavier’s College (Autonomous) affiliated to Calcutta University has been successfully completed by Anwesha Chakraborty(Roll no. 4-15-07-0452), Avipsa Roy(Roll no. 4-15-07-0459), Khushboo Gulgulia (Roll no. 4-15-07-0498) in the last couple of months.

Project Supervisor Head of the Dept. Of Computer Science

Page 3: Online Shopping

ACKNOWLEDGEMENT

We acknowledge the constant cooperation and guidance that we have been provided with, by our project supervisor, Prof. Siladitya Mukherjee throughout the period of development of the project and express our sincere thanks and gratitude for the same. We are also thankful to Prof. Anal Acharya (H.O.D. Dept of Computer Science) and Prof. Kaushik Goswami (M.Sc. Computer Science) for allowing us to use the Computer System in The Computer Science laboratory whenever required. Finally, we express our gratitude to all the faculty and staff members of Computer Science department for their immense help and cooperation without which this project would not have been successful.

1. Anwesha Chakraborty ………………………………….

2. Avipsa Roy ………………………………….

3.Khushboo Gulgulia ………………………………….

Page 4: Online Shopping

Introduction

Online shopping is the process consumers go through to purchase products, goods or services over the Internet. An online shop, eshop, e-store, internet shop, webshop, webstore, online store, or virtual store evokes the physical analogy of buying products or services at a bricks-and-mortar retailer or in a shopping mall.

The metaphor of an online catalog is also used, by analogy with mail order catalogs. All types of stores have retail web sites, including those that do and do not also have physical storefronts and paper catalogs. Online shopping is a type of electronic commerce used for business-to-business (B2B) and business-to-consumer (B2C) transactions.

Customers:

Shopping has evolved from single stores to large malls containing many stores that most often offer attentive service, store credit, delivery, and acceptance of returns. These new additions to shopping have encouraged and targeted middle class women.

In recent years, online shopping has become popular; however, it still caters to the middle and upper class. In order to shop online, one must be able to have access to a computer, a bank account and a debit card. Shopping has evolved with the growth of technology.

Payment:

Online shoppers commonly use credit card to make payments, however some systems enable users to create accounts and pay by alternative means, such as:

Debit card Various types of electronic money Cash on delivery (C.O.D., offered by very few online stores) Cheque Wire transfer/delivery on payment Postal money order Reverse SMS billing to mobile phones Gift cards Direct debit in some countries

Page 5: Online Shopping

Product delivery:

Once a payment has been accepted the goods or services can be delivered in the following ways.

Download : This is the method often used for digital media products such as software, music, movies, or images.

Shipping : The product is shipped to the customer's address. Drop shipping : The order is passed to the manufacturer or third-party distributor, who

ships the item directly to the consumer, bypassing the retailer's physical location to save time, money, and space.

Page 6: Online Shopping

Feasibility Study

A feasibility study is a preliminary study where the information needs of prospective users and the resource requirements, cost, benefits and findings of a proposed project are determined. Then we formalize the findings of this study in a written report that includes preliminary specification for a proposed application. If the management approves the recommendations of the feasibility study, the software development process can continue.The goal of feasibility studies is to evaluate alternative system solutions and to propose the most feasible and desirable application for development. The feasibility of a proposed system can be evaluated in terms of the following categories:

1. Organizational feasibility: How well the proposed system supports the business priorities of the organization. How well the proposed system fits the employee/administration’s requirements.

2. Technical feasibility: Hardware, software, network capability, reliability and availability. Capability and availability of system hardware, software. Volumes of data the software can handle, trends, frequency of data updating.

3 Economic feasibility: Cost saving Increase in revenue Decrease in investment requirements Increase in profit

Page 7: Online Shopping

Software Development Life Cycle (SDLC)

Life Cycle (The Systems Development SDLC) is a conceptual model used in project management that describes the stages involved in an information system development project from an initial feasibility study through maintenance of the completed application. Various SDLC methodologies have been developed to guide the processes involved including the waterfall model, rapid application development, joint application development, the fountain model and the spiral model. Mostly, several models are combined into some sort of hybrid methodology. Some methods work better for specific types of projects, but in the final analysis, the most important factor for the success of a project may be how closely particular plan was followed.

For our project on “Online Shopping” we have used the WATERFALL MODEL. It is the most common and classic of all life cycle models. In this model, each phase has to be completed entirely before the next phase canbegin. At the end of each phase, a review takes place to determine whether the project is on the right path. In this model, the phases do not overlap with each other. The waterfall model has four different stages a follows:

Requirement Analysis Design Software maintenance Implementation

Requirement Analysis- gathers the requirements for the system. This stage includes a detailed study of the business needs of the organization.

Design- focuses on high level design like, what program are needed they going to interact, low level design (what are the interfaces going to look like) and data design (what data will be required).

During these phases, the software’s overall structure is defined. Analysis and Design are very crucial in the whole development cycle. The logical system of the product is developed in this phase.For our project, we reviewed some custom-made sample projects on ‘Shopping System’ to get an idea about the whole system and the decided upon the various functional and non-functional requirements and made the various tables required and established relationships between the through ‘Data Flow Diagrams’ and ‘Entity Relationship Diagrams’

Page 8: Online Shopping

Software Requirement Specification

The software requirement specification is produced at the culmination of the analysis task. The function and performance allocated to software as part of system engineering are refined by establishing a complete information description, a representation of system behavior, an indication of performance requirement and design constraints, appropriate validation criteria, and other information pertinent to requirements. Software requirements specification can be categorized onto two main varieties:

1. Functional requirements:

Functional requirements capture the intended behavior of the system. This behavior may be expressed as services, tasks or functions the system is required to perform.The following are type various functional requirements for the proposed system-

PRODUCT TABLE…. The system will maintain a product table where the product details, quantity, availability, price, etc will be stored. Now when a customer comes and buys some products, the product table will be automatically updated accordingly.

CUSTOMER TABLE……The customer table will contain the details of the customers who have registered themselves under the shop. Whenever a new customer gets himself registered his details will be reflected back to the customer table.

PURCHASE TABLE….The purchase table will contain the details of the products that have generated by a bill for a given customer. It will contain details of bill_id, proid, procost, proqty, prodisc whenever a bill is generated. Whenever a customer buys a product the details of the bill generated will be reflected back to this table.

CATEGORY TABLE ….The category table will contain the names and ids of different categories of products that are available.

SUBCATEGORY TABLE…….This table will contain the different types of subcategories that are available under the different categories of products available.

FEEDBACK TABLE…..

Page 9: Online Shopping

The feedback table will consist of the feedbacks given by the different registered customers and the time and date at which they post the feedback.

BILLS TABLE….The bills table will consist of the bill_id, the custid, the bill_time and the bill_date for each bill that has been generated.

ADMIN TABLE…This table will contain the administrator’ id and his password for him to login and the details of the database.

2. Nonfunctional requirements:

Non-functional requirements define the overall qualities or attributes of the resulting system. It places restrictions on the product being developed, the development process, and specify external constraints that the product must meet.

ACCESSIBILITY: This stand-alone system uses several different tables in the master database to store the data in an organized manner. If the tables would have been located in some other place, the system will consume more time to access the tables to fetch the appropriate data and will thus be affected. Hence it is stored within the system itself for easy access to it.

SECURITY:In order to maintain the security of this system such that no customer is able to make any changes within the database, the database is highly protected by a username and password of the administrator which can only be done by him and thus apart from the administrator no one else will be allowed to make changes. Thus the system is highly protected

CLIENT-SERVER ARCHITECTURE:

Page 10: Online Shopping

Client-server computing or networking is a distributed application architecture that partitions tasks or work loads between service providers (servers) and service requesters, called clients. Often clients and servers operate over a computer network on separate hardware. A server machine is a high-performance host that is running one or more server programs which share its resources with clients. A client does not share any of its resources, but requests a server's content or service function. Clients therefore initiate communication sessions with servers which await (listen to) incoming request The client-server characteristic describes the relationship of cooperating programs in an application. The server component provides a function or service to one or many clients, which initiate requests for such services. Each instance of the client software can send data requests to one or more connected servers. In turn, the servers can accept these requests, process them, and return the requested information to the client. Although this concept can be applied for a variety of reasons to many different kinds of applications, the architecture remains fundamentally the same.

Page 11: Online Shopping

Design

ENTITY-RELATIONSHIP DIAGRAM

Page 12: Online Shopping

CONTEXT DIAGRAM

Page 13: Online Shopping

DATA-FLOW DIAGRAM

Implementation

Page 14: Online Shopping

(Coding)

1.Coding for additem page.

<%@ language="vbscript"%><html><body bgcolor=brown><%Response.CacheControl = "no-cache"Response.AddHeader "Pragma", "no-cache"Response.Expires = -1

'http://localhost/eshop/additem.asp?id=P09&qty=1&action=trueif request.querystring ("action")="true" thenSession (request.querystring ("id")) =request.querystring ("qty")elseSession.contents.remove (request.querystring ("id"))end if%></body></html>

2. Coding for administrator’s page

<%@ language="vbscript"%><html><body leftmargin=0 topmargin=0><link rel="stylesheet" href="global.css" type="text/css"><script language="javascript" src="header.js"></script><script language="javascript">setHeader(false,false,false,false,false,false)function displayReport(){var com=document.frmadmin.comtable;window.open("showreport.asp?repo="+ com.options[com.selectedIndex].text,"frmreport")}function logOut(){window.open("admin.asp","_top")}</script><table border=0 width="100%" cellspacing=0 cellpadding=0><tr><td width="30%"><td align=center><font size=4><u><b>A D M I N I S T R A T I O N</b></u></font><%

Page 15: Online Shopping

Response.CacheControl = "no-cache"Response.AddHeader "Pragma", "no-cache"Response.Expires = -1

if request.form("txtid")="" or request.form("txtpass")="" then %><td width="30%"></table><table width="100%" border=5 cellspacing=0 cellpadding=5><tr><td rowspan=3 width="33%" bgcolor=black></td>

<td align=right bgcolor=lightgoldenrodyellow><form name="frmsignin" method="post" action="">Login ID : <input type=text name="txtid"><br>Password : <input type=password name="txtpass"></td><td rowspan=3 width="33%" bgcolor=black></td></tr><tr><td align=right bgcolor=palegoldenrod><input type=submit value="DONE"><input type=reset value="CLEAR"></td></tr></form></table><% else Dim con, rs, strsqlConst adOpenDynamic = 2Const adLockOptimistic = 1Set con = Server.CreateObject("ADODB.Connection")con.Open "DSN=eshopdsn"Set rs = Server.CreateObject("ADODB.Recordset")

strsql = "select * from admintab where admin_id=" & "'"& request.form("txtid") &"'"rs.Open strsql, con, adOpenDynamic,adLockOptimisticif not rs.BOF thenif rs("admin_pass")= request.form("txtpass") then%><td valign=top align=right width="30%"><a href="#" onClick='logOut();'>Logout</a></table><table width="50%" align=center border=0 cellspacing=0 cellpadding=0><tr><td valign=center align=center><form name="frmadmin" method="post" action=""><select name="comtable"><option>Feedback

Page 16: Online Shopping

<option>Product<option>Sales</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=button value="Show Details" onClick='displayReport();'></form></table><hr><iframe name="frmreport" height="100%" width="100%" frameborder=0 src="showreport.asp"></iframe><%elseResponse.write("<td width=""30%""></table><font color=red><h3>Invalid Password...Try Again...</h3></font>")end ifelseResponse.write("<td width=""30%""></table><font color=red><h3>No Such Administrator Found...Try Again...</h3></font>")end ifcon.closeset con=nothing end if %><br><script language="javascript" src="footer.js"></script></body></html>

3. Coding for billing page

<%@ language="vbscript"%><html><head><title>Purchase receipt</title></head><body><p><a href="index.asp">Home</a></p><%Response.CacheControl = "no-cache"Response.AddHeader "Pragma", "no-cache"Response.Expires = -1

if CInt(Session.contents.count)>2 thendim bid, arrid, i,ctr, txtid, amt, totamt, pid(), pcost(), pqty(), pdisc()bid=cstr(session("sess_id"))if instr(1,Date,"/") >0 then

Page 17: Online Shopping

arrid=split(Date,"/")elsearrid=split(Date,"-")end ifbid=bid & arrid(0)& arrid(1)arrid=split(Time,":")bid=bid & arrid(0)txtid=split(arrid(2)," ")bid=bid & txtid(0)%><table border=1 width="100%" cellspacing=0 cellpadding=0><tr><td align=center colspan=7>My Shoppe.in<tr><td colspan=3>Customer Name : <b><u><%=ucase(Session("sess_name"))%></u></b><td align=right colspan=4>Bill ID : <u><%=bid%></u><br>Date : <u><%=Date%></u><br>Time : <u><%=Time%></u><tr align=center><td>Sl. No.<td>Item Code<td>Item Name<td>Quantity<td>Price<td>Disc.<td>Amount<%Dim con, rs, strsql' Set the ADO ConstantsConst adOpenDynamic = 2Const adLockOptimistic = 1Set con = Server.CreateObject("ADODB.Connection")con.Open "DSN=eshopdsn"Set rs = Server.CreateObject("ADODB.Recordset")totamt=0ctr=-1arrid=split(request.form("chk"),",")for i=0 to ubound(arrid)txtid=trim(arrid(i))strsql = "select * from product where proid='"& txtid &"'"rs.Open strsql, con, adOpenDynamic,adLockOptimisticif not rs.BOF thenif rs("proqty")>= CInt(Session.contents(txtid)) thenctr=ctr+1redim preserve pid(ctr)redim preserve pcost(ctr)redim preserve pqty(ctr)redim preserve pdisc(ctr)pid(ctr)=txtidpcost(ctr)=rs("procost")pqty(ctr)=session.contents(txtid)pdisc(ctr)=rs("prodisc")amt = cdbl((rs("procost")-(rs("procost")*rs("prodisc")/100))* Session.contents(txtid))totamt=totamt+amt

Page 18: Online Shopping

response.write("<tr align=center><td>"& i+1)response.write("<td>"& txtid) response.write("<td>"& rs("proname")&"<td>"& Session.contents(txtid)&"<td>"& rs("procost")&"<td>"& rs("prodisc")&"%<td>"& amt )elseresponse.write("<tr align=center><td>"& i+1)response.write("<td>"& txtid &"<td>"& rs("proname")&"<td colspan=4 align=center bgcolor=grey>Out of Stock!!" )end ifend ifrs.closenextresponse.write("<tr><td colspan=6 align=right><b>Total Amount : &nbsp;</b><td align=center><b>"& totamt &"</b>")response.write("</table>")if ctr>=2 thenstrsql = "INSERT into bills(bill_id,custid,bill_date,bill_time) values('"& bid &"','"& session("sess_id")&"','"& Date &"','"& Time &"')"rs.Open strsql, con, adOpenDynamic,adLockOptimisticfor i=0 to ubound(pid)strsql = "INSERT into purchase(bill_id,proid,procost,proqty,prodisc) values('"& bid &"','"& pid(i)&"',"& CInt(pcost(i)) &","& CInt(pqty(i)) &","& CInt(pdisc(i))&")"rs.Open strsql, con, adOpenDynamic,adLockOptimisticstrsql = "UPDATE product set proqty=proqty-"& pqty(i)&" where proid='"& pid(i)&"'"rs.Open strsql, con, adOpenDynamic,adLockOptimistic'rs.closenextfor each i in Session.contentsif not i="sess_id" and not i="sess_name" thensession.contents.remove(i)end ifnextend ifcon.closeset con=nothingelse%><center><h2>Transaction is over!!<h2></center><%end if%></body></html>

4. Coding for checking the username availability

Page 19: Online Shopping

<%@ language="vbscript"%><html><body><link rel="stylesheet" href="global.css" type="text/css"><%Response.CacheControl = "no-cache"Response.AddHeader "Pragma", "no-cache"Response.Expires = -1

'custid, custpass, custfname, custlname, custage, custaddr, custphone, custemail, custgenderif not request.querystring("uid")="" thenDim con, rs, strsql, cid' Set the ADO ConstantsConst adOpenDynamic = 2Const adLockOptimistic = 1Set con = Server.CreateObject("ADODB.Connection")con.Open "DSN=eshopdsn"Set rs = Server.CreateObject("ADODB.Recordset")strsql = "select * from customer where custid=" & "'"& request.querystring("uid") &"'"

rs.Open strsql, con, adOpenDynamic,adLockOptimisticif rs.BOF theresponse.write("<img src=""./images/avail.jpg""><br><font color=green>Available!!</font>")elseresponse.write("<img src=""./images/notavail.jpg""><br><font color=red>Not Available!!</font>")end ifcon.CloseSet con = Nothingend if%></body></html>

5. Coding for contact us page

<%@ language="vbscript"%><html><head><title>Contact Us</title></head><body onLoad='initial();' leftmargin=0 topmargin=0><link rel="stylesheet" href="global.css" type="text/css"><style>.txt {font-weight:bold; font-size:medium; color:blue; background-color:lightgreen; border:0}

Page 20: Online Shopping

</style><script language="javascript" src="header.js"></script><script language="javascript">function initial(){var txtref=document.getElementById("txtcontact");if(txtref != null) { txtref.focus(); }}</script><%if Session("sess_id")="" thenresponse.write("<script>setHeader(true,true,true,true,false,false)</script>")elseresponse.write("<script>setHeader(true,true,false,false,true,false);</script>")end if%><!--#include file ="setusername.asp"--><%if Session("sess_id")="" thenresponse.write("<h1>Please <a href=""signin.asp"">Sign In</a>/<a href=""signup.asp"">Sign Up</a> to post comments/feedback!!</h1>")elseif request.form("txtcontact")="" thenresponse.write("<table width=100% border=0 cellspacing=0 cellpadding=0>")response.write("<form name=""frmcontact"" method=""POST"" action=""""")response.write("<tr><td width=""50%""><br><h4>Your valuable comment/feedback :</h4>")response.write("<textarea name=txtcontact class=txt cols=30 rows=10></textarea>")response.write("<td valign=bottom align=center><img border=0 width=""60%"" src=""./images/contact.jpg"">")response.write("<tr><td align=right><input type=submit value=""Post Comment"">")response.write("</td></tr></form></table>")elseDim con, rs, strsqlConst adOpenDynamic = 2Set con = Server.CreateObject("ADODB.Connection")con.Open "DSN=eshopdsn"Set rs = Server.CreateObject("ADODB.Recordset")strsql="select * from feedback"rs.open strsql, con, adOpenDynamic, 3rs.movelastrs.AddNew

rs("custid")=session("sess_id")

Page 21: Online Shopping

rs("comment")=request.form("txtcontact")rs("comm_date")=Daters("comm_time")=Timers.Updatecon.closeset con=nothingresponse.write("<h1>Comment/feedback successfuly posted!!</h1>")end ifend if%><br><script language="javascript" src="footer.js"></script></body></html>

6. Coding for footer.js

document. write ("<table border=0 width=\"100%\" bgcolor=gray>");document. write ("<tr><td align=center>");document. write ("(c) All rights reserved<br>Best viewed in 1024x768 resolution");document. write("</td></tr></table>");

7. Coding for global.asa

Sub Application_OnStart Application ("billID") = DateEnd SubApplication.LockIntNumVisits = Application. Contents ("TotalNumPage2")intNumVisits = intNumVisits + 1Application. Contents ("TotalNumPage2") = intNumVisits‘Explicitly unlock the Application object.Application. Unlock

8. Coding for global.css

body {background-color:#FFFFCC}

9. Coding for header.js

function setHeader(home,product,signin,signup,signout,contact)

Page 22: Online Shopping

{document.write("<table border=0 cellspacing=0 cellpadding=0 width=\"100%\" background=\"./images/mainbgimg.jpg\">");

document.write("<tr><td align=left valign=top>");if(home==true){document.write("<a href=\"index.asp\"><font color=\"red\">Home</a> | ");}if(product==true){document.write("<a href=\"welcome.asp\"><font color=\"red\">Product</a> | ");}if(signin==true){document.write("<a href=\"signin.asp\"><font color=\"red\">Sign In</a> | ");}if(signup==true){document.write("<a href=\"signup.asp\"><font color=\"red\">Sign Up</a> | ");}if(signout==true){document.write("<a href=\"signout.asp\"><font color=\"red\">Sign Out</a> | ");}

if(contact==true){document.write("<a href=\"contactus.asp\"><font color=\"red\">Contact Us</a> | ");}document.write("<td align=right><img src=\"./images/mainlogo.jpg\">");

document.write("<tr><td colspan=2 bgcolor=red height=12>")document.write("<tr><td colspan=2 bgcolor=#FFFFCC height=10>")document.write("<tr><td colspan=2 bgcolor=red height=12>")

document.write("</td></tr></table>");}

10. Coding for index page

<%@ language="vbscript"%><html><head><title>e Shop</title></head><body leftmargin=0 topmargin=0><link rel="stylesheet" href="global.css" type="text/css"><script language="javascript" src="header.js"></script><%if Session("sess_id")="" thenresponse.write("<script>setHeader(false,true,true,true,false,true)</script>")elseresponse.write("<script>setHeader(false,true,false,false,true,true);</script>")end if

Page 23: Online Shopping

%><!--#include file ="setusername.asp"--><table width="100%" align=center border=0 bgcolor="#FFFFCC"><tr><td><font color="maroon" size="4"><h1>About Us</h1><b>My Shoppe.in</b> is not just another hypermarket. It caters toevery need of your family. Where <b>My Shoppe.in</b> scores over other stores is its value for money proposition for the Indian customers.<br><br>At <b>My Shoppe.in</b>, you will definitely get the best products at the best prices - that’s what we guarantee. With the ever increasing array of private labels, it has opened the doors into the world of fashion and general merchandise including home furnishings, utensils, crockery, cutlery, sports goods and much more at prices that will surprise you. And this is just the beginning. <b>My Shoppe.in</b> plans to add much more to complete your shopping expereince.</font><td><img src="./images/family_pic.jpg"> </table><br><script language="javascript" src="footer.js"></script></body></html>

11. Coding for new user page

<%@ language="vbscript"%><html><head><title>Creating/Updating User...</title></head><body bgcolor=black><link rel="stylesheet" href="global.css" type="text/css"><script language="javascript" src="header.js"></script><script>setHeader(true,true,false,false,true,true)</script><!--#include file ="setusername.asp"--><%'custid, custpass, custfname, custlname, custage, custaddr, custphone, custemail, custgenderDim con, rs, strsql Dim cid, cpass, cfname, clname, cage, caddr, cphone, cemail, cgender

' Set the ADO ConstantsConst adOpenDynamic = 2Const adLockOptimistic = 2

Set con = Server.CreateObject("ADODB.Connection")con.Open "DSN=eshopdsn"Set rs = Server.CreateObject("ADODB.Recordset")

Page 24: Online Shopping

cid=request.form("txtuid") cpass=request.form("txtpass")cfname= request.form("txtfname")clname= request.form("txtlname")cage= CInt(request.form("txtage"))caddr= request.form("txtaddr")cphone= request.form("txtphone")cemail= request.form("txtemail")cgender= request.form("optsex")

if not request.querystring("action")=1 thenstrsql = "INSERT into customer (custid, custpass, custfname, custlname, custage, custaddr, custphone, custemail, custgender) values ('"& cid &"','"& cpass &"','"& cfname &"','"& clname &"',"& cage &",'"& caddr &"','"& cphone &"','"& cemail &"','"& cgender &"')"rs.Open strsql, con, adOpenDynamic,adLockOptimisticcon.CloseSet con = NothingResponse.Redirect "signin.asp"elsestrsql = "select * from customer where custid='"& session("sess_id") &"'"rs.Open strsql, con, adOpenDynamic,adLockOptimisticrs("custpass")=cpassrs("custfname")=cfnamers("custlname")=clnamers("custage")=cagers("custaddr")=caddrrs("custphone")=cphoners("custemail")=cemailrs("custgender")=cgenderrs.updateresponse.write("<h2><font color=green>Profile Updated!!</font></h2>")end if

con.CloseSet con = Nothing%><br><script language="javascript" src="footer.js"></script></body></html>

12. Coding for password reminder

<%@ language="vbscript"%>

Page 25: Online Shopping

<html><head><title>Existing User</title></head><body leftmargin=0 topmargin=0><link rel="stylesheet" href="global.css" type="text/css"><script language="javascript" src="header.js"></script><%if Session("sess_id")="" thenresponse.write("<script>setHeader(true,true,true,true,false,true)</script>")

elseresponse.write("<script>setHeader(true,true,false,false,true,true);</script>")end if%><!--#include file ="setusername.asp"--><%Dim con, rs, strsqlConst adOpenDynamic = 2Const adLockOptimistic = 1Set con = Server.CreateObject("ADODB.Connection")con.Open "DSN=eshopdsn"Set rs = Server.CreateObject("ADODB.Recordset")strsql = "select * from customer where custid=" & "'"& request.querystring("id") &"'"rs.Open strsql, con, adOpenDynamic,adLockOptimisticif not rs.BOF thenset mymail=Server.CreateObject("CDO.Message")mymail.Subject="Password Reminder"mymail.From="[email protected]"mymail.To=rs("custemail")mymail.TextBody="Your Password : "& rs("custpass")mymail.Sendset mymail=nothingResponse.write("<font color=green><h3>Password sent to your e-Mail ID...</h3></font>")elseResponse.write("<font color=red><h3>No Such User Found...Try Again...</h3></font>")end ifcon.closeset con=nothing%><br><script language="javascript" src="footer.js"></script></body></html>

13. Coding for product details

Page 26: Online Shopping

<%@ language="vbscript"%><html><body bgcolor=brown topmargin="10%"><script language="javascript">var itemlist=""function setNum(comid, n){var com=document.getElementById(comid);if(com.options.length >= n){ com.options[n-1].selected=true; }else{com.options[com.options.length].selected=true; }}function checkItem(chkbox){var com=document.getElementById(chkbox.value);window.open("additem.asp?id="+ chkbox.value +"&qty="+ com.options[com.selectedIndex].text +"&action="+ chkbox.checked,"frmadd")}function checkItem1(comid){var com=document.getElementById("chk_"+ comid);if(com.checked==true){ checkItem(com);}}

function purchaseDone(){window.open("viewcart.asp","_top")}</script><%Response.CacheControl = "no-cache"Response.AddHeader "Pragma", "no-cache"Response.Expires = -1if not Session("sess_id")="" thenresponse.write("<p align=right><input type=button name=""btndone"" value=""View Cart"" onClick='purchaseDone();'></p>")end if'proid, subcatname, proname, proqty, procost, prodisc, imgaddr'on error resume nextif not request.querystring("subcat")="" thenDim con, rs, strsql, ctr, amt' Set the ADO Constants

Page 27: Online Shopping

Const adOpenDynamic = 2Const adLockOptimistic = 1Set con = Server.CreateObject("ADODB.Connection")con.Open "DSN=eshopdsn"Set rs = Server.CreateObject("ADODB.Recordset")strsql = "select * from product where subcatname = " & "'"& request.querystring("subcat") &"'"rs.Open strsql, con, adOpenDynamic,adLockOptimisticif rs.BOF thenresponse.write("<h1>No product available in this category!</h1>")elsectr=0response.write("<table border=1 cellspacing=0 cellpadding=5 align=center>")response.write("<form name=""frmproduct"">")while not rs.EOFif ctr mod 4 = 0 then response.write("<tr align=center>")if ctr mod 2 = 0 then response.write("<td bgcolor=antiquewhite ")elseresponse.write("<td bgcolor=lightgoldenrodyellow ")end ifresponse.write("valign=top><img height=100 width=100 src=""./images/" & rs("imgaddr") &""">")response.write("<br>"& rs("proname"))response.write("<br><font color=red>")if rs("prodisc")>0 thenresponse.write("Rs. <strike>"& rs("procost") &"</strike>")elseresponse.write("Rs. "& rs("procost"))end ifresponse.write("</font><br>Discount: "& rs("prodisc") &"%")amt = rs("procost")-(rs("procost")*rs("prodisc")/100)response.write("<br><font color=green>Rs. "& amt &"</font>")if rs("proqty")>0 thenresponse.write("<br>Quantity: <select name="""& rs("proid") &""" onChange='checkItem1("""& rs("proid") &""");'>")for i=1 to rs("proqty") step 1response.write("<option>"& i)nextresponse.write("</select>")elseresponse.write("<br><font color=brown>Out of stock!!</font>")end ifif not Session("sess_id")="" and rs("proqty")>0 then

Page 28: Online Shopping

response.write("<br><label>Add to cart <input type=checkbox name=""chk_"& rs("proid") &""" onClick='checkItem(this);' value="""& rs("proid")&"""")if not session(rs("proid"))="" thenresponse.write(" checked></label>")response.write("<script> setNum("""& rs("proid") &""","& session(rs("proid")) &"); </script>")elseresponse.write("></label>")end ifend ifctr = ctr+1rs.MoveNextwendresponse.write("</form></table>")end ifcon.CloseSet con = Nothingend if%><iframe name="frmadd" height=10 width=10 src="additem.asp" frameborder=0 scrolling=no></iframe></body></html>

20. Coding for product links

<%@ language="vbscript"%><html><body bgcolor=teal topmargin="5%"leftmargin=0 onLoad='initial();'><script language="javascript">function initial(){document.frmcat.comsel.focus()}function checkCategory(){window.open("subproduct_link.asp?pname="+ document.frmcat.comsel.options[document.frmcat.comsel.selectedIndex].text,"subfrm");}</script><%'on error resume nextResponse.CacheControl = "no-cache"Response.AddHeader "Pragma", "no-cache"Response.Expires = -1

Page 29: Online Shopping

Dim con, rs, strsql' Set the ADO ConstantsConst adOpenDynamic = 2Const adLockOptimistic = 1Set con = Server.CreateObject("ADODB.Connection")con.Open "DSN=eshopdsn"Set rs = Server.CreateObject("ADODB.Recordset")strsql = "select catname from category"rs.Open strsql, con, adOpenDynamic,adLockOptimisticif not rs.BOF thenresponse.write("<table width=100% border=0 align=center cellspacing=0 cellpadding=0>")response.write("<form name=frmcat><tr><td width=""33%"" align=right valign=top>")response.write("<select name=comsel onChange='checkCategory();'>")response.write("<option>Select Category") while not rs.EOFresponse.write("<option>" & rs("catname"))rs.MoveNextwendresponse.write("</select></form>")

response.write("<td valign=top><iframe name=""subfrm"" src=""subproduct_link.asp"" width=50% height=30 scrolling=no frameborder=0></iframe>")response.write("<td valign=top align=right>")response.write("</table>")response.write("<iframe name=""frmdetail"" height=""100%"" width=""100%"" frameborder=0 src=""product_detail.asp""></iframe>")elseresponse.write("<h1>Sorry! No Products Available!!</h1>")end ifcon.CloseSet con = Nothing%></body></html>

21. Coding for setting username

<% if Session("sess_id")="" then %><font color=grey><b>Welcome </font><font color=maroon><u>Guest!!</u></font></b><% else %><font color=grey><b>Welcome </font><font color=maroon><%=ucase(Session("sess_name"))%>!!</font><font color=black> | </b>

Page 30: Online Shopping

<b>[ <a href="signup.asp?id=<%=session("sess_id")%>">Profile Setting</a> ]</b><%end if%>

22. Coding for showing reports

<%@ language="vbscript"%><html><body leftmargin=0 topmargin=0><link rel="stylesheet" href="global.css" type="text/css"><%Response.CacheControl = "no-cache"Response.AddHeader "Pragma", "no-cache"Response.Expires = -1

'proid, subcatname, proname, proqty, procost, prodisc, imgaddr'on error resume nextDim ctr, con, rs, rs1, strsql, amt, qtxt' Set the ADO ConstantsConst adOpenDynamic = 2Const adLockOptimistic = 1Set con = Server.CreateObject("ADODB.Connection")con.Open "DSN=eshopdsn"Set rs = Server.CreateObject("ADODB.Recordset")Set rs1 = Server.CreateObject("ADODB.Recordset")qtxt=request.querystring("repo")if qtxt="Feedback" thenstrsql = "select * from feedback"rs.Open strsql, con, adOpenDynamic,adLockOptimisticif rs.BOF thenresponse.write("<center><h1>No Record(s) available!!</h1></center>")elsectr=0response.write("<center><h3><u>Comments posted by registered users</u></h3></center>")response.write("<table border=1 width=100% cellspacing=0 cellpadding=0 align=center>")Response.Write("<tr bgcolor=green><th>Sl. No.<th>USER ID<th>DESCRIPTION<th>DATE<th>TIME</tr>")while not rs.EOFif ctr mod 2 = 0 then response.write("<tr bgcolor=antiquewhite>")elseresponse.write("<tr bgcolor=lightgoldenrodyellow>")end ifresponse.write("<td>"& ctr+1 &"<td>"& rs("custid")&"<td>"& rs("comment")&"<td>"& rs("comm_date")&"<td>"& rs("comm_time"))rs.movenext

Page 31: Online Shopping

ctr=ctr+1wendresponse.write("</table>")end ifelseif qtxt="Product" thenstrsql = "select * from product"rs.Open strsql, con, adOpenDynamic,adLockOptimisticif rs.BOF thenresponse.write("<center><h1>No Record(s) available!!</h1></center>")elsectr=0response.write("<center><h3><u>Details of product</u></h3></center>")'proid, subcatname, proname, proqty, procost, prodisc, imgaddrresponse.write("<table border=1 width=100% cellspacing=0 cellpadding=0 align=center>")Response.Write("<tr bgcolor=green><th>Sl. No.<th>SUB_CAT_ID<th>PRODUCT ID<th>NAME<th>QUANTITY<th>COST<th>DISCOUNT<th>IMAGE</tr>")while not rs.EOFif ctr mod 2 = 0 then response.write("<tr bgcolor=antiquewhite align=center>")elseresponse.write("<tr bgcolor=lightgoldenrodyellow align=center>")end ifresponse.write("<td>"& ctr+1 &"<td>"& rs("subcatname")&"<td>"& rs("proid")&"<td>"& rs("proname"))if rs("proqty")<10 thenresponse.write("<td><font color=red>"& rs("proqty")&"</font>")elseresponse.write("<td>"& rs("proqty"))end ifresponse.write("<td>"& rs("procost")&"<td>"& rs("prodisc")&"%<td><img src=""./images/"& rs("imgaddr")&"""></tr>")rs.movenextctr=ctr+1wendresponse.write("</table>")end ifelseif qtxt="Sales" thendim totamt'bill_id,custid,bill_date,bill_time [BILLS]'bill_id,proid,procost,proqty,prodisc [PURCHASE]strsql = "select * from bills"rs1.Open strsql, con, adOpenDynamic,adLockOptimisticif rs1.BOF thenresponse.write("<center><h1>No Record(s) available!!</h1></center>")else

Page 32: Online Shopping

response.write("<center><h3><u>Details of sales</u></h3></center>")response.write("<table border=1 width=100% cellspacing=0 cellpadding=0 align=center>")Response.Write("<tr bgcolor=green><th>Sl. No.<th>BILL ID<th>DATE<th>TIME<th>CUST. ID<th width=""10%"">PRODUCT ID<th width=""10%"">QUANTITY<th width=""10%"">COST<th width=""10%"">DISCOUNT<th width=""10%"">TOTAL</tr>")ctr=0while not rs1.eoftotamt=0response.write("<tr bgcolor=gray align=center><td>"& ctr+1 &"<td>"& rs1("bill_id")&"<td>"& rs1("bill_date")&"<td>"& rs1("bill_time")&"<td>"& rs1("custid")&"<td colspan=5>")strsql = "select * from purchase where bill_id='"& rs1("bill_id") &"'"rs.Open strsql, con, adOpenDynamic,adLockOptimisticresponse.write("<table border=1 width=100% cellspacing=0 cellpadding=0 align=center>")while not rs.EOFamt = cdbl((rs("procost")-(rs("procost")*rs("prodisc")/100))* rs("proqty"))totamt=totamt+amt response.write("<tr bgcolor=lightgoldenrodyellow align=center><td width=""10%"">"& rs("proid")&"<td width=""10%"">"& rs("proqty")&"<td width=""10%"">"& rs("procost")&"<td width=""10%"">"& rs("prodisc")&"<td width=""10%"">"& amt &"</tr>")rs.movenextwendresponse.write("</table></td></tr>")response.write("<tr bgcolor=rosybrown><td colspan=9 align=right>TOTAL&nbsp;&nbsp; <td align=center><font color=blue>"& totamt &"</font></td></tr>")rs.closers1.movenextctr=ctr+1wendresponse.write("</table>")end ifend ifcon.CloseSet con = Nothing%></body></html>

23. Coding for signing in

Page 33: Online Shopping

<%@ language="vbscript"%><html><head><title>Existing User</title></head><body leftmargin=0 topmargin=0 onLoad='initial();'><link rel="stylesheet" href="global.css" type="text/css"><script language="javascript">function initial(){document.frmsignin.txtuid.focus()}function validateInput(){if (document.frmsignin.txtuid.value==""){alert("Enter User ID!"); return false;}else if (document.frmsignin.txtpass.value==""){alert("Enter Password!"); return false;}else return true;}function getID(){if (document.frmsignin.txtuid.value==""){alert("Enter User ID!"); document.frmsignin.txtuid.focus(); return false;}else{window.open("passremind.asp?id="+document.frmsignin.txtuid.value,"_top")}return true;}</script><script language="javascript" src="header.js"></script><%if Session("sess_id")="" thenresponse.write("<script>setHeader(true,true,false,true,false,true)</script>")elseresponse.write("<script>setHeader(true,true,false,false,true,true);</script>")end if%><!--#include file ="setusername.asp"--><br><table width="100%" border=5 cellspacing=0 cellpadding=5><tr><td rowspan=3 width="33%" bgcolor=black></td><td align=right bgcolor=lightgoldenrodyellow><form name="frmsignin" method="post" action="validateuser.asp">User ID : <input type=text name="txtuid"><br>Password : <input type=password name="txtpass"></td><td rowspan=3 width="33%" bgcolor=black></td></tr>

Page 34: Online Shopping

<tr><td align=left bgcolor=palegoldenrod><a href="#" onClick='return getID();'>Forgot Password</a><tr><td align=right bgcolor=palegoldenrod><input type=submit value="DONE" onClick='return validateInput();'><input type=reset value="CLEAR"></td></tr></form></table><br><script language="javascript" src="footer.js"></script></body></html>

24. Coding for sign out

<%@ language="vbscript"%><%'Session.AbandonSession.Contents.RemoveAll()Response.Redirect "index.asp"%>

25. Coding for signing up

<%@ language="vbscript"%><html><head><title>New User</title></head><!--<link rel=stylesheet type="text/css" href=style.css>--><% if request.querystring()="" then %><body leftmargin=0 topmargin=0 onLoad='initial();'><% else %><body leftmargin=0 topmargin=0><% end if %><link rel="stylesheet" href="global.css" type="text/css"><script language="javascript">function initial(){document.frmsignup.txtuid.focus()}function validateInput(){if (document.frmsignup.txtuid.value=="") {alert("Enter User ID!"); return false;}

Page 35: Online Shopping

else if (document.frmsignup.txtpass.value=="") {alert("Enter Password!"); return false;}else if (document.frmsignup.txtpass1.value=="" || (document.frmsignup.txtpass.value != document.frmsignup.txtpass1.value)) {alert("Non-matching password!","Attention..."); return false;}else if (document.frmsignup.txtfname.value=="") {alert("Enter first name!"); return false;}else if (document.frmsignup.txtemail.value=="" ||document.frmsignup.txtemail.value.lastIndexOf("@")<1 ||document.frmsignup.txtemail.value.lastIndexOf(".") < document.frmsignup.txtemail.value.lastIndexOf("@")+2 ||document.frmsignup.txtemail.value.lastIndexOf(".") == document.frmsignup.txtemail.value.length-1) {alert("Enter valid e-mail ID!"); return false;}else if (document.frmsignup.txtaddr.value=="") {alert("Enter address!"); return false;}else if(isNaN(document.frmsignup.txtage.value)) {alert("Enter valid age!"); return false;}else return true;}function checkAvail(){if (document.frmsignup.txtuid.value !="")window.open("checkavail.asp?uid=" + document.frmsignup.txtuid.value,"frmavail");else alert("Enter desired ID!!")}</script><script language="javascript" src="header.js"></script><%if Session("sess_id")="" thenresponse.write("<script>setHeader(true,true,true,false,false,true)</script>")elseresponse.write("<script>setHeader(true,true,false,false,true,true);</script>")end if%><!--#include file ="setusername.asp"--><br><%if request.querystring("id")="" then%><table width="75%" align=center border=0 cellspacing=0 cellpadding=3><form name="frmsignup" method="post" action="newuser.asp"><tr><td align=right>User ID : <td align=left nowrap><input type=text name="txtuid">*<input type=button value="Check Availability" onClick='checkAvail();'><td rowspan=4 valign=top><iframe name="frmavail" src="checkavail.asp" scrolling=no height=80 width=100 frameborder=0></iframe></td>

Page 36: Online Shopping

<tr bgcolor=lightgoldenrodyellow><td align=right>Password : <td align=left><input type=password name="txtpass">*<tr bgcolor=lightgoldenrodyellow><td align=right>ReType Password : <td align=left><input type=password name="txtpass1">*<tr bgcolor=lightgoldenrodyellow><td align=left colspan=2 bgcolor=lightgrey><u><b>Personal Detail</b></u><tr bgcolor=lightgoldenrodyellow><td align=right>First Name : <td align=left><input type=text name="txtfname">*<tr bgcolor=lightgoldenrodyellow><td align=right>Last Name : <td align=left><input type=text name="txtlname"><tr bgcolor=lightgoldenrodyellow><td align=right>Phone Number : <td align=left><input type=text name="txtphone"><tr bgcolor=lightgoldenrodyellow><td align=right>E-Mail : <td align=left><input type=text name="txtemail">*<tr bgcolor=lightgoldenrodyellow><td align=right>Address : <td align=left><textarea name="txtaddr" cols=25 rows=5></textarea>*<tr bgcolor=lightgoldenrodyellow><td align=right>Gender : <td align=left><input type=radio name="optsex" value="male" checked> Male <input type=radio name="optsex" value="female"> Female *<tr bgcolor=lightgoldenrodyellow><td align=right>Age : <td align=left><input type=text name="txtage" size=5><tr><td><font color=red>Note: The fields with * are mandatory</font> <td align=right><input type=submit value="DONE" onClick='return validateInput()'><input type=reset value="CLEAR"></form></table><% else Dim con, rs, strsql' Set the ADO ConstantsConst adOpenDynamic = 2Const adLockOptimistic = 1Set con = Server.CreateObject("ADODB.Connection")con.Open "DSN=eshopdsn"Set rs = Server.CreateObject("ADODB.Recordset")

Page 37: Online Shopping

strsql = "select * from customer where custid=" & "'"& session("sess_id") &"'"rs.Open strsql, con, adOpenDynamic,adLockOptimisticif not rs.BOF then%><table width="75%" align=center border=0 cellspacing=0 cellpadding=3><form name="frmsignup" method="post" action="newuser.asp?action=1"><tr><td align=right>User ID : <td align=left nowrap><input type=text name="txtuid" disabled value=<%=session("sess_id")%>><tr bgcolor=lightgoldenrodyellow><td align=right>Password : <td align=left><input type=password name="txtpass">*<tr bgcolor=lightgoldenrodyellow><td align=right>ReType Password : <td align=left><input type=password name="txtpass1">*<tr bgcolor=lightgoldenrodyellow><td align=left colspan=2 bgcolor=lightgrey><u><b>Personal Detail</b></u><tr bgcolor=lightgoldenrodyellow><td align=right>First Name : <td align=left><input type=text name="txtfname" value=<%=rs("custfname")%>>*<tr bgcolor=lightgoldenrodyellow><td align=right>Last Name : <td align=left><input type=text name="txtlname" value=<%=rs("custlname")%>><tr bgcolor=lightgoldenrodyellow><td align=right>Phone Number : <td align=left><input type=text name="txtphone" value=<%=rs("custphone")%>><tr bgcolor=lightgoldenrodyellow><td align=right>E-Mail : <td align=left><input type=text name="txtemail" value=<%=rs("custemail")%>>*<tr bgcolor=lightgoldenrodyellow><td align=right>Address : <td align=left><textarea name="txtaddr" cols=25 rows=5><%=rs("custaddr")%></textarea>*<tr bgcolor=lightgoldenrodyellow><td align=right>Gender : <% if rs("custgender")="male" then %><td align=left><input type=radio name="optsex" value="male" checked> Male <input type=radio name="optsex" value="female"> Female *<% else %>

<td align=left><input type=radio name="optsex" value="male"> Male <input type=radio name="optsex" value="female" checked> Female *<% end if %>

Page 38: Online Shopping

<tr bgcolor=lightgoldenrodyellow><td align=right>Age : <td align=left><input type=text name="txtage" size=5 value=<%=rs("custage")%>><tr>td><font color=red>Note: The fields with * are mandatory</font> <td align=right><input type=submit value="UPDATE" onClick='return validateInput()'><input type=reset value="CLEAR"></form></table>< %con.closeset con=nothingend ifend if %><br><script language="javascript" src="footer.js"></script></body></html>

26. Coding for sub product linkings

<%@ language="vbscript"%><html><body bgcolor=teal topmargin=0><script language="javascript">function checkProduct(){window.open("product_detail.asp?subcat="+ document.frmsubcat.comsel.options[document.frmsubcat.comsel.selectedIndex].text,"frmdetail");}</script><%'on error resume nextResponse.CacheControl = "no-cache"Response.AddHeader "Pragma", "no-cache"Response.Expires = -1if not request.querystring("pname")="" thenDim con, rs, strsql

' Set the ADO ConstantsConst adOpenDynamic = 2Const adLockOptimistic = 1Set con = Server.CreateObject("ADODB.Connection")

Page 39: Online Shopping

con.Open "DSN=eshopdsn"Set rs = Server.CreateObject("ADODB.Recordset")

strsql = "select subcatname from subcategory where catid in(select catid from category where catname=" & "'"& request.querystring("pname") &"')"rs.Open strsql, con, adOpenDynamic,adLockOptimisticresponse.write("<form name=""frmsubcat"">")response.write("<select name=""comsel"" onChange='checkProduct();'>")if rs.BOF thenresponse.write("<option>Select Subcategory</select>") elseresponse.write("<option>Select Subcategory") while not rs.EOFresponse.write("<option>" & rs("subcatname"))rs.MoveNextwendend ifresponse.write("</select></form>")con.CloseSet con = Nothingend if%></body></html>

27. Coding for validating user

<%@ language="vbscript"%><HTML><head><title>Validating User...</title></head><body leftmargin=0 topmargin=0 bgcolor=black><script language="javascript" src="header.js"></script><%if Session("sess_id")="" thenresponse.write("<script>setHeader(true,true,true,true,false)</script>")elseresponse.write("<script>setHeader(true,true,true,true,,true);</script>")end if%><br><%Response.CacheControl = "no-cache"Response.AddHeader "Pragma", "no-cache"Response.Expires = -1

Page 40: Online Shopping

Dim con, rs, strsql

' Set the ADO ConstantsConst adOpenDynamic = 2Const adLockOptimistic = 1

Set con = Server.CreateObject("ADODB.Connection")con.Open "DSN=eshopdsn"Set rs = Server.CreateObject("ADODB.Recordset")

strsql = "select * from customer where custid=" & "'"& request.form("txtuid") &"'"rs.Open strsql, con, adOpenDynamic,adLockOptimistic

if not rs.BOF thenif rs("custpass")= request.form("txtpass") thenSession("sess_id")=request.form("txtuid")Session("sess_name")=rs("custfname") &" "& rs("custlname")response.redirect("index.asp")elseResponse.write("<font color=red><h3>Invalid Password...Try Again...</h3></font>")'response.endend ifelseResponse.write("<font color=red><h3>No Such User Found...Try Again...</h3></font>")'response.endend ifcon.closeset con=nothing%><br><script language="javascript" src="footer.js"></script></body></html>

28. Coding for viewing the cart

<%@ language="vbscript"%><html><body leftmargin=0 topmargin=0 text=yellow><link rel="stylesheet" href="global.css" type="text/css"><style>th {color:maroon; background-color:lightgreen}td {color:black; font-weight:bold}.txt {font-weight:bold; color:red; text-align:center; background-color:lightgreen; border:0}

Page 41: Online Shopping

</style><script language="javascript" src="header.js"></script><script>setHeader(true,true,false,false,true,true)</script><!--#include file ="setusername.asp"--><script language="javascript">function setImg(){document.imgwait.src="./images/wait.gif"}function validateInput(){if(document.frmfinal.txtcardnum.value==""){alert("Please enter card number!"); document.frmfinal.txtcardnum.focus(); return false;}else if(document.frmfinal.txtcardpass.value==""){alert("Please enter PIN!"); document.frmfinal.txtcardpass.focus(); return false;}else if(isNaN(document.frmfinal.txtcardpass.value)){alert("Enter valid PIN!"); return false;}else if(document.frmfinal.txttotamt.value=="0"){alert("Your total amount is 0 \nPlease select any product to buy!!"); return false;}else { setImg(); }return true;}</script><%Response.CacheControl = "no-cache"Response.AddHeader "Pragma", "no-cache"Response.Expires = -1Dim con, rs, strsql

' Set the ADO ConstantsConst adOpenDynamic = 2Const adLockOptimistic = 1

response.write("<table border=1 width=100% cellspacing=0 cellpadding=0 align=center bgcolor=antiquewhite>")response.write("<tr><th>Sl. No.<th>Item Code<th>Item Name<th>Quantity<th>Price<th>Disc.<th>Amount</th></tr>")

Set con = Server.CreateObject("ADODB.Connection")con.Open "DSN=eshopdsn"Set rs = Server.CreateObject("ADODB.Recordset")

dim ctr,amt,totamt,txtpid,txtpamtctr=0totamt=0

Page 42: Online Shopping

txtpid=""txtpamt=""response.write("<form name=""frmfinal"" method=""POST"" action=""billing.asp"">")for each i in Session.contentsif not i="sess_id" and not i="sess_name" thenstrsql = "select * from product where proid='"& i &"'"rs.Open strsql, con, adOpenDynamic,adLockOptimisticif not rs.BOF thenctr=ctr+1amt = cdbl((rs("procost")-(rs("procost")*rs("prodisc")/100))* Session.contents(i))totamt=totamt+amtresponse.write("<tr align=center><td>"& ctr)response.write("<td><input type=checkbox name=chk checked onClick='setAmount(this);' value="& i &">"& i) response.write("<td>"& rs("proname")&"<td>"& Session.contents(i)&"<td>"& rs("procost")&"<td>"& rs("prodisc")&"%<td><font color=red>"& amt &"</font>")txtpid=txtpid & i &","txtpamt=txtpamt & amt &","end ifrs.closeend ifnextcon.closeset con=nothingif ctr>0 thenresponse.write("<tr><td colspan=6 align=right>Total Amount : &nbsp;<td bgcolor=lightgreen align=center><font color=red><input name=""txttotamt""type=text class=txt size=6 value="& totamt &"></font>")%><tr><td colspan=7 bgcolor=yellow>Payment Detail:</td><tr><td align=right>Card No. :&nbsp; <td><input type=text name=txtcardnum><td colspan=5 rowspan=3><img name=imgwait src="./images/spacer.gif"><tr><td align=right>PIN :&nbsp;<td><input type=password name=txtcardpass size=6><tr><td colspan=2 align=right><input type=submit value=" OK " onClick='return validateInput();'></td></tr></form></table>

<script language=""javascript">pid="<%=txtpid%>";pamt="<%=txtpamt%>";function setAmount(chkid){arrpid=pid.split(",");arrpamt=pamt.split(",");var i;

Page 43: Online Shopping

for(i=0;i<arrpid.length;i++){ if(chkid.value==arrpid[i]) { break; } }txtref=document.frmfinal.txttotamt;if(chkid.checked==true){txtref.value = parseFloat(txtref.value) + parseFloat(arrpamt[i])}else{txtref.value = parseFloat(txtref.value) - parseFloat(arrpamt[i])}}</script>

<% else %><tr><td bgcolor=grey colspan=7>No items available in the cart!!</td></tr></form></table><%end if%>

<br><script language="javascript" src="footer.js"></script></body></html>

29. Coding for welcome page

<%@ language="vbscript"%><HTML><head><title>WELCOME</title></head><body leftmargin=0 topmargin=0><link rel="stylesheet" href="global.css" type="text/css"><script language="javascript" src="header.js"></script><%Response.CacheControl = "no-cache"Response.AddHeader "Pragma", "no-cache"Response.Expires = -1if Session("sess_id")="" thenresponse.write("<script>setHeader(true,false,true,true,false,true)</script>")elseresponse.write("<script>setHeader(true,false,false,false,true,true)</script>")end if%><!--#include file ="setusername.asp"--><iframe name="frmoption" height="100%" width="100%" frameborder=0 scrolling=no src="product_link.asp"></iframe><script language="javascript" src="footer.js"></script></body></HTML>

(User Interface- Object view)

Page 44: Online Shopping

1. Administrative Login

2. Customer feedback details as viewed by the Administrator

3. Sales details as viewed by the Administrator

4. Product stock as viewed by the Administrator

Page 45: Online Shopping

5. Home page for New User

6. Sign in Page for Registered User

Page 46: Online Shopping

7. Sign up Page for New User

8. Product Display

9. View items in the shopping cart

Page 47: Online Shopping

10. Generation of Bill after purchase

Page 48: Online Shopping

Testing

Software testing is any activity aimed at evaluating an attribute or capability of a program or system and determining that it meets its required results. Although crucial to software quality and widely deployed by programmers and testers, software testing still remains an art due to limited understanding of the principles of software. The difficulty in software testing stems from the complexity in software: we cannot completely test a program with moderate complexity. Testing is more than just debugging. The purpose of testing can be quality assurance, verification or reliability estimation. Testing can be used as a generic metric as well. Correctness testing and reliability testing are two major areas of testing. Software testing is a trade off between budget, time and quality.

Test-1: To test authentication or login verification for registered user:

Incorrect Login username:INPUT: User ID: xxx Password:123Error Message: No such user found… Try Again…

Incorrect Password for existing user:INPUT: User ID:abc Password:111Error Message: Invalid password… Try Again…

Correct Username and password:INPUT: User ID:abc Password:abcOUTPUT: Welcome page of registered user “abc” is opened.

Test-2: To test authentication or login verification for administrator:

Page 49: Online Shopping

Incorrect Login ID for administrator:INPUT: Login ID:szps Password:123Error Message:No such Administrator found… Try Again…

Incorrect Password for administrator:INPUT: Login ID:abc Password:123Error Message:Invalid Password… Try Again…

Correct Username and password:INPUT: User ID:abc Password:abcOUTPUT: Home page of administrator “abc” is opened.

Test-3:To test the proper working of the sign up page for a new user.

Providing the user ID of an existing user for the new user:INPUT: User ID: abcOUTPUT: On pressing the check availability button the following is displayed.

Providing a fresh non-existing User ID for the new user:INPUT: User ID: samOUTPUT: On pressing the check availability button the following is displayed.

Test-4:To test the mandatory fields of signup page of a new user.

Page 50: Online Shopping

Leaving any mandatory field blank:INPUT: Any of the fields Password/Address/E-mail/Firstname/Gender is left blank.OUTPUT: An appropriate error message of the following type is displayed.

Test-5:To test whether user is able to retrieve a forgotten password.

Clicking on Forgot Password option after providing the username:INPUT: Click on Forgot Password link after providing user ID.OUTPUT: The following message is displayed:

Test-6:To test view cart option for a registered user.

User unchecks a particular item from the cart:INPUT: Uncheck a product from the shopping cart.OUTPUT: The product price is deducted from the total amount in the invoice.

Page 51: Online Shopping

Test-7:To test the validity of the pin no. entered by the customer for purchasing products.

User enters non-numeric pin no. for credit card:INPUT: Card No:abcd002 Pin:abbcOUTPUT: An error message saying “Enter valid PIN!” is displayed.

User enters correct numeric pin for credit card:INPUT: Card No:abcd002 Pin:1234

OUTPUT: The proper invoice for the particular customer is generated.

Page 52: Online Shopping

REQUIREMENTS

System: Microsoft Windows XP

Memory Space: 256 MB of RAM

Hard Disk Capacity: 40 GB

Front-end (Client-Side): HTML

Server-Side Script: ASP(Active Server Page)

Back-end (Database): MS Access 2003

Page 53: Online Shopping

BIBLIOGRAPHY

In order to perform the above project we have taken the help of the following references:

1. w3schools.com2. www.google.com3.ASP in a nutshell – A. Keyton Weissinger4.HTML & XHTML – Bill Kennedy, Chuck Musciano5. DBMS Concepts- Henry F. Korth