Professional Documents
Culture Documents
NAAC Accredited
PROJECT REPORT
ON
DEGREE OF
Project Report on
Submitted To:
This paper presents the research and findings of a student registration system at Methodist
University College Ghana. It was found out that students have to be physically present on their
campuses to do registration for the semester, after the payment of fees. With the numerous
alternatives in technological choices, this research sort to find out which alternative would help
eliminate the current difficulties students go through in order to register for the semester. This
paper analyzed this existing system using the waterfall model leading to a design and
development of an online registration system which does not require the physical presence of
students on campus but to remotely register.
1 Introduction
Commitment towards the success of students of higher education can be achieved through
innovations such as flexible scheduling, continuous enrolment, a university-wide academic social
network, online classes, a digital library, computer simulations and online student registration as
well. This innovative approach helps pioneer many of the conveniences of students - a kind of
education that is research-proven to be just as effective as conventional instruction.
At Methodist University College Ghana, just like the other universities, students are enrolled to
pursue a 4-year academic degree program. Some are also enrolled at either 2 nd or 3rd year for a
top-up leading to the award of a degree. Students must pass and obtain the minimum university
admission requirements of the SSSCE/WASSCE exams in order to qualify for admission. Other
admission requirements include a Post-Secondary Diploma or Professional Certifications from a
recognized institution or HND.
An enrolled student is expected to register and pay either full or part of the school fees before he
can take courses every semester. In most cases, enrolling and having to register every semester
involves some manual processes which delay processes for both the university and more
especially the students.
Student registration is done by students mostly at a registration center. Students have to move
physically to campus:
Dansoman, Tema or Wenchi to complete the registration process. In some cases, students
move from Tema to Dansoman campus, about 45 km apart to complete the registration process.
The following are the problems inherent with the current system.
• Students take too much time in processing their registration and worse, this can only be
done with their physical presence on campus.
It is in this regard that this research looks at the student registration system at Methodist
University College Ghana in order to design and develop an online student registration system.
2.1 Introduction
Web development can include a web design, web content development, client liaison, client-
server-side scripting, web server and network security configuration, and e-commerce
development (Rajapakse, 2012). It can range from developing the simplest static single page of
plain text to the most complex web-based internet applications, electronic businesses or social
network services (Rajapakse, 2012). Many organizations and institutions increase their
investment in web-technology and online systems. The scope of web-based applications has
grown enormously and has moved to become a platform that can support all facet of
organizational work (Isakowitz et al., 1998).
For this reason, engineers and IT specialists strive and are still vigilant in combining web
development to the practical application of scientific investigations and research in developing
systems that can support the core business processes of institutions (studymode.com).
An institution without an information system will have no track record of its performance history
or its present status and will be unable to forecast the future of its business. According to
O’Brien & Marakas (2007), the fundamental roles of an information system are to support
business processes, support decision-making by its employees and support strategies for
competitive advantage. Laudon & Laudon (2007) point out that the role of information systems
is to help institutions obtain operational excellence to improve the efficiency of their operations
in order to achieve higher profitability. According to O’Brien & Marakas (2007), information
systems are a major functional area of business that is equally as important to business success as
the functions of accounting, finance and human resources management.
“The internet has opened many possibilities for the classroom instruction but it can also be a
barrier to teaching as well” (Bugeja, 2006). The new innovative technologies provide
opportunities to improve learning and create a more exciting and motivating environment
(Connors, 2007).
According to a case study by Ralph, Buskirk, and Schmidt (2007) regarding the use of online
projects, students in favor of online projects indicated that the accessibility to the professor for
fast and easy feedback was a great asset. Furthermore, the study revealed that when
implementing technology, students were concerned with the expense of the technology, the
necessity for internet access, and the reliability of the technology. Research on student
perceptions and satisfaction with online registration of courses provide insights to student
reactions and satisfaction with implementation of an online registration system. Hale (2007)
found that student satisfaction surveys reveal that the most important reason for taking an online
registration is its convenience.
The “widespread availability of computers and the Internet provide considerable enrichment in
terms of variety of material and formats for presentation over what was possible with the old
correspondence courses” (Walker and Kelly, 2007). The Chronicle for Higher Education (2007)
reported that a university stated that they use electronic education to add on to their curriculum,
not as the main basis. This lends to the implementation of an online service such as a student
registration system to register for courses, take lessons via distant learning and under an exam.
3 Methodology
The data collection instruments used were, Interviews: this was used to solicit information from
students, the faculty officers and staff of the programming unit of MUCG and also, some of the
university’s registration records were examined. DFD, Use Case Diagrams and Sequence
diagrams where used to model the existing and proposed system. PHP and MySQL were the
tools used to develop the system.
Student
Faculty Officer
Studen
t
Detail
s
Student
Details
Enquir
y/
Registration
Complai Registratio
nt Student n
Details
Details Complaints Details
Registration
System
Handled complaints
This is done in the first two weeks of reopening, as a registration center is opened. After that
period, students have to go to the office of the Faculty Officer to be registered. A Student who
does not meet the deadline attracts a penalty depending on the number of days after the deadline,
especially continuing students. For the fresh students, there is a time frame after which you are
not allowed to register.
The current system requires the physical presence of the student on campus. The student goes to
the registration center to continue the registration process after payment of the required fees.
Fresh students go to the programming unit to have their bio data checked and passport
photographs taken before they can go to their respective faculty offices to be registered after two
weeks.
3.1.2 Flowchart of the Current System
Start
Pay fees
Validate payment
Go to Registration Center
New No
Student?
Yes
Go to Programming Unit
Complete Registration
Terminate
The current system accepts payment in cheques and bankers draft from all banks in the country.
However this may take one or two forms reflecting the category of students who are admitted
into the school. The school admits two categories of students: Foreign and Ghanaian students.
The major services charged at the University include: Admission Fees, Registration Fees,
Library Services, Computer User Fees and SRC dues, etc.
3.2 The Proposed System
To obtain information about the student registration system, it was necessary to interview
students, the responsible staff like the Faculty Officers and staff of the Programming Unit.
Getting to know how the University conducts its registration helped flag any apparently unusual
aspects. Understanding the concerns of students helped to incorporate them in the development
of the proposed system.
With the gathered data, a use case diagram was developed to incorporate the actors of the
system. Students and faculty officers play a critical role as actors. It is conceivable that other
actors may be added in subsequent iterations. Fig. 3 shows the use case diagram of the proposed
system.
Student
Registration
Manage
System Login
Prior to the start of the registration, the database is pre-loaded with data pertaining to existing
students. Under some circumstances, it is expected that a small number of new student records
would have to be created during the registration process.
Figure 3.6 depicts the design of the network architecture of the proposed system. This design
serves as a communication between the various components of the system network and how it is
implemented. It is a framework for the specification of the network's physical components and
their functional organization and configuration, its operational principles and procedures.
Administrat
Data Repository or
Serve
r
Internet
4 Design of the Proposed System
There is no more need for opening a registration center to do the registration. A student can
remotely register from any location.
Faculty Officer
Registration
Report Upload/Update
details
Administrator
Receipt
Registration Report
Student
Registration Details
Fig. 5: Context Diagram of the Proposed System
Get
Student
Faculty Officer
Pay Fees
Update
Register for the
semester
Get Registration
Administrator
This is the main and the most important subsystem of the web portal. The system can manage
the registration activities in real time thereby solving the registration problems inherent with
the current system.
A student after making payment of fees at the bank is given a receipt with a code. He needs
this code when doing the registration to validate his payment. Students are able to register on
their own anywhere and not having to come to campus if this new system is implemented.
This eliminates the long queues and pressures of the old system.
The registration process is a vital component of the system, and must be transparent to the
end users. The student gets two reports as feedback; a confirmation of registration and a
confirmation of payment.
Registration System
Student
Open
Database
Registration
Page
EnterData
CheckDuplication
CalculatedFees
Update Data
Confirm Print
Report Update
Looking at the System's sequence diagram, it's clear that there are three means of
communication between system users and the registration system. The first communication
method is by using the reporting subsystem which issues different types of reports as
demanded. Another method is by updates done by system's administrator, and viewed by
Faculty Officers. The last method is by using the System Repository. It is a tool that enables
students to download files necessary for managing their school activities. Such files include
the payment history, bills for next semester, course registration confirmation and program of
study.
Users of the system may link to the latest regulations and news issued by MUCG authorities
and can also download various files. Files are uploaded by a user with administrator
privileges having different formats: PDF and DOC.
The system utilizes codeigniter framework which makes it necessary to build system
components and objects. This system was developed using PHP as the webpage design tool
in combination with HTML as the technology that provides the necessary coding behind the
web pages. The application connects to MySQL Server database, which plays the role of the
RDBMS associated with the application. Users of the system can run the application through
their internet browsers, such as IE v6 or higher.
RAM : 32MB
Hard Disk : 5 GB
Monitor :16LG
The main features of php is; it is open source scripting language so you can free download
this and use. PHP is a server site scripting language. It is open source scripting language.
It is widely used all over the world. It is faster than other scripting language. Some
important features of php are given below;
Features of php
It is most popular and frequently used world wide scripting language, the main reason of
popularity is; It is open source and very simple.
Simple
Faster
Interpreted
Open Source
Case Sensitive
Simplicity
Efficiency
Platform Independent
Security
Flexibility
Familiarity
Error Reporting
It is very simple and easy to use, compare to other scripting language it is very simple and
easy, this is widely used all over the world.
Interpreted
Faster
Open Source
Open source means you no need to pay for use php, you can free download and use.
Platform Independent
PHP code will be run on every platform, Linux, Unix, Mac OS X, Windows.
Case Sensitive
PHP is case sensitive scripting language at time of variable declaration. In PHP, all
keywords (e.g. if, else, while, echo, etc.), classes, functions, and user-defined functions
are NOT case-sensitive.
Error Reporting
PHP have some predefined error reporting constants to generate a warning or error notice.
PHP provides access logging by creating the summary of recent accesses for the user.
PHP supports variable usage without declaring its data type. It will be taken at the time of
the execution based on the type of data it has on its value.
XAMPP is a software distribution which provides the Apache web server, MySQL database
(actually MariaDB), Php and Perl (as command-line executables and Apache modules) all in
one package. It is available for Windows, MAC and Linux systems. No configuration is
necessary to integrate Php with MySQL.
It is a great fit for this course and provides a relatively painless installation and way to
manage the configuration changes. Also provided is PhpMyadmin which gives a GUI tool for
managing your MySQL databases.
I would highly recommend installing this for Windows or MAC. It doesn't exclude you from
other competing software installations, it just gives an easy way to get going. For Ubuntu
Linux systems, I still would recommend installing Apache/MySQL/Php/PhpMyadmin
through Ubuntu packages.
https://www.apachefriends.org/
For the MAC, we use the non-vm version which you can find in the Downloads menu link
of the site. In particular avoid the version with "-vm" as part of the file name.
Windows
xampp-win32-7.3.0-0-VC15-installer.exe
Install in the usual way. It gives some notification messages for which you can just click OK.
Close whatever installation brings upon completion. It installs into
C:\xampp
At some point the Windows Firewall may invoke notifications; just click Allow access and
then Finish.
What you want to run is the XAMPP Control Panel found under XAMPP in the Start menu.
Right-click and run this as administrator.
Start both MySQL and Apache (unless you have an alternative Apache installation). I do not
recommend messing with the Modules service column. When you start MySQL, you should
see it running on port 3306. The Apache service gives you access to the Admin buttons next
to the services. For Apache Admin, you get:
http://localhost/dashboard
http://localhost/phpmyadmin
C:\xampp\mysql\bin
The most important one is the client program mysql.exe. From a command shell you can run:
If you want to create other databases, or users, or alter passwords, you have to be
the root user. To do so:
C:\xampp\mysql\bin\mysql
You might want to make it usable simply as mysql. Here are two ways to do so.
1. The best solution is to put the directory into your PATH. Start from Control Panel ⇾
System and Security and access:
System ⇾ Advanced System Settings ⇾ Advanced ⇾ Environment Variables
Find the Path variable in the System Variables. Select it and click Edit. It's best
to prepend the new Path component with this addition:
C:\xampp\mysql\bin;
The Home button on a Microsoft keyboard is a good way to get to the beginning of
the Path expression. Alternatively, you can append the new Path component as:
;C:\xampp\mysql\bin
Then "OK" your way out.
2. Another way is to make a convenience batch executable in the directory where your
shell opens up into (it should be your home directory). Go to your home
directory C:\Users\YOUR_LOGIN (or wherever your shell opens into) and create the
file
3. mysql.bat
Make sure file extensions are shown. Create an empty text file (New Text
Document.txt) and rename the whole file to mysql.bat (Windows will complain!).
Make the contents be:
@echo off
C:\xampp\mysql\bin\mysql %*
With either of these in place, start a new command shell and test it by running
> mysql
CODING
INDEX.PHP
<?php
session_start();
include "dbconnect.php";
if (isset($_GET['Message'])) {
print '<script type="text/javascript">
alert("' . $_GET['Message'] . '");
</script>';
}
if (isset($_GET['response'])) {
print '<script type="text/javascript">
alert("' . $_GET['response'] . '");
</script>';
}
if(isset($_POST['submit']))
{
if($_POST['submit']=="login")
{
$username=$_POST['login_username'];
$password=$_POST['login_password'];
$query = "SELECT * from users where UserName ='$username' AND
Password='$password'";
$result = mysqli_query($con,$query)or die(mysql_error());
if(mysqli_num_rows($result) > 0)
{
$row = mysqli_fetch_assoc($result);
$_SESSION['user']=$row['UserName'];
print'
<script type="text/javascript">alert("successfully logged in!!!");</script>
';
}
else
{ print'
<script type="text/javascript">alert("Incorrect Username Or Password!!");</script>
';
}
}
else if($_POST['submit']=="register")
{
$username=$_POST['register_username'];
$password=$_POST['register_password'];
$query="select * from users where UserName = '$username'";
$result=mysqli_query($con,$query) or die(mysql_error);
if(mysqli_num_rows($result)>0)
{
print'
<script type="text/javascript">alert("username is taken");</script>
';
}
else
{
$query ="INSERT INTO users VALUES ('$username','$password')";
$result=mysqli_query($con,$query);
print'
<script type="text/javascript">
alert("Successfully Registered!!!");
</script>
';
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Books">
<meta name="author" content="Shivangi Gupta">
<title>Online Bookstore</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/my.css" rel="stylesheet">
<style>
.modal-header {background:#D67B22;color:#fff;font-weight:800;}
.modal-body{font-weight:800;}
.modal-body ul{list-style:none;}
.modal .btn {background:#D67B22;color:#fff;}
.modal a{color:#D67B22;}
.modal-backdrop {position:inherit !important;}
#login_button,#register_button{background:none;color:#D67B22!important;}
#query_button {position:fixed;right:0px;bottom:0px;padding:10px 80px;
background-color:#D67B22;color:#fff;border-color:#f05f40;border-
radius:2px;}
@media(max-width:767px){
#query_button {padding: 5px 20px;}
}
</style>
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top navbar-inverse">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-
target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#" style="padding: 1px;"><img class="img-
responsive" alt="Brand" src="img/logo.jpg" style="width: 147px;margin: 0px;"></a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<?php
if(!isset($_SESSION['user']))
{
echo'
<li>
<button type="button" id="login_button" class="btn btn-lg" data-toggle="modal"
data-target="#login">Login</button>
<div id="login" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-
dismiss="modal">×</button>
<h4 class="modal-title text-center">Login Form</h4>
</div>
<div class="modal-body">
<form class="form" role="form" method="post"
action="index.php" accept-charset="UTF-8">
<div class="form-group">
<label class="sr-only" for="username">Username</label>
<input type="text" name="login_username" class="form-
control" placeholder="Username" required>
</div>
<div class="form-group">
<label class="sr-only" for="password">Password</label>
<input type="password" name="login_password"
class="form-control" placeholder="Password" required>
</div>
<div class="form-group">
<button type="submit" name="submit" value="login"
class="btn btn-block">
Sign in
</button>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-
dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</li>
<li>
<button type="button" id="register_button" class="btn btn-lg" data-toggle="modal"
data-target="#register">Sign Up</button>
<div id="register" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-
dismiss="modal">×</button>
<h4 class="modal-title text-center">Member Registration Form</h4>
</div>
<div class="modal-body">
<form class="form" role="form" method="post" action="index.php"
accept-charset="UTF-8">
<div class="form-group">
<label class="sr-only" for="username">Username</label>
<input type="text" name="register_username" class="form-
control" placeholder="Username" required>
</div>
<div class="form-group">
<label class="sr-only" for="password">Password</label>
<input type="password" name="register_password"
class="form-control" placeholder="Password" required>
</div>
<div class="form-group">
<button type="submit" name="submit" value="register"
class="btn btn-block">
Sign Up
</button>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-
dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</li>';
}
else
{ echo' <li> <a href="#" class="btn btn-lg"> Hello ' .$_SESSION['user']. '.</a></li>
<li> <a href="cart.php" class="btn btn-lg"> Cart </a> </li>;
<li> <a href="destroy.php" class="btn btn-lg"> LogOut </a> </li>';
}
?>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<div id="top" >
<div id="searchbox" class="container-fluid" style="width:112%;margin-left:-6%;margin-
right:-6%;">
<div>
<form role="search" method="POST" action="Result.php">
<input type="text" class="form-control" name="keyword"
style="width:80%;margin:20px 10% 20px 10%;" placeholder="Search for a Book , Author
Or Category">
</form>
</div>
</div>
</ul>
</div>
<div class="col-md-6 col-lg-6">
<div id="myCarousel" class="carousel slide carousel-fade" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
<li data-target="#myCarousel" data-slide-to="3"></li>
<li data-target="#myCarousel" data-slide-to="4"></li>
<li data-target="#myCarousel" data-slide-to="5"></li>
</ol>
<div class="item">
<img class="img-responsive "src="img/carousel/2.jpg">
</div>
<div class="item">
<img class="img-responsive" src="img/carousel/3.jpg">
</div>
<div class="item">
<img class="img-responsive"src="img/carousel/4.jpg">
</div>
<div class="item">
<img class="img-responsive" src="img/carousel/5.jpg">
</div>
<div class="item">
<img class="img-responsive" src="img/carousel/6.jpg">
</div>
</div>
</div>
</div>
<div class="col-md-3 col-lg-3" id="offer">
<a href="Product.php?value=Regional%20Books"> <img class="img-
responsive center-block" src="img/offers/1.png"></a>
<a href="Product.php?value=Health%20and%20Cooking"> <img
class="img-responsive center-block" src="img/offers/2.png"></a>
<a href="Product.php?value=Academic%20and%20Professional"> <img
class="img-responsive center-block" src="img/offers/3.png"></a>
</div>
</div>
</div>
</div>
<footer style="margin-left:-6%;margin-right:-6%;">
<div class="container-fluid">
<div class="row">
<div class="col-sm-1 col-md-1 col-lg-1">
</div>
<div class="col-sm-7 col-md-5 col-lg-5">
<div class="row text-center">
<h2>Let's Get In Touch!</h2>
<hr class="primary">
<p>Still Confused? Give us a call or send us an email and we will get back to
you as soon as possible!</p>
</div>
<div class="row">
<div class="col-md-6 text-center">
<span class="glyphicon glyphicon-earphone"></span>
<p>123-456-6789</p>
</div>
<div class="col-md-6 text-center">
<span class="glyphicon glyphicon-envelope"></span>
<p>BookStore@gmail.com</p>
</div>
</div>
</div>
<div class="hidden-sm-down col-md-2 col-lg-2">
</div>
<div class="col-sm-4 col-md-3 col-lg-3 text-center">
<h2 style="color:#D67B22;">Follow Us At</h2>
<div>
<a href="https://twitter.com/strandbookstore">
<img title="Twitter" alt="Twitter" src="img/social/twitter.png" width="35"
height="35" />
</a>
<a href="https://www.linkedin.com/company/strand-book-store">
<img title="LinkedIn" alt="LinkedIn" src="img/social/linkedin.png"
width="35" height="35" />
</a>
<a href="https://www.facebook.com/strandbookstore/">
<img title="Facebook" alt="Facebook" src="img/social/facebook.png"
width="35" height="35" />
</a>
<a href="https://plus.google.com/111917722383378485041">
<img title="google+" alt="google+" src="img/social/google.jpg" width="35"
height="35" />
</a>
<a href="https://www.pinterest.com/strandbookstore/">
<img title="Pinterest" alt="Pinterest" src="img/social/pinterest.jpg" width="35"
height="35" />
</a>
</div>
</div>
</div>
</div>
</footer>
<div class="container">
<!-- Trigger the modal with a button -->
<button type="button" id="query_button" class="btn btn-lg" data-toggle="modal" data-
target="#query">Ask query</button>
<!-- Modal -->
<div class="modal fade" id="query" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header text-center">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Ask your query here</h4>
</div>
<div class="modal-body">
<form method="post" action="query.php" class="form" role="form">
<div class="form-group">
<label class="sr-only" for="name">Name</label>
<input type="text" class="form-control" placeholder="Your Name"
name="sender" required>
</div>
<div class="form-group">
<label class="sr-only" for="email">Email</label>
<input type="email" class="form-control" placeholder="abc@gmail.com"
name="senderEmail" required>
</div>
<div class="form-group">
<label class="sr-only" for="query">Message</label>
<textarea class="form-control" rows="5" cols="30" name="message"
placeholder="Your Query" required></textarea>
</div>
<div class="form-group">
<button type="submit" name="submit" value="query" class="btn btn-
block">
Send Query
</button>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-
dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
if(isset($_POST['submit']))
{
if($_POST['submit']=="login")
{
$username=$_POST['login_username'];
$password=$_POST['login_password'];
$query = "SELECT * from users where UserName ='$username' AND
Password='$password'";
$result = mysqli_query($con,$query)or die(mysql_error());
if(mysqli_num_rows($result) > 0)
{
$row = mysqli_fetch_assoc($result);
$_SESSION['user']=$row['UserName'];
header("Location: index.php?login=" . "Successfully Logged In");
}
else
echo "Incorrect username or password";
}
}
?>
PRODUCT.PHP
<?php
session_start();
if(!isset($_SESSION['user']))
header("location: index.php?Message=Login To Continue");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Books">
<meta name="author" content="Shivangi Gupta">
<title>Online Bookstore</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/my.css" rel="stylesheet">
<style>
#books {margin-bottom:50px;}
</head>
<body>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<?php
if(isset($_SESSION['user']))
{
echo'
<li><a href="cart.php" class="btn btn-md"><span class="glyphicon glyphicon-
shopping-cart">Cart</span></a></li>
<li><a href="destroy.php" class="btn btn-md"> <span class="glyphicon
glyphicon-log-out">LogOut</span></a></li>
';
}
?>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<?php
include "dbconnect.php";
if(isset($_GET['value']))
{
$_SESSION['category']=$_GET['value'];
}
$category=$_SESSION['category'];
if(isset($_POST['sort']))
{
if($_POST['sort']=="price")
{ $query = "SELECT * FROM products WHERE Category='$category' ORDER
BY Price";
$result = mysqli_query ($con,$query)or die(mysqli_error($con));
?>
<script type="text/javascript">
document.getElementById('select').Selected=$_POST['sort'];
</script>
<?php
}
else
if($_POST['sort']=="priceh")
{ $query = "SELECT * FROM products WHERE Category='$category' ORDER
BY Price DESC";
$result = mysqli_query ($con,$query)or die(mysqli_error($con));
}
else
if($_POST['sort']=="discount")
{ $query = "SELECT * FROM products WHERE Category='$category' ORDER
BY Discount DESC";
$result = mysqli_query ($con,$query)or die(mysqli_error($con));
}
else
if($_POST['sort']=="discountl")
{ $query = "SELECT * FROM products WHERE Category='$category' ORDER
BY Discount";
$result = mysqli_query ($con,$query)or die(mysqli_error($con));
}
}
else
{ $query = "SELECT * FROM products WHERE Category='$category'";
$result = mysqli_query ($con,$query)or die(mysqli_error($con));
}
$i=0;
echo '<div class="container-fluid" id="books">
<div class="row">
<div class="col-xs-12 text-center" id="heading">
<h2 style="color:rgb(228, 55, 25);text-transform:uppercase;margin-bottom:0px;">
'. $category .' STORE </h2>
</div>
</div>
<div class="container fluid">
<div class="row">
<div class="col-sm-5 col-sm-offset-6 col-md-5 col-md-offset-7 col-lg-4 col-lg-
offset-8">
<form action="';echo $_SERVER['PHP_SELF'];echo'" method="post"
class="pull-right">
<label for="sort">Sort by  :  </label>
<select name="sort" id="select" onchange="form.submit()">
<option value="default" name="default"
selected="selected">Select</option>
<option value="price" name="price">Low To High Price </option>
<option value="priceh" name="priceh">Highest To Lowest Price
</option>
<option value="discountl" name="discountl">Low To High Discount
</option>
<option value="discount" name="discount">Highest To Lowest
Discount</option>
</select>
</form>
</div>
</div>
</div>';
if(mysqli_num_rows($result) > 0)
{
while($row = mysqli_fetch_assoc($result))
{
$path="img/books/" .$row['PID'].".jpg";
$description="description.php?ID=".$row["PID"];
if($i%4==0)
echo '<div class="row">';
echo'
<a href="'.$description.'">
<div class="col-sm-6 col-md-3 col-lg-3 text-center">
<div class="book-block" style="border :3px solid #DEEAEE;">
<img class="book block-center img-responsive" src="'.$path.'">
<hr>
' . $row["Title"] . '<br>
' . $row["Price"] .'  
<span style="text-decoration:line-through;color:#828282;"> ' .
$row["MRP"] .' </span>
<span class="label label-warning">'. $row["Discount"] .'%</span>
</div>
</div>
</a> ';
$i++;
if($i%4==0)
echo '</div>';
}
}
echo '</div>';
?>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>
<!--
<script>
$('#my_select').change(function() {
// assign the value to a variable, so you can test to see if it is working
var selectVal = $('#my_select :selected').val();
alert(selectVal);
});
</script>
-->
REGISTER.PHP
<?php
include "dbconnect.php";
if(isset($_POST['submit']))
{
if($_POST['submit']=="register")
{
$username=$_POST['register_username'];
$password=$_POST['register_password'];
$query="select * from users where UserName = '$username'";
$result=mysqli_query($con,$query) or die(mysql_error);
if(mysqli_num_rows($result)>0)
{
header("Location: index.php?register=" . "Username is already taken...Use different
username");
}
else
{
$query ="INSERT INTO users VALUES ('$username','$password')";
$result=mysqli_query($con,$query);
header("Location: index.php?register=" . "Successfully Registered!!");
}
}
}
?>
ADMIN.PHP
<?php
$title = "Administration section";
require_once "./template/header.php";
?>
<?php
require_once "./template/footer.php";
?>
BOOK.PHP
<?php
session_start();
$book_isbn = $_GET['bookisbn'];
// connecto database
require_once "./functions/database_functions.php";
$conn = db_connect();
$row = mysqli_fetch_assoc($result);
if(!$row){
echo "Empty book";
exit;
}
$title = $row['book_title'];
require "./template/header.php";
?>
<!-- Example row of columns -->
<p class="lead" style="margin: 25px 0"><a href="books.php">Books</a> > <?php echo
$row['book_title']; ?></p>
<div class="row">
<div class="col-md-3 text-center">
<img class="img-responsive img-thumbnail" src="./bootstrap/img/<?php echo
$row['book_image']; ?>">
</div>
<div class="col-md-6">
<h4>Book Description</h4>
<p><?php echo $row['book_descr']; ?></p>
<h4>Book Details</h4>
<table class="table">
<?php foreach($row as $key => $value){
if($key == "book_descr" || $key == "book_image" || $key == "publisherid" || $key
== "book_title"){
continue;
}
switch($key){
case "book_isbn":
$key = "ISBN";
break;
case "book_title":
$key = "Title";
break;
case "book_author":
$key = "Author";
break;
case "book_price":
$key = "Price";
break;
}
?>
<tr>
<td><?php echo $key; ?></td>
<td><?php echo $value; ?></td>
</tr>
<?php
}
if(isset($conn)) {mysqli_close($conn); }
?>
</table>
<form method="post" action="cart.php">
<input type="hidden" name="bookisbn" value="<?php echo $book_isbn;?>">
<input type="submit" value="Purchase / Add to cart" name="cart" class="btn btn-
primary">
</form>
</div>
</div>
<?php
require "./template/footer.php";
?>
CART.PHP
<?php
// the shopping cart needs sessions, to start one
/*
Array of session(
cart => array (
book_isbn (get from $_POST['book_isbn']) => number of
books
),
items => 0,
total_price => '0.00'
)
*/
session_start();
require_once "./functions/database_functions.php";
require_once "./functions/cart_functions.php";
// book_isbn got from form post method, change this place later.
if(isset($_POST['bookisbn'])){
$book_isbn = $_POST['bookisbn'];
}
if(isset($book_isbn)){
// new iem selected
if(!isset($_SESSION['cart'])){
// $_SESSION['cart'] is associative array that bookisbn => qty
$_SESSION['cart'] = array();
$_SESSION['total_items'] = 0;
$_SESSION['total_price'] = '0.00';
}
if(!isset($_SESSION['cart'][$book_isbn])){
$_SESSION['cart'][$book_isbn] = 1;
} elseif(isset($_POST['cart'])){
$_SESSION['cart'][$book_isbn]++;
unset($_POST);
}
}
<?php
// the shopping cart needs sessions, to start one
/*
Array of session(
cart => array (
book_isbn (get from $_GET['book_isbn']) => number of books
),
items => 0,
total_price => '0.00'
)
*/
session_start();
require_once "./functions/database_functions.php";
// print out header here
$title = "Checking out";
require "./template/header.php";
$isbn = trim($_POST['isbn']);
$title = trim($_POST['title']);
$author = trim($_POST['author']);
$descr = trim($_POST['descr']);
$price = floatval(trim($_POST['price']));
$publisher = trim($_POST['publisher']);
require_once("./functions/database_functions.php");
$conn = db_connect();
PURCHASE.PHP
<?php
session_start();
$_SESSION['err'] = 1;
foreach($_POST as $key => $value){
if(trim($value) == ''){
$_SESSION['err'] = 0;
}
break;
}
if($_SESSION['err'] == 0){
header("Location: checkout.php");
} else {
unset($_SESSION['err']);
}
$_SESSION['ship'] = array();
foreach($_POST as $key => $value){
if($key != "submit"){
$_SESSION['ship'][$key] = $value;
}
}
require_once "./functions/database_functions.php";
// print out header here
$title = "Purchase";
require "./template/header.php";
// connect database
if(isset($_SESSION['cart']) && (array_count_values($_SESSION['cart']))){
?>
<table class="table">
<tr>
<th>Item</th>
<th>Price</th>
<th>Quantity</th>
<th>Total</th>
</tr>
<?php
foreach($_SESSION['cart'] as $isbn => $qty){
$conn = db_connect();
$book = mysqli_fetch_assoc(getBookByIsbn($conn,
$isbn));
?>
<tr>
<td><?php echo $book['book_title'] . " by " . $book['book_author']; ?
></td>
<td><?php echo "$" . $book['book_price']; ?></td>
<td><?php echo $qty; ?></td>
<td><?php echo "$" . $qty * $book['book_price']; ?></td>
</tr>
<?php } ?>
<tr>
<th> </th>
<th> </th>
<th><?php echo $_SESSION['total_items']; ?></th>
<th><?php echo "$" . $_SESSION['total_price']; ?></th>
</tr>
<tr>
<td>Shipping</td>
<td> </td>
<td> </td>
<td>20.00</td>
</tr>
<tr>
<th>Total Including Shipping</th>
<th> </th>
<th> </th>
<th><?php echo "$" . ($_SESSION['total_price'] + 20); ?></th>
</tr>
</table>
<form method="post" action="process.php" class="form-horizontal">
<?php if(isset($_SESSION['err']) && $_SESSION['err'] == 1){ ?>
<p class="text-danger">All fields have to be filled</p>
<?php } ?>
<div class="form-group">
<label for="card_type" class="col-lg-2 control-label">Type</label>
<div class="col-lg-10">
<select class="form-control" name="card_type">
<option value="VISA">VISA</option>
<option value="MasterCard">MasterCard</option>
<option value="American Express">American Express</option>
</select>
</div>
</div>
<div class="form-group">
<label for="card_number" class="col-lg-2 control-label">Number</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="card_number">
</div>
</div>
<div class="form-group">
<label for="card_PID" class="col-lg-2 control-label">PID</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="card_PID">
</div>
</div>
<div class="form-group">
<label for="card_expire" class="col-lg-2 control-label">Expiry Date</label>
<div class="col-lg-10">
<input type="date" name="card_expire" class="form-control">
</div>
</div>
<div class="form-group">
<label for="card_owner" class="col-lg-2 control-label">Name</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="card_owner">
</div>
</div>
<div class="form-group">
<div class="col-lg-10 col-lg-offset-2">
<button type="reset" class="btn btn-default">Cancel</button>
<button type="submit" class="btn btn-primary">Purchase</button>
</div>
</div>
</form>
<p class="lead">Please press Purchase to confirm your purchase, or Continue
Shopping to add or remove items.</p>
<?php
} else {
echo "<p class=\"text-warning\">Your cart is empty! Please make sure you
add some books in it!</p>";
}
if(isset($conn)){ mysqli_close($conn); }
require_once "./template/footer.php";
?>
ADMIN BOOK.PHP
<?php
session_start();
require_once "./functions/admin.php";
$title = "List book";
require_once "./template/header.php";
require_once "./functions/database_functions.php";
$conn = db_connect();
$result = getAll($conn);
?>
<p class="lead"><a href="admin_add.php">Add new book</a></p>
<a href="admin_signout.php" class="btn btn-primary">Sign out!</a>
<table class="table" style="margin-top: 20px">
<tr>
<th>ISBN</th>
<th>Title</th>
<th>Author</th>
<th>Image</th>
<th>Description</th>
<th>Price</th>
<th>Publisher</th>
<th> </th>
<th> </th>
</tr>
<?php while($row = mysqli_fetch_assoc($result)){ ?>
<tr>
<td><?php echo $row['book_isbn']; ?></td>
<td><?php echo $row['book_title']; ?></td>
<td><?php echo $row['book_author']; ?></td>
<td><?php echo $row['book_image']; ?></td>
<td><?php echo $row['book_descr']; ?></td>
<td><?php echo $row['book_price']; ?></td>
<td><?php echo getPubName($conn, $row['publisherid']); ?></td>
<td><a href="admin_edit.php?bookisbn=<?php echo
$row['book_isbn']; ?>">Edit</a></td>
<td><a href="admin_delete.php?bookisbn=<?php echo
$row['book_isbn']; ?>">Delete</a></td>
</tr>
<?php } ?>
</table>
<?php
if(isset($conn)) {mysqli_close($conn);}
require_once "./template/footer.php";
?>