Simple Application Assignment

5
TKF4123 Web Programming Simple Application Duration : 3 hours XYZ Company wants to develop a web application to store the details about the web users and web accessed by users. Create a web application folder called your matrix number (example: 00001). Create the following tables in PHP and enter the sample data wherever specified in the other file. Table website (file name : tableWebsite.php) Column Name Data type Description websiteId Number(5) Primary key websiteName Varchar(20) totalHits Number(3) totalHits >= 0 dataWebsite.php websiteId websiteName totalHit s 5001 Google 1 5002 Yahoo 0 5003 TourismMalays ia 1 5004 UDM 0 Table webUsers (file name: tableWebUser.php) Column Name Data type Description userId Number(5) Auto_increment, primary key Username Varchar(1 5) Not Null dataWebUser.php userId Username 1

Transcript of Simple Application Assignment

Page 1: Simple Application Assignment

TKF4123 Web ProgrammingSimple ApplicationDuration : 3 hours

XYZ Company wants to develop a web application to store the details about the web users and web accessed by users.

Create a web application folder called your matrix number (example: 00001).

Create the following tables in PHP and enter the sample data wherever specified in the other file.

Table website (file name : tableWebsite.php)

Column Name Data type DescriptionwebsiteId Number(5) Primary keywebsiteName Varchar(20)totalHits Number(3) totalHits >= 0

dataWebsite.phpwebsiteId websiteName totalHits5001 Google 15002 Yahoo 05003 TourismMalaysia 15004 UDM 0

Table webUsers (file name: tableWebUser.php)

Column Name Data type DescriptionuserId Number(5) Auto_increment, primary keyUsername Varchar(15) Not Null

dataWebUser.phpuserId Username1001 Henry1002 Ahmad1003 Jimmy1004 Ronnie

1

Page 2: Simple Application Assignment

Table webAccess (file name: tableWebAccess.php)

Column Name Data type DescriptionwebsiteId Number(5) Foreign keyuserId Number(5) Foreign keyaccessDate Date Current date

datawebAccess.phpwebsiteId userId accessDate5001 1004 22-mar-20085003 1001 24-jun-2008

(Table creation: 3 marks)(Data insertion: 1 mark)(Auto increment : 1 mark)

Design a homepage that displays the following links ( homepage.html) :a. Add Userb. Access Websitec. Web Access Report

(homepage.html: 1mark)

The links should direct the user to the following pages:

a. Add User

Design a HTML screen for accepting the following details (addUser.html)

User Name : – textfield

– button

Use JavaScript to ensure that the field is mandatory; user name is valid alphabet.

(addUser.html: 1 mark)(JS validation: 1 marks)

When the Add button is clicked, it should called addUser.php. It should generate userId from auto_increment. The record should be inserted into webUser table. Display the appropriate message in case of data successfully inserted in table and displays a newly generated UserId.

(addUser.php: 3 marks)

2

Page 3: Simple Application Assignment

b. Access Website

When user clicks on Access Website link, it should call the accessWeb.html, which displays the following details:

WebsiteID: - texfield

UserID: - texfield

– button

Use JavaScript to ensure that all the fields are mandatory websiteId and UserId are a valid positive number.

(accessWeb.html: 1mark )(JS validation: 2 marks)

When the Access button is clicked, it should called accessPHP.php. The PHP should perform server side null validation. It should check the existence of websiteId. If the websiteId does not exist in website table, display the appropriate message. If websiteId exist in website table, check the existence of userId in webusers table. If the userId does not exist in webUser table, display the appropriate message. If the userId exist in webUsers table, insert websiteId, UserId and access date into webacess table and update totalHits value in website table. Display the appropriate message if data successful insert into webaccess table.

(accessPHP.php: 6 marks)

c. Web Access Report

When user clicks on Web Access Report link, it should call the reportWeb.html, which displays the following detail:

UserID: - textfield

- button

Use JavaScript to ensure that all the fields are mandatory UserId are a valid positive number.

(reportWeb.html: 1 mark)(JS validation: 1 marks)

3

Page 4: Simple Application Assignment

When the user clicked on Report button, it should call the webReport.php. The PHP should perform server side null validation. It should check the existence of userId. If the userId does not exist in webUser table, display the appropriate message. . If the userId exist in webUsers table, display the following details in html tabular format.

Website ID Website Name Total Hits Access Date

(webReport.php: 4 marks)(Coding standard: 2 marks)(Reusable code: 2 marks)

Submission:Zip/compress your matric number folder. Submit into Lab_Test in kelip

4