-
Notifications
You must be signed in to change notification settings - Fork 0
/
crud_laws.php
315 lines (257 loc) · 10.3 KB
/
crud_laws.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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
<?php
session_start();
if(!isset($_SESSION['admin'])){
echo "You are logged out!";
header('location:index.php');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//Dp XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/Dp/xhtml1-transitional.dp">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Add/Modify Laws</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<link id="pagestyle" rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.slim.min.js"></script>
<script type="text/javascript" src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.bundle.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<link href="https://fonts.googleapis.com/css?family=Open+Sans&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/footer.css">
<link rel="stylesheet" href="css/more_nav.css">
<link rel="shortcut icon" type="image/jpg" href="./images/logo.jpeg"/>
<link rel="stylesheet" href="navigation/styles.css">
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script type="text/javascript" src="navigation/script.js"></script>
<script type="text/javascript">
function changesheet(sheet) {
document.getElementById('pagestyle').setAttribute('href', sheet);
}
</script>
<style>
.content {
margin: 0;
padding: 1rem 4rem;
display: flex;
flex-direction: column;
align-items: center;
}
.row_flex {
display: flex;
flex-direction: row;
align-items: baseline;
justify-content: space-evenly;
}
.selector {
margin: 0.8rem;
}
.title1 {
color: #e59719;
font-size: 1.5rem;
text-decoration: underline;
font-family: 'Open Sans';
}
.title2 {
color: #e59719;
font-size: 2rem;
text-decoration: underline;
font-family: 'Open Sans';
margin: 0.2rem auto 1.5rem auto;
}
table {
text-align: center;
}
.clause_col {
text-align: justify;
}
th {
white-space: nowrap;
}
th.cntr,
td.cntr {
vertical-align: middle;
}
td a {
margin: 0.2rem;
text-decoration: none;
color: white;
}
td a:hover {
text-decoration: none;
color: white;
}
form {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 0.2rem;
}
.btn {
color: white;
font-size: 0.8rem;
border-radius: 0.5rem;
margin: 0rem 0.4rem;
cursor: pointer;
}
td form {
display: flex;
flex-direction: row;
justify-content: space-evenly;
}
</style>
</head>
<body>
<div class="top-header">
<div class="container">
<div class="row">
<div class="col-md-4 col-12 text-md-left text-center leftmy">
<ul class="top_nav1">
<li><i class="fa fa-calendar"></i> <span id="datedisplay"></span></li>
<li><i class="fa fa-clock-o"></i> <span id="clockDisplay"></span></li>
</ul>
</div>
<div class="col-md-8 col-12 text-md-right text-center righthd">
<ul class="top_nav">
<li><a href="logout.php"><i class="fa fa-reply-all"></i> Logout</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="header">
<div class="container">
<div class="row">
<div class="logo"><a href="#"><img src="images/embnew.jpg" /></a></div>
<div class="col-md-6 h_right text-right">
</div>
</div>
</div>
</div>
<div id="myheader" class="main_navigation">
<div class="container">
<div class="row">
<div id='cssmenu'>
<ul>
<li><a href="admin_welcome1.php">Home</a></li>
<li><a href="admin_profile.php">Profile</a></li>
<li><a href="appointjudges.php">Appoint Judges</a></li>
<li class='active'><a href="crud_laws.php"> Add/Modify Laws</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="content" id="content_id">
<h3 class="title2">Code of Law</h3>
<table class="table table-hover table-bordered">
<thead class="thead-dark">
<tr>
<th scope="col">#</th>
<th scope="col">Chapter</th>
<th scope="col">Section & Division</th>
<th scope="col">Clause</th>
<th scope="col">Action</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row"></th>
<th scope="row"></th>
<th scope="row"></th>
<th scope="row" id="clause_0"></th>
<th>
<a href="./add_law.php" role="button" class="btn btn-success btn-small ">Add Law</a>
</th>
</tr>
<?php
// Username is root
$user = 'root';
$password = '';
// Database name is gfg
$database = 'INDIAN_JUDICIARY';
// Server is localhost with
// port number 3308
$servername = 'localhost';
$mysqli = new mysqli(
$servername,
$user,
$password,
$database
);
// Checking for connections
if ($mysqli->connect_error) {
die('Connect Error (' .
$mysqli->connect_errno . ') ' .
$mysqli->connect_error);
}
// SQL query to select data from database
$sql_laws = "SELECT * FROM LAWS order by Chapter, Section_Division ;";
$result_laws = $mysqli->query($sql_laws);
$counter = 1;
while ($row_laws = $result_laws->fetch_assoc()) {
?>
<tr>
<th scope="row" class="cntr"><?php echo $counter++; ?></th>
<td scope="row" class="cntr"><?php echo $row_laws['Chapter'] ?></td>
<td scope="row" class="cntr"><?php echo $row_laws['Section_Division'] ?></td>
<td scope="row" class="clause_col cntr"><?php echo $row_laws['Clause'] ?></td>
<td scope="row" class="row_flex cntr">
<form action="./edit_law.php" method="post">
<?php echo '
<input type="hidden" value=\'' . $row_laws['Chapter'] . '\' name="chap">
<input type="hidden" value=\'' . $row_laws['Section_Division'] . '\' name="sdiv">
<input type="hidden" value=\'' . $row_laws['Clause'] . '\' name="clprev">
<button type="submit" class="btn btn-warning btn-small" name="modify" onclick="location.href = \'./edit_law.php\';">Edit</button>'; ?>
</form>
<form action="./delete_law.php" method="post">
<?php echo '
<input type="hidden" value=\'' . $row_laws['Chapter'] . '\' name="chap">
<input type="hidden" value=\'' . $row_laws['Section_Division'] . '\' name="sdiv">
<input type="hidden" value=\'' . $row_laws['Clause'] . '\' name="clprev">
<button type="submit" class="btn btn-danger btn-small" name="delete" onclick="return confirm(\'Are you sure you want to continue?\');">Delete</button>'; ?>
</form>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<div id="sub-footer">
<div class="container">
<div class="row">
<div class="col-md-9">
<div class="copyright">
<p>
<span>Designed by T Naga Tarun, Ajay Vikram P, Aniketh Narayan Bellala</span>
</p>
</div>
</div>
</div>
</div>
</div>
<script>
window.onscroll = function() {
myFunction()
};
var header = document.getElementById("myheader");
var sticky = header.offsetTop;
function myFunction() {
if (window.pageYOffset > sticky) {
header.classList.add("sticky");
} else {
header.classList.remove("sticky");
}
}
</script>
<script src="js/main.js"></script>
<script src="js/font.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
</body>
</html>