-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadminPanel.php
More file actions
185 lines (162 loc) · 7.04 KB
/
adminPanel.php
File metadata and controls
185 lines (162 loc) · 7.04 KB
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
183
184
185
<?php session_start(); ?>
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>Admin Panel</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link rel='stylesheet' type='text/css' media='screen' href='adminPanel.css'>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src='main.js'></script>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<style>
.card1 {
padding: 20px;
background: #fff;
border-radius: 5px;
box-shadow: 5px 6px 15px lightseagreen;
/* margin-bottom: 1rem; */
}
.card {
padding: 20px;
}
</style>
<body>
<?php include 'adminPanelnav.php'; ?>
<?php
$conn = mysqli_connect('localhost', 'root', '', 'voting_system');
$select = "select * from admin where Username='$User'";
$run = mysqli_query($conn, $select);
$row_user = mysqli_fetch_array($run);
$FullName = $row_user['FullName'];
$Query = "select * from register ";
$run1 = mysqli_query($conn, $Query);
$row1 = mysqli_fetch_array($run1);
$Status = $row1['Status'];
?>
<div class="content">
<h2>Profile :</h2>
<?php echo date('D,d-M-y h:i:s A '); ?>
<hr>
<div class="main-body">
<div class="row gutters-sm">
<div class="col-md-4 mb-3">
<div class="card1">
<div class="card-body">
<div class="d-flex flex-column align-items-center text-center">
<img src="Images/jaydip.png" alt="Admin" class="rounded-circle" width="150">
<div class="mt-3">
<h4 style="text-transform: capitalize;"><?php echo $FullName; ?></h4>
<p class="text-secondary mb-1">Administrator</p>
<a href="adminPanel.php?str=<?php echo $Status ?>" class="btn btn-primary">Voting <?php echo $Status ?></a>
<a href="adminPanel.php?stp=<?php echo $Status ?>" class="btn btn-danger">Voting Stop</a>
<!-- =========================Voting Start======================= -->
<?php
if (isset($_GET['str'])) {
$str_Status = $_GET['str'];
$update = "update register set Status='ON' where Status='$str_Status'";
$run_str = mysqli_query($conn, $update);
if ($run_str === true) {
echo "<div style='color:green;text-align:center;'>Voting Start Successfully </div> ";
} else {
echo "<div style='color:red;text-align:center;'>Try Again</div>" . mysqli_error($conn);
}
}
?>
<!-- =========================Voting Stop======================= -->
<?php
if (isset($_GET['stp'])) {
$stp_Status = $_GET['stp'];
$update = "update register set Status='OFF' where Status='$stp_Status'";
$run_stp = mysqli_query($conn, $update);
if ($run_stp === true) {
echo "<div style='color:green;text-align:center;'>Voting Stop Successfully</div> ";
} else {
echo "<div style='color:red;text-align:center;'>Try Again</div>" . mysqli_error($conn);
}
}
?>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-8">
<div class="card mb-3">
<div class="card-body">
<div class="row">
<div class="col-sm-3">
<h5 class="mb-0">Full Name</h5>
</div>
<div class="col-sm-9 text-secondary" style="text-transform: capitalize;">
<?php echo $FullName; ?>
</div>
</div>
<hr>
<div class="row">
<div class="col-sm-3">
<h5 class="mb-0">Email</h5>
</div>
<div class="col-sm-9 text-secondary">
<?php echo "$User"; ?>
</div>
</div>
<hr>
<div>
<a href="addadmin.php" class="btn btn-primary" style="float: right;">Add New Admin</a>
</div>
</div>
</div>
</div>
</div>
</div><br>
<hr><br>
<!-- ==============form for Nominee================================ -->
<form action="" method="POST" enctype="multipart/form-data">
<h4 style="font-weight: bold;">Add Candidate :</h4>
<hr>
<label for="FullName"><b>Full Name</b></label>
<input type="text" placeholder="Enter Name" name="FullName" required>
<label for="PartyName"><b>Party Name</b></label>
<input type="text" placeholder="Enter Party Name" name="PartyName" required>
<label for="Email"><b>Email</b></label>
<input type="text" placeholder="Enter Email" name="Email" required>
<label for="DOB"><b>Date of Birth</b></label>
<input type="date" placeholder="Enter Date of Birth" name="DOB" required><br>
<label for="MobileNo"><b>Mobile No</b></label>
<input type="number" placeholder="Enter Mobile NO" name="MobileNo" required><br>
<label for="AadharNo"><b>Aaadhar No</b></label>
<input type="number" placeholder="Enter Aadhar No" name="AadharNo" required><br>
<label for="Image"><b>Custom Image</b></label>
<input type="file" name="Image" accept="/Image*/">
<hr>
<button type="submit" name="submit" class="btn btn-success" style="float: right;width: 120px;margin-left: 20px;">Register</button>
<button type="reset" class="btn btn-primary" style="float: right;width: 120px;">Reset</button>
</form>
<!-- ==========form PHP=========== Nominee ADD=================== -->
<?php
$conn = mysqli_connect("localhost", "root", "", "voting_system");
if (isset($_POST['submit'])) {
$FullName = $_POST['FullName'];
$PartyName = $_POST['PartyName'];
$Email = $_POST['Email'];
$DOB = $_POST['DOB'];
$MobileNo = $_POST['MobileNo'];
$AadharNo = $_POST['AadharNo'];
$Image = $_FILES['Image']['name'];
$tmp_name = $_FILES['Image']['tmp_name'];
$insert = "insert into nominee(FullName,PartyName,Email,DOB,MobileNo,AadharNo,Image,Votes,Status)values('$FullName','$PartyName','$Email','$DOB','$MobileNo','$AadharNo','$Image',0,'OFF')";
$run = mysqli_query($conn, $insert);
if ($run === true) {
echo "<H5 style='color:green;text-align:center;'>Successfully Inseted</h5>";
move_uploaded_file($tmp_name, "upload/$Image");
} else {
echo "<H5 style='color:red;text-align:center;'>Not Inseted Alredy Added</h5>"; //.mysqli_error($conn)
}
}
?>
</div>
</body>
</html>