-
Notifications
You must be signed in to change notification settings - Fork 0
/
EC_read.php
182 lines (161 loc) · 3.89 KB
/
EC_read.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<?php
session_start();
if(!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] === "vote" ||$_SESSION['loggedin'] === "CE" ||$_SESSION['loggedin'] !== "EC"||$_SESSION['loggedin'] === "IT"|| $_SESSION['loggedin']==="dean" ){
header("location: error.php");
exit;
}
include "config.php";
$sql = "SELECT * FROM candidate WHERE Branch='EC'";
if ($result = mysqli_query($link, $sql)) {
if (mysqli_num_rows($result) > 0) {
echo '<table>';
echo "<thead>";
echo "<tr>";
echo "<th>Id</th>";
echo "<th>Name</th>";
echo "<th>Department</th>";
echo "<th>Year</th>";
echo "<th>Votes</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
while ($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>" . $row['Sr'] . "</td>";
echo "<td>" . $row['Name'] . "</td>";
echo "<td>" . $row['Branch'] . "</td>";
echo "<td>" . $row['Year'] . "</td>";
echo "<td>" . $row['vote_count'] . "</td>";
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
mysqli_free_result($result);
} else {
echo '<em>No records were found.</em>';
}
} else {
echo "Oops! Something went wrong. Please try again later.";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CE Read</title>
</head>
<style>
table {
width: 100%;
border-collapse: collapse;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
border-radius: 20px;
overflow: hidden;
}
body{
background-color: rgb(224, 202, 142);
}
th, td {
padding: 12px 15px;
text-align: left;
border-bottom: 1px solid #ddd;
}
th {
background-color: rgb(252, 252,70);
}
tr:nth-child(even) {
background-color: rgb(252, 252, 142);
}
tr:hover {
background-color: rgb(252, 202, 142);
}
th, td:first-child {
border-left: 1px solid #ddd;
}
th, td:last-child {
border-right: 1px solid #ddd;
}
body{
padding: 0;
margin: 0;
background-color: rgb(224, 202, 142);
}
tbody tr:last-child td {
border-bottom: 0;
}
li {
margin-bottom: 10px;
line-height: 1.8;
margin-left: 20px;
}
table{
margin-top: 120px;
}
header {
background-color:blanchedalmond;
color: white;
padding: 20px 0;
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 1000;
}
.home {
background-color: rgb(255, 255, 255);
padding: 20px 10px;
}
.home:hover,
nav ul li a:hover {
background-color: rgb(233, 229, 156);
color: rgb(0, 0, 0);
transition: 0.5s;
padding: 20px 10px;
}
.logo {
height: 50px;
width: 50px;
}
.container {
width: 80%;
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
}
nav ul {
list-style-type: none;
padding: 0;
}
nav ul li {
display: inline;
margin-left: 20px;
}
nav ul li a {
color: rgb(0, 0, 0);
text-decoration: none;
}
h1 {
margin: 0;
color: #000000;
font-family: 'Times New Roman', Times, serif;
}
</style>
<body>
<header>
<div class="container">
<a href="first.php"><img class="logo" src="logo.jpg"></a>
<h1 class="hover-4">ICT Voting Portal</h1>
<nav>
<ul>
<li class="home"><a href="first.php">Sign Up</a></li>
<li><a href="about_page.html">About</a></li>
</li>
<li style="float:right" class="about"><a href="first.php">Log Out</a></li>
</ul>
</nav>
</div>
</header>
</body>
</html>