Professional Documents
Culture Documents
1. System Overview 1
1.1. Purpose 1
1.2. Scope 1
1.3. Functional requirements 1
1.4. Non-functional requirements 3
1.5. User of the system with their characteristics 3
1.6. Tools and technology 5
1.7. Summary 6
2. System Design 7
2.1. Use case Diagram 7
2.2. Activity Diagram 12
2.3. System Development Model 16
1. System Overview
1.1. Purpose
1.1.1. Definition
- Akshar Tours and Travels is a Car Rental Website that can be used for Cab
Booking Services from Surat to Outstation. It Provides Cab services from
Surat to Certain Places near Surat. The company aims to provide easy, safe,
and cheap rides by using automation in cab booking services.
1.1.2. Objective
1.1.2.1. Easy and Fast way to Car Booking from Surat
- The Primary objective of our forum website is to provide seamless and
effortless car rental services from Surat to nearby outstations with
competitive rates and transparent pricing structures, with no hidden fees or
surcharges. User can book a car from their home at any time of the Day with
just a few Clicks.
1.1.2.2. 24/7 Information and Customer Support AI-based Chatbot
- Providing 24/7 customer services using an AI-based Chatbot on our website.
A user can visit our website at any time of the day and can access
information about our company using our Chatbot also users can use the
chatbot for easy car booking.
1.1.2.3. Safe and Secure rides at a very affordable pricing.
- We are committed to providing safe and secure rides by providing
registered and professional drivers and, we are committed to providing
affordable rides, so we offer car services at 10% lower prices on every
booking.
1.1.2.4. Multiple Payment Method support for easy payment
- We Support payments in Cash, Phone pay, Paytm, UPI, etc. Multiple
Payment Options to ease the process of payment for the user. A user can
complete his payment either from mobile or by visiting our office.
1.1.2.5. Easy Booking Process from WhatsApp.
- Our Booking Integration with WhatsApp will help the customer on booking
the car from their WhatsApp. Users can Simply book a ride on WhatsApp
Chat by answering a few questions in a minute. It's a completely safe and
efficient way of booking a car for rides.
1.2. Scope
1.2.1. Field scope
- The website will only show questions that are related to the choices the user
made during the login process.
1.2.2. Execration scope
- The website won’t allow the usage of any profanity or expletives and will
impose strict policies on it.
2|Page
Akshar Tours & Travels
Now in the middle of the Dashboard Page, we see an option for booking statistics
where we get the graphical representation of the bookings in a particular year
month-wise. It will help to understand the booking patterns by showing monthly
bookings.
Now on the right side of that, there is a Pie chart named Total Revenue which
describes the Revenue generated from the bookings of the trips.
The pie chart shows the total revenue of a company divided into three parts:
o Net Amount: It is the revenue that the company receives from its customers,
minus the cost of goods sold and other direct expenses.
o Company Margin: Company margin is the difference between the net
amount and the total driver charges. It represents the profit that the
company makes on each dollar of revenue.
o Total Driver Charges: Total driver charges are the fees that the company
pays to its drivers for delivering goods or services to customers.
3|Page
Akshar Tours & Travels
1.4.2. Usability
The system will be optimised so that it can be used by people with disabilities and
other issues.
The system will be responsive and will be available for all screen sizes.
1.4.3. Compatibility
The system can be operated in all modern browsers such as Google Chrome,
Microsoft Edge, Mozilla Firefox, Opera Mini, and legacy browsers such as Internet
Explorer.
1.5.3. Moderator
Responsible for ensuring that the website's policies and guidelines are being
followed by all users.
Can view, vote, upload, and verify questions and answers.
Can send update notifications to the uploader and report questions and answers to
an employee user.
Has the ability to delete answers that violate the website's policies and guidelines.
Can create tags and tag descriptions.
Monitors registered user activities and reports any suspicious content to employee
users.
Helps to foster a welcoming environment free of unnecessary negativity and
ambiguity.
Plays a crucial role in improving the user experience by verifying the content and
ensuring the accuracy and relevance of the questions and answers.
Acts as a mediator between the registered users and the employee users in
resolving any disputes or issues that may arise.
1.5.4.1. Qualities to select a moderator:
4|Page
Akshar Tours & Travels
5|Page
Akshar Tours & Travels
1.6.4. Tools
1.6.4.1. VS Code
- Visual Studio Code is a source code editor that is likely used by the
development team to write and edit code for the website. It includes
support for debugging, embedded Git control, syntax highlighting,
intelligent code completion, snippets, and code refactoring.
1.6.4.2. Sublime
- Sublime Text is a popular text editor among web developers due to its
speed and flexibility. The development team may use it for writing and
editing code for the website.
1.6.4.3. NetBeans
- NetBeans is an integrated development environment (IDE) that supports
various programming languages such as HTML, CSS, JavaScript, and PHP.
It provides a code editor, a compiler, and a debugger, also has a built-in
feature that allows you to easily run and test web pages in a browser.
1.6.4.5. XAMPP
- XAMPP is a software stack that includes Apache, MySQL, and PHP, which are
commonly used together in web development. It allows the development
team to set up a local web development environment on their computer.
1.6.5. Technology
1.6.5.1. HTML5
- Hypertext Mark-up Language (HTML) is the standard mark-up language
used to create web pages. The AsQ website likely uses HTML5 to create the
structure of the website.
1.6.5.2. CSS4
- Cascading Style Sheets (CSS) is a style sheet language used for describing the
presentation of a document written in HTML. The AsQ website likely uses
CSS4 for styling the website.
1.6.5.3. SCSS
- SCSS is an extension of CSS that adds more advanced features, such as
variables and nesting. The development team may use it to write more
maintainable and organized code.
1.6.5.4. JavaScript
6|Page
Akshar Tours & Travels
1.7. Summary
1.7.4. Number of functional requirements: 7
1.7.5. Number of non-functional requirements: 3
1.7.6. Number of users: 5
2. System Design
2.1. Use case Diagram
2.1.1. List of Users
Guest User
Registered User
Moderator
Employee
Admin
7|Page
Akshar Tours & Travels
8|Page
Akshar Tours & Travels
2.1.2.3. Moderator
9|Page
Akshar Tours & Travels
10 | P a g e
Akshar Tours & Travels
11 | P a g e
Akshar Tours & Travels
Registered User
Moderator
Employee
Admin
2.2.2.2. Registered_User
13 | P a g e
Akshar Tours & Travels
2.2.2.4. Employee
14 | P a g e
Akshar Tours & Travels
2.2.2.5. Admin
15 | P a g e
Akshar Tours & Travels
Project 16 | P a g e
charter
Design
User stories
documentation
Akshar Tours & Travels
17 | P a g e
Akshar Tours & Travels
2.4.1.2. Indentation
- Use four spaces for indentation, not tabs.
- Indent code blocks consistently.
- Use braces ({}) to enclose code blocks, even for one-line statements.
2.4.1.3. Comments
- Use comments to explain complex or important parts of the code.
18 | P a g e
Akshar Tours & Travels
2.4.1.5. Security
- Sanitize user input to prevent SQL injection and other security
vulnerabilities.
- Use encryption for sensitive data, such as passwords.
- Implement access controls to restrict user privileges and prevent
unauthorized access.
19 | P a g e
Akshar Tours & Travels
20 | P a g e
Akshar Tours & Travels
2.5.2. Admin_User
21 | P a g e
Akshar Tours & Travels
2.5.2.1. Description
- Admin_User is responsible for maintaining and updating the website. This
includes tasks such as adding and removing employees, monitoring website
traffic and performance and troubleshooting technical issues.
2.5.3. Employee_User
2.5.3.1. Description
22 | P a g e
Akshar Tours & Travels
- This user is responsible for monitoring and enforcing the rules of a website,
ensuring a safe and positive environment for all users by reviewing,
approving, removing content and moderating user interactions, and
banning or warning violators.
23 | P a g e
Akshar Tours & Travels
24 | P a g e
Akshar Tours & Travels
2.5.4. Registered_User
2.5.4.1. Description
- Primary users of our website who have been registered in our database.
25 | P a g e
Akshar Tours & Travels
2.5.5. Interest
2.5.5.1. Description
26 | P a g e
Akshar Tours & Travels
27 | P a g e
Akshar Tours & Travels
2.5.6. Moderator
2.5.6.1. Description
~ This user is responsible for monitoring and enforcing the rules of a
website, ensuring a safe and positive environment for all users by
reviewing, approving, removing content and moderating user
interactions and banning or warning violators.
2.5.6.5.
28 | P a g e
Akshar Tours & Travels
2.5.7. Tag
2.5.7.1. Description
- Storing hashtags refers to the practice of organizing and categorizing
questions and answers by tagging them with specific keywords or phrases,
preceded by the "#" symbol. These hashtags act as labels that make it easier
for users to find relevant content by searching for specific topics or
keywords.
29 | P a g e
Akshar Tours & Travels
2.5.8. Question
2.5.8.1. Description
- This table refers to the practice of collecting and saving user-submitted
questions on the website in a database for easy retrieval, manipulation, and
analysis. This improves the user experience by providing relevant answers
and suggestions, and can also be used to improve the website's search
functionality and overall performance.
31 | P a g e
Akshar Tours & Travels
2.5.9. Like_Question
2.5.9.1. Description
- Use to store users votes on question.
32 | P a g e
Akshar Tours & Travels
2.5.10. Save_Question
2.5.10.1. Description
- Use to save questions in profile.
33 | P a g e
Akshar Tours & Travels
2.5.11. TagQuestion
2.5.11.1. Description
- Tags can be used to improve the organization and management of the
questions, as well as to make it more discoverable and searchable.
34 | P a g e
Akshar Tours & Travels
2.5.12. Answer
2.5.12.1. Description
- This table refers to the practice of collecting and saving answers to the
questions submitted by the users on the website in a database for easy
retrieval, manipulation, and analysis. The answers are usually provided by
the community of users or experts in the field. This allows for the
improvement of the user experience by providing relevant and accurate
answers and can also be used for analytics and reporting purposes.
Employee, Moderator
Related Processes Answer
36 | P a g e
Akshar Tours & Travels
2.5.14. Save_Answer
2.5.14.1. Description
- To store the answers which user want to save.
2.5.15. TagAnswer
2.5.15.1. Description
- Tags can be used to improve the organization and management of the
answers, as well as to make it more discoverable and searchable.
38 | P a g e
Akshar Tours & Travels
39 | P a g e
Akshar Tours & Travels
NULL
Admin_Name VARCHAR( NOT Name of the admin user "Jane Smith"
50) NULL
Admin_Password char NOT Password for admin password
NULL user
Answer_Description TEXT NOT The description of the "The answer to your
NULL answer provided by a question is..."
user.
Answer_Id VARCHAR( NOT A unique identifier for "A1"
16) NULL the answer provided by
a user.
Answer_Like BOOLEAN NULL Indicates whether a true/false
user liked the answer or
not.
Created_User varchar NOT References "user123"
NULL Registered_User
(Registered_User_Id)
Delete_by_Employee_Id varchar NULL References "emp456"
Employee_User(Employ
ee_Id)
Delete_by_Moderator_Id varchar NULL References "mod789"
Moderator(Moderator_I
d)
Delete_Date DATE NULL Date when question was "2022-03-15"
deleted
Employee_Address varchar NULL Address of the "123 Main St"
employee
Employee_Activation_Date date NOT Date when employee's 44562
NULL account was activated
Employee_Deactivate_Date date NULL Date when employee's 44926
account was
deactivated (if
applicable)
Employee_Department varchar NULL Department of the "IT"
employee
Employee_DOB date NOT Date of birth of 34731
NULL employee
Employee_email char NOT Email address of john.doe@example.co
NULL employee m
Employee_Hire_Date DATE NOT Date when the "2021-01-01"
NULL employee was hired
Employee_Id varchar NOT Primary key for table emp001
NULL
Employee_mobile_number char NOT Mobile number of 1234567890
NULL employee
Employee_name char NOT Name of the employee John Doe
40 | P a g e
Akshar Tours & Travels
NULL
Employee_Password char NOT Password for employee password123
NULL user
Employee_permanent_address varchar NOT Permanent address of 123 Main Street,
NULL employee Anytown, USA
Employee_Position VARCHAR( NULL Position of the "Manager"
50) employee in the
company
Employee_Salary decimal NULL Salary of the employee 50000
Field_Full_Name varchar NOT Full name of the field First Name
NULL
Field_Id varchar NOT Primary key for table field_001
NULL
Field_Sort_Name char NULL Short name for field FN
Moderator_Id VARCHAR NOT Unique identifier for "mod123"
NULL moderator
Moderator_Mode_Activate_Date DATE NOT Date when moderator "2022-02-15"
NULL mode was activated
Moderator_Mode_Activate_Emp VARCHAR NOT References "emp123"
loyee NULL Employee_User(Employ
ee_Id)
Moderator_Mode_Deactivate_D DATE NULL Date when moderator "2022-02-25"
ate mode was deactivated
Moderator_Mode_Deactivate_E VARCHAR NULL References "emp456"
mployee Employee_User(Employ
ee_Id)
Question_Description TEXT NOT Description of the "What is AI?"
NULL question
Question_Id VARCHAR NOT Unique identifier for "ques123"
NULL question
Question_Like_Date_Time DATETIME NULL The date and time when "2022-01-01
a user liked a question. 12:00:00"
Online_Status boolean NULL Whether employee is TRUE
currently online or not
Registered_User_Id VARCHAR( NOT The unique identifier of "U1"
16) NULL the user who posted the
answer or liked the
answer or saved the
answer.
Reply_Date DATETIME NOT The date and time when "2022-01-01
NULL the user posted the 12:00:00"
answer.
Tag_Name VARCHAR( NULL The unique name of the "tag1"
50) tag.
Upload_Date DATETIME NOT The date and time when "2022-01-01
NULL the question was 12:00:00"
41 | P a g e
Akshar Tours & Travels
uploaded.
Upload_user_Id VARCHAR( NOT The unique identifier of "U1"
16) NULL the user who uploaded
the question.
Verification_Date DATE NULL The date on which the "2022-01-01"
answer was verified. If
it is not verified, then
this value will be null.
Verification_status VARCHAR( NULL The verification status "verified"
30) of the answer. This can
be "verified",
"unverified", or
"pending verification".
Verify_by_Employee_Id VARCHAR( NULL The unique identifier of "E1"
16) the employee who
verified the answer.
Verify_by_Moderator_Id VARCHAR( NULL The unique identifier of "M1"
16) the moderator who
verified the answer.
2.7. Summary
2.7.1. Number of tables 15
42 | P a g e
Akshar Tours & Travels
43 | P a g e
Akshar Tours & Travels
Accessibility
~ Allowing users to configure a site can also improve accessibility, by
allowing users to adjust the site to suit their needs, such as using high
contrast mode.
3.1.3.4. Search bar
- The search input box will be used on the website to allow users to quickly
and easily search for specific information or content within the site. This
can be useful in a variety of contexts, such as:
Space saving
~ A collapsible navbar allows a website or application to save space,
which can be useful for smaller screens or when displaying more
important content.
44 | P a g e
Akshar Tours & Travels
- Answer
- Tag
- TagQuestion
- TagAnswer
3.1.6. Data In and Out
- Request question and answer
- Response question and answer
45 | P a g e
Akshar Tours & Travels
46 | P a g e
Akshar Tours & Travels
3.2.3.3. Trending
- The user will receive trending questions regarding his/her fields.
3.2.3.4. User ID
- This ID will be dynamically generated by the system which will be
used to uniquely identify the user.
3.2.3.5. Upload box
- This will be used to write and upload questions and assign tags to the
question so that they can be used to group questions based on their
fields and subfields.
3.2.3.6. User reference address
- This is the user’s address that he/she will enter during the login
process.
3.2.3.7. Saved button
Convenience
~ By allowing users to save content, a website or application can make
it more convenient for users to access content they are interested in
at a later time, rather than having to search for it again.
Organization
~ Saving content allows users to organize and categorize content
according to their interests or needs.
Personalization
~ By allowing users to save content, a website or application can
personalize the experience for each user based on their saved
content.
47 | P a g e
Akshar Tours & Travels
48 | P a g e
Akshar Tours & Travels
49 | P a g e
Akshar Tours & Travels
3.4.1. Purpose of UI
- This page will contain all the feature a moderator user has but will also
contain some different features for the employee such as verify a question,
send update notification, suspend a user, remove content and view user
profile or reports.
52 | P a g e
Akshar Tours & Travels
- This page will contain all the feature a registered user has but will also
contain some additional features for the admin such as verify a question ,
report a user or ban a user , remove content , view an users profile.
Associated tables
- Question
- Answer
- Tag
- Admin
- Registered_User
- Moderator
- Stars
- Field
- Interest
Data In and Out
- Request Question and answer
- Request reports
- Response reports
- Response Question and answer
53 | P a g e
Akshar Tours & Travels
4. Implementation of Functionality
4.1. Log in & Sign in
4.1.1. Purpose of UI
- The inspiration for this design was to give smooth and holistic user
experience which would allow them to navigate through different pages with
effortless experience.
- This UI also provides the user with all type tips and hints which will help
them during their initial encounter with our site these points shall help
create an overall better experience.
4.1.2. Screenshot of Log In & Sign In
54 | P a g e
Akshar Tours & Travels
56 | P a g e
Akshar Tours & Travels
[Search Bar]
4.3.3. Used controls with justification
- Navigate to the page where the search bar is located.
- Type in a keyword or phrase in the search bar.
- The search bar will display a list of suggested questions related to the keyword or
phrase.
- Click on a suggested question to view the answer.
4.3.5. Implementation
- The search bar is implemented using HTML, CSS, and JavaScript/jQuery.
- The suggestion list is generated dynamically using Ajax and PHP.
- As the user types in keywords, the search bar sends an Ajax request to the server.
- The server runs a PHP script that searches the database for questions related to the
entered keywords.
- The PHP script returns a list of suggested questions to the search bar.
- The search bar displays the list of suggested questions in a dropdown menu below
the search bar.
- The user can click on a suggested question to view the answer.
- The search bar is implemented using HTML <input> element with type="text"
attribute.
- The suggestion list is implemented using HTML <ul> and <li> elements.
- The search bar uses jQuery's keyup event to trigger the Ajax request.
- The Ajax request is sent to the server using jQuery's $.ajax() function.
- The server-side script that handles the Ajax request is implemented using PHP and
retrieves data from a MySQL database.
- The PHP script uses MySQL's LIKE operator to search for questions that contain the
entered keywords.
- client-side code
$(".search").keyup(function(){
let val = $(".search").val();
console.log(val);
if(val==""){
$("#suggestion").html('');
return;
}let xhr;
if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
} else if (window.ActiveXObject) {
xhr = new ActiveXObject("Microsoft.XMLHttp")
}
let data = "book_name=" + val;
xhr.open("POST", "./endpoints/suggestion.php", true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
xhr.send(data);
xhr.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
let txt = this.responseText;
$("#suggestion").html(txt);
}
};
})
- server-side code
<?php
$book_name = $_POST['book_name'];
$sql = "select Question_Id , Question_Description from Question where
Question_Description LIKE '%$book_name%'";
58 | P a g e
Akshar Tours & Travels
if($result->num_rows==0){
echo "<p style='color:red;'>!!! No match found !!!</p>";
}
else{
59 | P a g e
Akshar Tours & Travels
[Profile Menu]
4.4.3. Used controls with justification
- The "Profile" component is primarily used by the users of the Q&A web application
to view their own profile information and edit it if necessary. It provides users with
the convenience of accessing and modifying their profile information in one place.
4.4.4. Implementation
- The "Profile" component is implemented using PHP, HTML, and CSS. It retrieves the
user's information from the database and populates the appropriate fields on the
page. The user can then make changes to their information and submit the form to
update their profile.
- the variables are initialized during the authentication and put into session.
<li id="profile" class="nav-item notification-menu position-relative pe-2 d-flex
align-items-center">
<a href="javascript:;" class="nav-link text-dark p-0"
id="dropdownMenuButton" data-bs-toggle="dropdown"
60 | P a g e
Akshar Tours & Travels
aria-expanded="false">
<i class="fa fa-user cursor-pointer"></i>
</a>
<div
class="profile notfication-dropdown bg-white pb-3 border d-none position-
absolute border-secondary rounded"
style="right: 1em;top: 1.5em;width: 40ch;z-index:9999">
<div class="user_info border w-100 py-4 ps-2 d-flex gap-2">
<section class="pfp align-self-center">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"
fill="currentColor"
class="bi bi-person-circle" viewBox="0 0 16 16">
<path d="M11 6a3 3 0 1 1-6 0 3 3 0 0 1 6 0z" />
<path fill-rule="evenodd"
d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8zm8-7a7 7 0 0 0-5.468
11.37C3.242 11.226 4.805 10 8 10s4.757 1.225 5.468 2.37A7 7 0 0 0 8 1z" />
</svg>
</section>
<section class="user_name d-flex flex-column">
<p style="margin-bottom:-0.40em">
<?php
echo @$Registered_User_Id;
?>
</p>
<span style="font-size:0.85rem">
<?php
echo @$email;
echo @$Mobile_Number
?>
</span>
</section>
</div>
<div class="pofile_opstions d-flex flex-column ms-2 gap-3">
<span>Profile</span>
<span>Settings</span>
<span>Sign out</span>
</div></div></li>
4.5. Upload Box
4.5.1. Purpose of UI
- The Upload Box component is a feature in the AsQ web application that allows
users to upload questions and optional tags to the database.
61 | P a g e
Akshar Tours & Travels
[Upload box]
4.5.3. Used controls with justification
- The Upload Box component can be used in various sections of the AsQ web
application to enable users to submit new questions. For example, it can be placed
on the homepage to encourage users to submit their questions.
4.5.4. Implementation
- The component will automatically load an upload form within the specified div
element. Users can enter a question and optionally add tags before submitting the
form. The Upload Box component uses AJAX to insert the question and tags (if any)
into the database.
- client-side code
let counter = 0;
document.querySelector('.truck-button').addEventListener('click', function(e) {
e.preventDefault(); // prevent the default form submission
62 | P a g e
Akshar Tours & Travels
console.log(questionValue)
// Set the Content-Type header to indicate that we are sending form data
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
63 | P a g e
Akshar Tours & Travels
setInterval(
function(){
if(document.querySelector('.truck-button').classList.contains('done')){
$('.truck-button').trigger('click');
}
}
,4000
)
}
if (!$result) {
$createdUser = "myuser"; // Change to the actual created user
$stmt = $conn->prepare("INSERT INTO tag (Tag_Name, Tag_Description, Created_User)
VALUES (:tag, '', :user)");
$stmt->bindParam(":tag", $tag);
$stmt->bindParam(":user", $createdUser);
$stmt->execute();
}
}
64 | P a g e
Akshar Tours & Travels
65 | P a g e
Akshar Tours & Travels
[Trending Bar]
4.6.3. Used controls with justification
- To showcase the top 10 questions which have been positively received by the
community.
4.6.4. Implementation
- The component will automatically load the top 10 questions via AJAX and display
them within the specified div element. The Trending Section component supports
the following options:
3.11.4.1. Refresh Interval (default: 5000)
- The number of milliseconds between each refresh of the top 10
questions list.
3.11.4.2. Question Limit (default: 10)
- The maximum number of questions to display in the top 10 list.
- The component parses the JSON data and displays the top 10 questions within the
specified div element.
- Every 5 seconds, the component sends another AJAX request to the server to
refresh the list of top 10 questions.
- If the number of upvotes for any question changes while the component is
running, the list of top 10 questions will be automatically updated to reflect the new
rankings.
</a>
</li>
`;
trend += items;
}
$('.sidebar-nav').html(trend)
}
};
setInterval(function(){
trends();
,
5000
})
$sort_order = "DESC";
$order_by = "bookID " . $sort_order;
$sql="SELECT Question.Question_Id ,Question_Description as 'Question', COUNT(*) as 'likes'
FROM Like_Question
JOIN Question ON Question.Question_ID = Like_Question.Question_Id
WHERE Question_Like=true
GROUP BY Question.Question_Id
ORDER BY COUNT(*) DESC LIMIT 10";
if ($result->num_rows == 0) {
$response = array("error" => "No match found");
} else {
68 | P a g e
Akshar Tours & Travels
$rows = array();
while ($row = mysqli_fetch_assoc($result)) {
$rows[] = $row;
}
$response = $rows;
}
echo json_encode($response);
4.6.7. data in and out
- The order of the trending question (i.e descending or ascending) is sent to
the server as the data and the question description and numebr of upvotes
on it is retuned as response and is then processed further in the front end.
[Question box]
4.7.3. Used controls with justification
69 | P a g e
Akshar Tours & Travels
- The Question component can be used in multiple sections of the Q&A web
application to display information about specific questions.
4.7.4. Implementation
- The component will display the number of upvotes, saves, and answers for a single
question within the specified div element. The Question component does not use
AJAX or interact with the server.
$stmt->bindParam(':uid' , $uid);
$stmt->execute();
}
public function getRows(){
$rows = 0;
$rows = $this->con->query('SELECT * FROM question')->rowCount();
return $rows + 1;
}
public function delete($qid){
$sql = "delete from question where Question_Id = :qid";
$stmt = $this->con->prepare($sql);
$stmt->bindParam(':qid' , $qid);
$stmt->execute();
}
}
/components/question.php
<?php
function question($id,$Question_Description ,$field , $Upload_Date , $Profession_Name ,
$upvotes ,$save_count , $answer_count , $tag , $status , $isHeTheUser=false){
$tags = "";
foreach($tag as $key => $val)
{
$tags .= "<span class='badge text-bg-info'>$val</span>";
}
$verified = ($status == 'verified') ? "fill='green'" : "fill='none'";
$canDelete = ($isHeTheUser) ? "<li data-role='deleteQ' class='badge bg-danger'>Delete</li>" :
"";
echo <<<Question
<div class="row my-2 " name='question'>
<span name="question-id" class="sr-only" style="display:none">$id</span>
<div class="d-flex flex-column gap-2 justify-content-top float-top align-items-center"
style="width: 10%;">
<div class="position-relative" style="z-index: 1;">
71 | P a g e
Akshar Tours & Travels
<div onclick="modControls(this)">
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"
fill="currentColor" class="bi bi-person-circle" viewBox="0 0 16 16">
<path d="M11 6a3 3 0 1 1-6 0 3 3 0 0 1 6 0z"/>
<path fill-rule="evenodd" d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8zm8-7a7 7 0 0 0-5.468
11.37C3.242 11.226 4.805 10 8 10s4.757 1.225 5.468 2.37A7 7 0 0 0 8 1z"/>
</svg>
</div>
<div class="opacity-0 position-absolute top-100" style="right: 1;" >
<ul style="list-style-type: none;" class="d-flex gap-1">
<li class="badge bg-danger">View Profile</li>
</ul>
</div>
</div>
<div class="answer_votes | d-none d-md-flex flex-column gap-1 justify-content-center
align-items-center">
<span>
<svg xmlns=" http://www.w3.org/2000/svg" width="16" height="16"
fill="currentColor"
class="bi bi-caret-up" viewBox="0 0 16 16">
<path
d="M3.204 11h9.592L8 5.519 3.204 11zm-.753-.659 4.796-5.48a1 1 0 0 1 1.506
0l4.796 5.48c.566.647.106 1.659-.753 1.659H3.204a1 1 0 0 1-.753-1.659z" />
</svg>
</span>
<span>
$upvotes
</span>
<span>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
fill="currentColor"
class="bi bi-caret-down" viewBox="0 0 16 16">
<path
72 | P a g e
Akshar Tours & Travels
</div>
74 | P a g e
Akshar Tours & Travels
}
4.7.7. data in and out
- No data is sent to the server as the html is already compiled on the reques
from the client. necessary data is received from the server and then processd
in the server.
[Answer box]
4.8.4. Implementation
75 | P a g e
Akshar Tours & Travels
- The Answer component displays the number of upvotes and saves for a single
answer within the specified div element. It also includes a form for users to upload
their own answers. When a user submits an answer, the form data is sent to the
server using AJAX, and the new answer is added to the database.
$("#sendIcon").click(function(e){
submitAnswer(e.target);
})
function submitAnswer(ele){
if(ele.value == "") return;
var inputEle;
var postId;
if(ele.tagName == 'INPUT'){
var postElement = $(ele).closest('.mb-5'); // Find parent post element
var idElement = postElement.find('.question-id');
postId = idElement.text(); // Get text content of id element
inputEle = ele;
76 | P a g e
Akshar Tours & Travels
}else{
var input = ele.parentElement.PreviousElementSibling;
var postElement = $(input).closest('.mb-5'); // Find parent post element
var idElement = postElement.find('.question-id');
postId = idElement.text(); // Get text content of id element
inputEle = ele.PreviousElementSibling;
}
let inputValue = inputEle.value;
$.ajax({
url: './endpoints/insertAnswer.php',
method: 'POST', // Change method to GET or POST as needed
data: {answer: inputValue , id: postId},
success: function(response) {
console.log(response)
ele.value = ""
},
error: function(xhr, status, error) {
// Handle error response here
}
});
}
<?php
require_once('global.php');
class answer extends db{
public function insert($description , $aid , $qid , $uid){
$sql = "INSERT INTO answer (Answer_Description ,Answer_Id , Question_Id , upload_user_Id)
values (:desc ,:aid , :qid , :uid)";
$aid = "A0" . strval($aid);
$stmt = $this->con->prepare($sql);
$stmt->bindParam(':desc' , $description);
$stmt->bindParam(':qid' , $qid);
$stmt->bindParam(':aid' , $aid);
$stmt->bindParam(':uid' , $uid);
$stmt->execute();
}
public function getRows(){
$rows = 0;
$rows = $this->con->query('SELECT * FROM answer')->rowCount();
return $rows + 1;
}
public function delete($aid){
$sql = "delete from answer where Answer_Id = :aid";
$stmt = $this->con->prepare($sql);
$stmt->bindParam(':aid' , $aid);
$stmt->execute();
}
}
/component/answer.php
<?php
function answer( $aid,$answer ,$answerDate , $profession , $upvotes=0,$saves=0 , $tag ,
$status , $isHeTheUser=false)
{
$tags = "";
78 | P a g e
Akshar Tours & Travels
80 | P a g e
Akshar Tours & Travels
$canDelete
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
82 | P a g e
Akshar Tours & Travels
[Answer box]
4.9.4. Implementation
- The Save Questions and Answers component displays the saved questions and
answers. It also includes a button for view and remove that question answer from
save using AJAX.
$("#sendIcon").click(function(e){
submitAnswer(e.target);
})
function submitAnswer(ele){
if(ele.value == "") return;
var inputEle;
var postId;
if(ele.tagName == 'INPUT'){
var postElement = $(ele).closest('.mb-5'); // Find parent post element
var idElement = postElement.find('.question-id');
postId = idElement.text(); // Get text content of id element
inputEle = ele;
}else{
var input = ele.parentElement.PreviousElementSibling;
var postElement = $(input).closest('.mb-5'); // Find parent post element
var idElement = postElement.find('.question-id');
postId = idElement.text(); // Get text content of id element
inputEle = ele.PreviousElementSibling;
}
let inputValue = inputEle.value;
$.ajax({
url: './endpoints/insertAnswer.php',
method: 'POST', // Change method to GET or POST as needed
data: {answer: inputValue , id: postId},
success: function(response) {
console.log(response)
ele.value = ""
},
error: function(xhr, status, error) {
// Handle error response here
}
});
}
85 | P a g e
Akshar Tours & Travels
[TPS report]
86 | P a g e
Akshar Tours & Travels
that only authenticated administrators can access the reports. Additionally, the
component updates the statistics every five seconds using Ajax.
4.1.6.1. Code
<main class="main-content position-relative border-radius-lg ">
<div class="container py-4">
<div class="row g-3 justify-content-center align-items-center text-center">
</a href="employee_registration.php"><button type="button" class="btn btn-
primary">Add Employee</button></a>
<?php
// establish database connection
// establish database connection using PDO
$dsn = "mysql:host=localhost;dbname=asq";
$username = "root";
$password = "";
$options = array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
);
try {
$pdo = new PDO($dsn, $username, $password, $options);
} catch (PDOException $e) {
echo "Database connection failed: " . $e->getMessage();
exit;
}
87 | P a g e
Akshar Tours & Travels
$stmt->execute();
$data = $stmt->fetchAll();
// print data in table format using Bootstrap
echo '<table class="table table-bordered">';
echo '<thead>';
echo '<tr>';
echo '<th>Employee Name</th>';
echo '<th>Mobile Number</th>';
echo '<th>Activation Date</th>';
echo '</tr>';
echo '</thead>';
echo '<tbody>';
foreach ($data as $row) {
echo '<tr>';
echo '<td>' . $row['Employee_name'] . '</td>';
echo '<td>' . ($row['Employee_mobile_number'] ?? 0) . '</td>'; // print 0 when NULL
comes
echo '<td>' . $row['Employee_Activation_Date'] . '</td>';
echo '</tr>';
}
echo '</tbody>';
echo '</table>';
?>
</div>
</div>
</main>
4.10.7. data in and out
- A select query is sent to the database server and results are fetched as
associative arrays a processed in the front end.
4.11.About page
4.11.1. Purpose of UI
88 | P a g e
Akshar Tours & Travels
- The page provides information about the website and its Team or creators. This can
include information on the mission or goals of the website, the team behind it, the
history of the site, and contact information. It is typically one of the most visited
pages on a website and is designed to give visitors a sense of who is behind the site
and what they can expect to find on it.
5. Reports
5.1. Employee verification TPS report
5.1.1. Purpose of UI
- The "TPS" component in the AsQ full-stack web application is responsible for
generating a report about the employee verification. The report includes details
such as the employee id, employee name and date.
90 | P a g e
Akshar Tours & Travels
[TPS report]
5.1.4. Implementation
- The "TPS" component is implemented using PHP, HTML, and CSS. It retrieves the
employee, moderator, and user information from the database and generates the
appropriate reports. The reports are displayed on the page using HTML and CSS.
4.1.6.2. Code
<div class="container py-4">
<div class="row g-3 justify-content-center align-items-center text-center">
92 | P a g e
Akshar Tours & Travels
93 | P a g e
Akshar Tours & Travels
94 | P a g e
Akshar Tours & Travels
[MIS report]
5.2.4. Implementation
- The "MIS" component is implemented using PHP, HTML, and CSS. It retrieves the
employee and other necessary information from the database and generates the
appropriate reports. The reports are displayed on the page using HTML and CSS.
95 | P a g e
Akshar Tours & Travels
- The "MIS" component uses PHP to connect to the database and retrieve the
required information. It uses HTML and CSS to create a user-friendly interface for
displaying the reports. The component also utilizes session management to ensure
that only authenticated administrators can access the reports. Additionally, the
component updates the statistics every five seconds using Ajax.
4.1.6.3. Code
<main class="main-content position-relative border-radius-lg ">
<!-- Navbar -->
<?php
require_once('../components/navbar.php');
?>
<?php
// establish database connection using PDO
$dsn = "mysql:host=localhost;dbname=asq";
$username = "root";
$password = "";
$options = array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
);
try {
$pdo = new PDO($dsn, $username, $password, $options);
} catch (PDOException $e) {
echo "Database connection failed: " . $e->getMessage();
exit;
}
// execute the SQL query and store the results in an array
$data = array();
96 | P a g e
Akshar Tours & Travels
</tbody>
</table>
6. Project Testing
6.1. Login functionality
98 | P a g e
Akshar Tours & Travels
2 Empty 2 User clicks Username: "", Error message Error message Pass
Fields "Login" is displayed is displayed
without prompting prompting
entering any Password: "" user to enter user to enter
details valid valid
credentials credentials
3 Invalid 3 User enters Username: john_doe, Error message Error message Pass
Password incorrect Password: is displayed is displayed
password incorrectPassword123 prompting prompting
and clicks user to enter user to enter
"Login" valid valid
credentials credentials
99 | P a g e
Akshar Tours & Travels
5 SQL 5 User enters Username: ' OR 1=1;--, Error message Error message Pass
Injection SQL Password: ' OR 1=1;-- is displayed is displayed
injection prompting prompting
code into user to enter user to enter
login fields valid valid
credentials credentials
100 | P a g e
Akshar Tours & Travels
1 Valid 1 User uploads a Question: "What is Question and Question and Pass
Upload new question the capital of tag are tag are
with valid France?", Tag: successfully successfully
details, "Geography" uploaded and uploaded and
including a can be viewed can be viewed
unique by users by users
question and
appropriate tag
2 Restricted 2 User uploads a Question: "What is Error message Error message Pass
Word question that the best way to is displayed is displayed
contains a cheat on an stating that the stating that
restricted word exam?", Tag: question/tag the
in the question "Cheating" contains a question/tag
or tag restricted word contains a
and cannot be restricted
uploaded word and
cannot be
uploaded
3 Duplicate 3 User uploads a Question: "What is Error message Error message Pass
Question question that the capital of is displayed is displayed
already exists in France?", Tag: stating that the stating that
the system "Geography" question the question
already exists already exists
and cannot be and cannot be
uploaded uploaded
4 Empty 4 User attempts Question: "", Tag: Error message Error message Pass
Fields to upload a "" is displayed is displayed
question prompting user prompting
without to enter a valid user to enter
101 | P a g e
Akshar Tours & Travels
5 Special 5 User uploads a Question: "What is Question and Question and Pass
Characters question or tag the meaning of tag are tag are
containing this symbol: ®?", successfully successfully
special Tag: "Special uploaded and uploaded and
characters or Characters" can be viewed can be viewed
symbols by users by users
102 | P a g e
Akshar Tours & Travels
2 Restricted 2 User uploads an Answer: "The Error message is Error message is Pass
Word answer that best way to displayed stating displayed stating
contains a cheat on an that the answer that the answer
restricted word exam is to use contains a contains a
a cheat sheet." restricted word restricted word
and cannot be and cannot be
uploaded uploaded
3 Empty 3 User attempts Answer: "" Error message is Error message is Pass
Answer to upload an displayed displayed
Field answer without prompting user prompting user
entering any to enter a valid to enter a valid
details answer. answer.
103 | P a g e
Akshar Tours & Travels
Search Box
1 Valid 1 User searches for Search term: System returns System returns Pass
Search a valid term and "Paris" relevant results relevant results
the system related to "Paris" related to
returns the "Paris"
appropriate
results.
2 Restricted 2 User attempts to Search term: Error message is Error message Pass
Word search for a term "How to displayed stating is displayed
Search that contains a cheat on an that the search stating that the
restricted word. exam?" term contains a search term
restricted word contains a
and the search is restricted word
not performed. and the search
is not
performed.
3 Empty 3 User attempts to Search term: Error message is Error message Pass
Search perform a search "" displayed is displayed
Field without entering prompting user prompting user
any search term. to enter a valid to enter a valid
search term. search term.
4 Multiple 4 User enters Search term: System returns System returns Pass
Search multiple search "French relevant results relevant results
104 | P a g e
Akshar Tours & Travels
5 Special 5 User attempts to Search term: System returns System returns Pass
Characters search for a term "What does relevant results relevant results
Search containing ® symbol related to the related to the
special characters mean?" search term search term
or symbols, and "What does ® "What does ®
the system symbol mean?". symbol mean?".
returns the
appropriate
results.
6.5. Summary
6.5.1. Number of Test cases: 4
105 | P a g e