DBMS Mini Project
DBMS Mini Project
311520205007
DATE: 26.05.2022
OBJECTIVES:
This is a project that demonstrates a simple voting system, Frontend is done through HTML
and PHP and the votes are stored in a database in the MySQL Server, The voter has to give
his/her name voter ID and cast their votes, which is then stored in the table present in the
database. An Admin HTML file is used for Administrator login in order to obtain the results of
the voting. The results are obtained using a PHP code which reads all the votes from the table in
the database and increments the vote values accordingly. Hence by combining all these processes
a small scale voting system is made.
SOURCE CODE:
VOTE.HTML
<head>
<meta charset="utf-8">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come
*after* these tags -->
<title>SVS</title>
<style>
.headerFont{
font-size: 24px;
.subFont{
font-size: 14px;
.specialHead{
.normalFont{
</style>
</head>
<body>
<div class="container">
" role="navigation">
<div class="container">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="navbar-header">
</div>
</nav>
ARJUN S
311520205007
<div class="row">
<div class="col-sm-3"></div>
<div class="page-header">
</div>
<div class="form-group">
<label for="">
</label><br>
<label for="">
</label><br>
<label for="">
</label><br>
<label for="">
</label><br>
<label for="">
</label><br>
<br>
<hr>
ARJUN S
311520205007
</div>
</div>
</form>
</div>
<div class="col-sm-3"></div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>
USERS.PHP
<head>
<meta charset="utf-8">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come
*after* these tags -->
<title>SVS</title>
<style>
.headerFont{
font-size: 24px;
.subFont{
font-size: 14px;
.specialHead{
ARJUN S
311520205007
.normalFont{
</style>
</head>
<body>
<div class="container">
" role="navigation">
<div class="container">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="navbar-header">
</div>
ARJUN S
311520205007
</nav>
<div class="row">
<div class="col-sm-12">
<tr>
<th><strong>E-Mail</strong></th>
<th><strong>Voter ID</strong></th>
</tr>
<?php
require('config.php');
//Establish Connection
//Check
if(!$conn)
{
ARJUN S
311520205007
if(mysqli_num_rows($query)>0)
while($row= mysqli_fetch_assoc($query))
$full_name= $row['full_name'];
$email= $row['email'];
$voter_id= $row['voter_id'];
echo "
<tr>
<td>$full_name</td>
<td>$email</td>
<td>$voter_id</td>
</tr>
";
}
ARJUN S
311520205007
mysqli_close($conn);
?>
</table>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>
INDEX.HTML
<head>
<meta charset="utf-8">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come
*after* these tags -->
<title>SVS</title>
<style>
body{
margin:0px;
padding:0px;
.headerFont{
font-size: 24px;
.subFont{
font-size: 14px;
}
ARJUN S
311520205007
.specialHead{
.normalFont{
a{
color: #FFFFFF;
text-decoration: none;
a:link {
color: #FFFFFF;
text-decoration: none;
/* visited link */
a:visited {
color: #FFFFFF;
text-decoration: none;
a:hover {
color: #FFFFFF;
text-decoration: none;
/* selected link */
a:active {
color: #FFFFFF;
text-decoration: none;
</style>
</head>
<body>
<div class="container">
" role="navigation">
<div class="container">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
ARJUN S
311520205007
<div class="navbar-header">
</div>
<li><a href="#featuresTab"><span
class="subFont"><strong>Features</strong></span></a></li>
</ul>
</div>
</nav>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
ARJUN S
311520205007
</div>
</div>
</div>
</div>
<div class="row">
</div>
</div>
</div>
</div>
<div class="row">
<p>You Just Need Basic Details of Yours and We Will Let You Vote</p>
</div>
<p>Admin's Control Panel allows you to manage the list of filled nomination</p>
</div>
<p>SHows You the Graphical Data Representation of your votes. And, It is in Admin's
Control Panel</p>
ARJUN S
311520205007
</div>
</div>
</div>
<hr>
<footer>
<div class="container">
<div class="row">
</div>
</div>
</div>
</div>
</footer>
ARJUN S
311520205007
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>
ADMIN.HTML
<head>
<meta charset="utf-8">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come
*after* these tags -->
<title>SVS</title>
<style>
ARJUN S
311520205007
.headerFont{
font-size: 24px;
.subFont{
font-size: 14px;
.specialHead{
.normalFont{
</style>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
ARJUN S
311520205007
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
" role="navigation">
<div class="container">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="navbar-header">
</div>
<!--
<li><a href="#featuresTab"><span
class="subFont"><strong>Features</strong></span></a></li>
ARJUN S
311520205007
<li><a href="#feedbackTab"><span
class="subFont"><strong>Feedback</strong></span></a></li>
-->
</ul>
</div>
</nav>
<div class="row">
<div class="col-sm-4"></div>
<div class="page-header">
</div>
<div class="form-group">
<label for="">Username</label><br>
ARJUN S
311520205007
<label for="">Password</label><br>
<label id="error"></label>
</div>
</form>
<br>
</div>
<div class="col-sm-4"></div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
ARJUN S
311520205007
<script src="js/bootstrap.min.js"></script>
</body>
</html>
AUTHENTICATION.PHP
<head>
<meta charset="utf-8">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come
*after* these tags -->
<title>SVS</title>
<style>
.headerFont{
font-size: 24px;
}
ARJUN S
311520205007
.subFont{
font-size: 14px;
.specialHead{
.normalFont{
</style>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
ARJUN S
311520205007
<div class="container">
" role="navigation">
<div class="container">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="navbar-header">
</div>
<!--
<li><a href="#featuresTab"><span
class="subFont"><strong>Features</strong></span></a></li>
<li><a href="#feedbackTab"><span
class="subFont"><strong>Feedback</strong></span></a></li>
-->
</ul>
ARJUN S
311520205007
</div>
</nav>
<div class="row">
<div class="col-sm-4"></div>
<?php
// Credentials
$hostname= "localhost";
$username= "root";
$password= "";
$database= "db_evoting";
// UserInput Test
ARJUN S
311520205007
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
$data = mysql_real_escape_string($data);
return $data;
if(empty($_POST['adminUserName']) || empty($_POST['adminPassword']))
else
$admin_username= test_input($_POST['adminUserName']);
$admin_password= test_input($_POST['adminPassword']);
//Establish Connection
//Check
if(!$conn)
if(mysqli_num_rows($query)==1)
header("location:cpanel.php");
else
mysqli_close($conn);
ARJUN S
311520205007
?>
</div>
<div class="col-sm-4"></div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>
CPANE.PHP
<head>
<meta charset="utf-8">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come
*after* these tags -->
ARJUN S
311520205007
<title>SVS</title>
<style>
.headerFont{
font-size: 24px;
.subFont{
font-size: 14px;
.specialHead{
.normalFont{
</style>
</head>
<body>
<div class="container">
" role="navigation">
<div class="container">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="navbar-header">
</div>
<li><a href="nomination.html"><span
class="subFont"><strong>Nominations</strong></span></a></li>
<li><a href="users.php"><span
class="subFont"><strong>Voters</strong></span></a></li>
</ul>
</div>
</nav>
<div class="row">
</div>
<div class="col-sm-12">
<?php
require 'config.php';
$JM=0;
$JRZ=0;
$JW=0;
$MAD=0;
$DM=0;
if(!$conn)
else
//JULIET
if(mysqli_num_rows($result)>0)
while($row= mysqli_fetch_assoc($result))
if($row['voted_for'])
$JM++;
$jm_value= $JM*10;
echo "
<div class='progress'>
<span class='sr-only'>JM</span>
</div>
</div>
";
// ROZANNE
if(mysqli_num_rows($result)>0)
while($row= mysqli_fetch_assoc($result))
if($row['voted_for'])
$JRZ++;
$jrz_value= $JRZ*10;
echo "
<div class='progress'>
<span class='sr-only'>JRZ</span>
</div>
</div>
";
// JOHN WALKER
if(mysqli_num_rows($result)>0)
while($row= mysqli_fetch_assoc($result))
if($row['voted_for'])
$JW++;
$jw_value= $JW*10;
echo "
<div class='progress'>
<span class='sr-only'>JM</span>
</div>
</div>
";
// MIA
if(mysqli_num_rows($result)>0)
while($row= mysqli_fetch_assoc($result))
if($row['voted_for'])
$MAD++;
$mad_value= $MAD*10;
echo "
<div class='progress'>
<span class='sr-only'>MAD</span>
</div>
</div>
";
// DIGGORY
ARJUN S
311520205007
if(mysqli_num_rows($result)>0)
while($row= mysqli_fetch_assoc($result))
if($row['voted_for'])
$DM++;
$dm_value= $DM*10;
echo "
<div class='progress'>
<span class='sr-only'>DM</span>
</div>
</div>
";
}
ARJUN S
311520205007
echo "<hr>";
$total=0;
// Total
if(mysqli_num_rows($result)>0)
while($row= mysqli_fetch_assoc($result))
if($row['voted_for'])
$total++;
$tptal= $total*10;
echo "
</div>
";
ARJUN S
311520205007
?>
</div>
</div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>
OUTPUT
ARJUN S
311520205007
ARJUN S
311520205007