[go: up one dir, main page]

0% found this document useful (0 votes)
86 views43 pages

DBMS Mini Project

This document describes a mini project that demonstrates a simple voting system using HTML, PHP, and a MySQL database. The objectives are to create a voting system where votes are stored in a database to determine the winner. The frontend is done through HTML and PHP, while votes are stored in MySQL tables. The system allows voters to cast their vote by selecting a candidate, which is then stored in the database. An administrator can view the results by accessing a separate HTML file that reads the vote counts from the database tables.

Uploaded by

Nithyashree
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
86 views43 pages

DBMS Mini Project

This document describes a mini project that demonstrates a simple voting system using HTML, PHP, and a MySQL database. The objectives are to create a voting system where votes are stored in a database to determine the winner. The frontend is done through HTML and PHP, while votes are stored in MySQL tables. The system allows voters to cast their vote by selecting a candidate, which is then stored in the database. An administrator can view the results by accessing a separate HTML file that reads the vote counts from the database tables.

Uploaded by

Nithyashree
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

ARJUN S

311520205007

EXP NO: 10 MINI PROJECT :VOTING SYSTEM

DATE: 26.05.2022

OBJECTIVES:

 A Voting system is made using HTML and PHP


 This project uses MySQL database as backend in order to determine the winner of the
election
 A XAMPP localhost server is required to execute this project

ABOUT THE PROJECT:

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">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- The above 3 meta tags *must* come first in the head; any other head content must come
*after* these tags -->

<title>SVS</title>

<!-- Bootstrap -->

<link href="css/bootstrap.min.css" rel="stylesheet">


ARJUN S
311520205007

<link href='http://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'>

<link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>

<link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>

<link href='http://fonts.googleapis.com/css?family=Roboto+Condensed' rel='stylesheet'


type='text/css'>

<style>

.headerFont{

font-family: 'Ubuntu', sans-serif;

font-size: 24px;

.subFont{

font-family: 'Raleway', sans-serif;

font-size: 14px;

.specialHead{

font-family: 'Oswald', sans-serif;

.normalFont{

font-family: 'Roboto Condensed', sans-serif;


ARJUN S
311520205007

</style>

</head>

<body>

<div class="container">

<nav class="navbar navbar-default navbar-fixed-top navbar-inverse

" role="navigation">

<div class="container">

<button type="button" class="navbar-toggle" data-toggle="collapse" data-


target="#example-nav-collapse">

<span class="icon-bar"></span>

<span class="icon-bar"></span>

<span class="icon-bar"></span>

</button>

<div class="navbar-header">

<a href="index.html" class="navbar-brand headerFont text-lg">Simple Voting


System</a>

</div>

</div> <!-- end of container -->

</nav>
ARJUN S
311520205007

<div class="container" style="padding:100px;">

<div class="row">

<div class="col-sm-3"></div>

<div class="col-sm-6" style="border:2px inset gray;">

<div class="page-header">

<h2 class="specialHead text-center">Choose Your Candidate!</h2>

</div>

<form action="saveVote.php" method="POST">

<div class="form-group">

<label>Voter's Full Name :</label><br>

<input type="text" name="voterName" placeholder="Enter Your Full Name"


class="form-control"/><br>

<label>Voter's Registered Email ID :</label><br>

<input type="email" name="voterEmail" placeholder="Enter Your Email ID"


class="form-control"/><br>

<label>Voter's Card Number :</label><br>

<input type="number" name="voterID" placeholder="Enter Your Voter Uniquie ID"


class="form-control"/><br>

<h3 class="normalFont text-center">Selet Any One of Them:</h3>


ARJUN S
311520205007

<div class="radio text-center">

<label for="">

<input type="radio" name="selectedCandidate" value="JM"> <strong>Juliet


Mel</strong>

</label><br>

<label for="">

<input type="radio" name="selectedCandidate" value="JRZ"> <strong>Jaye


Rozanne</strong>

</label><br>

<label for="">

<input type="radio" name="selectedCandidate" value="MAD"> <strong>Mia


Amanda</strong>

</label><br>

<label for="">

<input type="radio" name="selectedCandidate" value="JW"> <strong>John


Walker</strong>

</label><br>

<label for="">

<input type="radio" name="selectedCandidate" value="DM"> <strong>Diggory


Mansel</strong>

</label><br>

<br>

<hr>
ARJUN S
311520205007

<button type="submit" name="submit" class="btn btn-success" style="border-


radius:0%">Submit Votes</button>

<button type="submit" class="btn btn-danger" style="border-


radius:0%">Decline</button>

</div>

</div>

</form>

</div>

<div class="col-sm-3"></div>

</div>

</div>

</div>

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->

<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">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta name="viewport" content="width=device-width, initial-scale=1">


ARJUN S
311520205007

<!-- The above 3 meta tags *must* come first in the head; any other head content must come
*after* these tags -->

<title>SVS</title>

<!-- Bootstrap -->

<link href="css/bootstrap.min.css" rel="stylesheet">

<link href='http://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'>

<link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>

<link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>

<link href='http://fonts.googleapis.com/css?family=Roboto+Condensed' rel='stylesheet'


type='text/css'>

<style>

.headerFont{

font-family: 'Ubuntu', sans-serif;

font-size: 24px;

.subFont{

font-family: 'Raleway', sans-serif;

font-size: 14px;

.specialHead{
ARJUN S
311520205007

font-family: 'Oswald', sans-serif;

.normalFont{

font-family: 'Roboto Condensed', sans-serif;

</style>

</head>

<body>

<div class="container">

<nav class="navbar navbar-default navbar-fixed-top navbar-inverse

" role="navigation">

<div class="container">

<button type="button" class="navbar-toggle" data-toggle="collapse" data-


target="#example-nav-collapse">

<span class="icon-bar"></span>

<span class="icon-bar"></span>

<span class="icon-bar"></span>

</button>

<div class="navbar-header">

<a href="cpanel.php" class="navbar-brand headerFont text-lg">Simple Voting


System</a>

</div>
ARJUN S
311520205007

</div> <!-- end of container -->

</nav>

<div class="container" style="padding-top:70px;">

<h4 class="text-center">Displaying Top 30 Voters</h4>

<div class="row">

<div class="col-sm-12">

<table class="table table-bordered table-hover">

<tr>

<th><strong>Voter's Full Name</strong></th>

<th><strong>E-Mail</strong></th>

<th><strong>Voter ID</strong></th>

</tr>

<?php

require('config.php');

//Establish Connection

$conn= mysqli_connect($hostname, $username, $password, $database);

//Check

if(!$conn)

{
ARJUN S
311520205007

die("Connection Failed : ".mysqli_connect_error());

for ($i=1; $i < 30; $i++) {

$sql= "SELECT * FROM db_evoting.tbl_users where id='".$i."'";

$query= mysqli_query($conn, $sql);

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>

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->

<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">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- The above 3 meta tags *must* come first in the head; any other head content must come
*after* these tags -->

<title>SVS</title>

<!-- Bootstrap -->


ARJUN S
311520205007

<link href="css/bootstrap.min.css" rel="stylesheet">

<link href='http://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'>

<link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>

<link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>

<link href='http://fonts.googleapis.com/css?family=Roboto+Condensed' rel='stylesheet'


type='text/css'>

<style>

body{

margin:0px;

padding:0px;

.headerFont{

font-family: 'Ubuntu', sans-serif;

font-size: 24px;

.subFont{

font-family: 'Raleway', sans-serif;

font-size: 14px;

}
ARJUN S
311520205007

.specialHead{

font-family: 'Oswald', sans-serif;

.normalFont{

font-family: 'Roboto Condensed', sans-serif;

a{

color: #FFFFFF;

text-decoration: none;

a:link {

color: #FFFFFF;

text-decoration: none;

/* visited link */

a:visited {

color: #FFFFFF;

text-decoration: none;

/* mouse over link */


ARJUN S
311520205007

a:hover {

color: #FFFFFF;

text-decoration: none;

/* selected link */

a:active {

color: #FFFFFF;

text-decoration: none;

</style>

</head>

<body>

<div class="container">

<nav class="navbar navbar-default navbar-fixed-top navbar-inverse

" role="navigation">

<div class="container">

<button type="button" class="navbar-toggle" data-toggle="collapse" data-


target="#example-nav-collapse">

<span class="icon-bar"></span>

<span class="icon-bar"></span>

<span class="icon-bar"></span>

</button>
ARJUN S
311520205007

<div class="navbar-header">

<a href="index.html" class="navbar-brand headerFont text-lg">Simple Voting


System</a>

</div>

<div class="collapse navbar-collapse" id="example-nav-collapse">

<ul class="nav navbar-nav">

<li><a href="#featuresTab"><span
class="subFont"><strong>Features</strong></span></a></li>

</ul>

<span class="normalFont"><a href="admin.html" class="btn btn-success navbar-right


navbar-btn" style="border-radius:0%">Admin Panel</a></span>

</div>

</div> <!-- end of container -->

</nav>

</div>

<div class="container-fluid">

<div class="row">

<div class="col-sm-12">
ARJUN S
311520205007

<div class="jumbotron text-center text-block" style="padding-top:170px;">

<img src="images/vote.png" width="220px" alt="Icon">

<h1 class="specialHead">Simple Voting System</h1>

<p class="normalFont">Safe . Reliable . Secure . Fast </p>

<a href="vault.html" class="btn btn-danger btn-lg specialHead" style="border-


radius:60px"> <span class="glyphicon glyphicon-folder-close"></span> Cast Your Votes
Now</a>

</div>

</div>

</div>

</div>

<div class="conatiner" id="featuresTab">

<div class="row">

<div class="col-sm-12 text-center">

<div class="page-header" style="padding-top:50px;padding-bottom:50px">

<h1 class="normalFont" style="font-size:44px;" >WHAT IS IT.</h1>

<p class="subFont" style="font-size:24px;">A Intractive Way To Solve Conventional


Voting</p>

</div>

</div>

</div>

</div>

<div class="conatiner" style="padding:50px;" id="aboutTab">


ARJUN S
311520205007

<div class="row">

<div class="col-sm-4 text-center">

<img src="images/Nominee.png" width="100" height="100" alt=""/>

<h2 class="normalFont" style="font-size:28px;">VOTE ONLINE.</h2>

<p>You Just Need Basic Details of Yours and We Will Let You Vote</p>

</div>

<div class="col-sm-4 text-center">

<img src="images/Vote.png" width="100" height="100" alt=""/>

<h2 class="normalFont" style="font-size:28px;" >NOMINATION</h2>

<p>Admin's Control Panel allows you to manage the list of filled nomination</p>

</div>

<div class="col-sm-4 text-center">

<img src="images/Stats.png" width="100" height="100" alt=""/>

<h2 class="normalFont" style="font-size:28px;" >Statitics</h2>

<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 class="col-sm-6 text-center">

<h3 class="specialHead">Developed By Jeyarish,Adithya,Arjun </h3>

</div>

<div class="col-sm-6 text-center">

<img src="images/Facebook.png" width="50" height="50" alt="">

<img src="images/Twitter.png" width="50" height="50" alt="">

<img src="images/GitHub.png" width="50" height="50" alt="">

</div>

</div>

</div>

</footer>
ARJUN S
311520205007

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->

<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">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- The above 3 meta tags *must* come first in the head; any other head content must come
*after* these tags -->

<title>SVS</title>

<!-- Bootstrap -->

<link href="css/bootstrap.min.css" rel="stylesheet">

<link href='http://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'>

<link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>

<link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>

<link href='http://fonts.googleapis.com/css?family=Roboto+Condensed' rel='stylesheet'


type='text/css'>

<style>
ARJUN S
311520205007

.headerFont{

font-family: 'Ubuntu', sans-serif;

font-size: 24px;

.subFont{

font-family: 'Raleway', sans-serif;

font-size: 14px;

.specialHead{

font-family: 'Oswald', sans-serif;

.normalFont{

font-family: 'Roboto Condensed', sans-serif;

</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">

<nav class="navbar navbar-default navbar-fixed-top navbar-inverse

" role="navigation">

<div class="container">

<button type="button" class="navbar-toggle" data-toggle="collapse" data-


target="#example-nav-collapse">

<span class="icon-bar"></span>

<span class="icon-bar"></span>

<span class="icon-bar"></span>

</button>

<div class="navbar-header">

<a href="index.html" class="navbar-brand headerFont text-lg">Simple Voting


System</a>

</div>

<div class="collapse navbar-collapse" id="example-nav-collapse">

<ul class="nav navbar-nav">

<!--

<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>

<li><a href="#"><span class="subFont"><strong>About</strong></span></a></li>

-->

</ul>

<button type="submit" class="btn btn-success navbar-right navbar-btn" style="border-


radius:0%"><span class="normalFont">Admin Panel</span></button>

</div>

</div> <!-- end of container -->

</nav>

<div class="container" style="padding-top:150px;">

<div class="row">

<div class="col-sm-4"></div>

<div class="col-sm-4" style="border:2px solid gray;padding:50px;">

<div class="page-header">

<h2 class="specialHead text-center">Login Panel</h2>

</div>

<form action="authentication.php" method="POST">

<div class="form-group">

<label for="">Username</label><br>
ARJUN S
311520205007

<input type="text" name="adminUserName" placeholder="Enter


Admin's UserName" class="form-control"><br>

<label for="">Password</label><br>

<input type="password" name="adminPassword" class="form-


control" placeholder="Enter Admin's Password"><br>

<button type="submit" class="btn btn-block span btn-primary"


style="border-radius: 0%;">LOGIN</button>

<label id="error"></label>

</div>

</form>

<br>

</div>

<div class="col-sm-4"></div>

</div>

</div>

</div>

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->

<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">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- The above 3 meta tags *must* come first in the head; any other head content must come
*after* these tags -->

<title>SVS</title>

<!-- Bootstrap -->

<link href="css/bootstrap.min.css" rel="stylesheet">

<link href='http://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'>

<link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>

<link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>

<link href='http://fonts.googleapis.com/css?family=Roboto+Condensed' rel='stylesheet'


type='text/css'>

<style>

.headerFont{

font-family: 'Ubuntu', sans-serif;

font-size: 24px;

}
ARJUN S
311520205007

.subFont{

font-family: 'Raleway', sans-serif;

font-size: 14px;

.specialHead{

font-family: 'Oswald', sans-serif;

.normalFont{

font-family: 'Roboto Condensed', sans-serif;

</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">

<nav class="navbar navbar-default navbar-fixed-top navbar-inverse

" role="navigation">

<div class="container">

<button type="button" class="navbar-toggle" data-toggle="collapse" data-


target="#example-nav-collapse">

<span class="icon-bar"></span>

<span class="icon-bar"></span>

<span class="icon-bar"></span>

</button>

<div class="navbar-header">

<a href="index.html" class="navbar-brand headerFont text-lg">Simple Voting


System</a>

</div>

<div class="collapse navbar-collapse" id="example-nav-collapse">

<ul class="nav navbar-nav">

<!--

<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>

<li><a href="#"><span class="subFont"><strong>About</strong></span></a></li>

-->

</ul>
ARJUN S
311520205007

<button type="submit" class="btn btn-success navbar-right navbar-btn"><span


class="normalFont"><strong>Admin Panel</strong></span></button>

</div>

</div> <!-- end of container -->

</nav>

<div class="container" style="padding-top:150px;">

<div class="row">

<div class="col-sm-4"></div>

<div class="col-sm-4 text-center" style="border:2px solid gray;padding:50px;">

<?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']))

$error= "UserName or Password is Recquired.";

else

$admin_username= test_input($_POST['adminUserName']);

$admin_password= test_input($_POST['adminPassword']);

//Establish Connection

$conn= mysqli_connect($hostname, $username, $password, $database);

//Check

if(!$conn)

die("Connection Failed : ".mysqli_connect_error());


ARJUN S
311520205007

$sql= "SELECT * FROM db_evoting.tbl_admin WHERE


admin_username='".$admin_username."' AND admin_password='".$admin_password."'";

$query= mysqli_query($conn, $sql);

if(mysqli_num_rows($query)==1)

header("location:cpanel.php");

else

$error="Sorry !! Authentication Failed";

echo "<p class='alert alert-danger'><strong>$error</strong></p>";

echo "<p class='normalFont text-primary'><strong>Your Combination of


UserName and Password is In-correct. Better, You contact to the developer of system.</strong>
</p>";

echo "<br><a href='admin.html' class='btn btn-primary'><span class='glyphicon


glyphicon-refresh'></span> <strong>Try Again</strong></a>";

mysqli_close($conn);
ARJUN S
311520205007

?>

</div>

<div class="col-sm-4"></div>

</div>

</div>

</div>

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->

<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">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta name="viewport" content="width=device-width, initial-scale=1">

<!-- 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>

<!-- Bootstrap -->

<link href="css/bootstrap.min.css" rel="stylesheet">

<link href='http://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'>

<link href='http://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>

<link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>

<link href='http://fonts.googleapis.com/css?family=Roboto+Condensed' rel='stylesheet'


type='text/css'>

<style>

.headerFont{

font-family: 'Ubuntu', sans-serif;

font-size: 24px;

.subFont{

font-family: 'Raleway', sans-serif;

font-size: 14px;

.specialHead{

font-family: 'Oswald', sans-serif;


ARJUN S
311520205007

.normalFont{

font-family: 'Roboto Condensed', sans-serif;

</style>

</head>

<body>

<div class="container">

<nav class="navbar navbar-default navbar-fixed-top navbar-inverse

" role="navigation">

<div class="container">

<button type="button" class="navbar-toggle" data-toggle="collapse" data-


target="#example-nav-collapse">

<span class="icon-bar"></span>

<span class="icon-bar"></span>

<span class="icon-bar"></span>

</button>

<div class="navbar-header">

<a href="cpanel.php" class="navbar-brand headerFont text-lg">Simple Voting


System</a>

</div>

<div class="collapse navbar-collapse" id="example-nav-collapse">


ARJUN S
311520205007

<ul class="nav navbar-nav">

<li><a href="nomination.html"><span
class="subFont"><strong>Nominations</strong></span></a></li>

<li><a href="changePassword.php"><span class="subFont"><strong>Change


Password</strong></span></a></li>

<li><a href="users.php"><span
class="subFont"><strong>Voters</strong></span></a></li>

<li><a href="feedbackReport.php"><span class="subFont"><strong>Feedback


Report</strong></span></a></li>

</ul>

<span class="normalFont"><a href="index.html" class="btn btn-danger navbar-right


navbar-btn" style="border-radius:0%">Logout</a></span></button>

</div>

</div> <!-- end of container -->

</nav>

<div class="container" style="padding:100px;">

<div class="row">

<div class="col-sm-12" style="border:2px outset gray;">

<div class="page-header text-center">

<h2 class="specialHead">ADMIN PANEL</h2>


ARJUN S
311520205007

<p class="normalFont">Displaying all voting results</p>

</div>

<div class="col-sm-12">

<?php

require 'config.php';

$JM=0;

$JRZ=0;

$JW=0;

$MAD=0;

$DM=0;

$conn = mysqli_connect($hostname, $username, $password, $database);

if(!$conn)

echo "Error While Connecting.";

else

//JULIET

$sql ="SELECT * FROM tbl_users WHERE voted_for='JM'";

$result= mysqli_query($conn, $sql);


ARJUN S
311520205007

if(mysqli_num_rows($result)>0)

while($row= mysqli_fetch_assoc($result))

if($row['voted_for'])

$JM++;

$jm_value= $JM*10;

echo "<strong>Juliet Mel</strong><br>";

echo "

<div class='progress'>

<div class='progress-bar progress-bar-danger' role='progressbar' aria-


valuenow=\"$jm_value\" aria-valuemin=\"0\" aria-valuemax=\"100\" style='width:
".$jm_value."%'>

<span class='sr-only'>JM</span>

</div>

</div>

";

// ROZANNE

$sql ="SELECT * FROM tbl_users WHERE voted_for='JRZ'";

$result= mysqli_query($conn, $sql);


ARJUN S
311520205007

if(mysqli_num_rows($result)>0)

while($row= mysqli_fetch_assoc($result))

if($row['voted_for'])

$JRZ++;

$jrz_value= $JRZ*10;

echo "<strong>Jaye Rozanne</strong><br>";

echo "

<div class='progress'>

<div class='progress-bar progress-bar-info' role='progressbar' aria-valuenow=\"70\"


aria-valuemin=\"0\" aria-valuemax=\"100\" style='width: ".$jrz_value."%'>

<span class='sr-only'>JRZ</span>

</div>

</div>

";

// JOHN WALKER

$sql ="SELECT * FROM tbl_users WHERE voted_for='JW'";

$result= mysqli_query($conn, $sql);


ARJUN S
311520205007

if(mysqli_num_rows($result)>0)

while($row= mysqli_fetch_assoc($result))

if($row['voted_for'])

$JW++;

$jw_value= $JW*10;

echo "<strong>John Walker</strong><br>";

echo "

<div class='progress'>

<div class='progress-bar progress-bar-warning' role='progressbar' aria-


valuenow=\"70\" aria-valuemin=\"0\" aria-valuemax=\"100\" style='width: ".$jw_value."%'>

<span class='sr-only'>JM</span>

</div>

</div>

";

// MIA

$sql ="SELECT * FROM tbl_users WHERE voted_for='MAD'";


ARJUN S
311520205007

$result= mysqli_query($conn, $sql);

if(mysqli_num_rows($result)>0)

while($row= mysqli_fetch_assoc($result))

if($row['voted_for'])

$MAD++;

$mad_value= $MAD*10;

echo "<strong>Mia Amanda</strong><br>";

echo "

<div class='progress'>

<div class='progress-bar progress-bar-success' role='progressbar' aria-


valuenow=\"70\" aria-valuemin=\"0\" aria-valuemax=\"100\" style='width: ".$mad_value."%'>

<span class='sr-only'>MAD</span>

</div>

</div>

";

// DIGGORY
ARJUN S
311520205007

$sql ="SELECT * FROM tbl_users WHERE voted_for='DM'";

$result= mysqli_query($conn, $sql);

if(mysqli_num_rows($result)>0)

while($row= mysqli_fetch_assoc($result))

if($row['voted_for'])

$DM++;

$dm_value= $DM*10;

echo "<strong>Diggory Mansel</strong><br>";

echo "

<div class='progress'>

<div class='progress-bar progress-bar-primary' role='progressbar' aria-


valuenow=\"70\" aria-valuemin=\"0\" aria-valuemax=\"100\" style='width: ".$dm_value."%'>

<span class='sr-only'>DM</span>

</div>

</div>

";

}
ARJUN S
311520205007

echo "<hr>";

$total=0;

// Total

$sql ="SELECT * FROM tbl_users";

$result= mysqli_query($conn, $sql);

if(mysqli_num_rows($result)>0)

while($row= mysqli_fetch_assoc($result))

if($row['voted_for'])

$total++;

$tptal= $total*10;

echo "

<div class='text-primary text-center'>

<h3 class='normalFont'>TOTAL VOTES : $total </h3>

</div>

";
ARJUN S
311520205007

?>

</div>

</div>

</div>

</div>

</div>

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->

<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

RESULT: Thus the Mini project has been implemented successfully

You might also like