-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathquery.php
188 lines (159 loc) · 5.49 KB
/
query.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
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<style>
#sidebar{position:relative;margin-top:-20px}
#content{position:relative;margin-left:210px}
@media screen and (max-width: 600px) {
#content {
position:relative;margin-left:auto;margin-right:auto;
}
}
#he{
font-size: 14px;
font-weight: 600;
text-transform: uppercase;
padding: 3px 7px;
color: #fff;
text-decoration: none;
border-radius: 3px;
align:center
}
</style>
</head>
<?php
include 'conn.php';
include 'session.php';
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true) {
?>
<body style="color:black">
<div id="header">
<?php include 'header.php';
?>
</div>
<div id="sidebar">
<?php $active="query"; include 'sidebar.php'; ?>
</div>
<div id="content" >
<div class="content-wrapper">
<div class="container-fluid">
<div class="row">
<div class="col-md-12 lg-12 sm-12">
<h1 class="page-title">User Query</h1>
</div>
</div>
<hr>
<script>
function clickme(){
if(confirm("Do you really Want to Read ?"))
{
document.getElementById("demo").innerHTML = "Read";
<?php
echo '<div class="alert alert-info alert_dismissible"><b><button type="button" class="close" data-dismiss="alert">×</button></b><b>Pending Request "Read".</b></div>';
$que_id = $_GET['id'];
$sql1="update contact_query set query_status='1' where query_id={$que_id}";
$result=mysqli_query($conn,$sql1);
?>
}
}
</script>
<?php
include 'conn.php';
$limit = 10;
if(isset($_GET['page'])){
$page = $_GET['page'];
}else{
$page = 1;
}
$offset = ($page - 1) * $limit;
$count=$offset+1;
$sql= "select * from contact_query LIMIT {$offset},{$limit}";
$result=mysqli_query($conn,$sql);
if(mysqli_num_rows($result)>0) {
?>
<div class="table-responsive">
<table class="table table-bordered" style="text-align:center">
<thead style="text-align:center">
<th style="text-align:center">S.no</th>
<th style="text-align:center">Name</th>
<th style="text-align:center">Email Id</th>
<th style="text-align:center">Mobile Number</th>
<th style="text-align:center">Message</th>
<th style="text-align:center">Posting Date</th>
<th style="text-align:center">Status</th>
<th style="text-align:center">Action</th>
</thead>
<tbody>
<?php
while($row = mysqli_fetch_assoc($result)) { ?>
<tr>
<td><?php echo $count++; ?></td>
<td><?php echo $row['query_name']; ?></td>
<td><?php echo $row['query_mail']; ?></td>
<td><?php echo $row['query_number']; ?></td>
<td><?php echo $row['query_message']; ?></td>
<td><?php echo $row['query_date']; ?></td>
<?php if($row['query_status']==1)
{
?><td>Read<br></td>
<?php } else {?>
<td><a href="query.php?id=<?php echo $row['query_id'];?>" onclick="clickme()"><b id="demo">Pending</b></a><br>
</td>
<?php } ?>
<td id="he" style="width:100px">
<a style="background-color:aqua" href='delete_query.php?id=<?php echo $row['query_id']; ?>'> Delete </a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php } ?>
<div class="table-responsive"style="text-align:center;align:center">
<?php
$sql1 = "SELECT * FROM contact_query";
$result1 = mysqli_query($conn, $sql1) or die("Query Failed.");
if(mysqli_num_rows($result1) > 0){
$total_records = mysqli_num_rows($result1);
$total_page = ceil($total_records / $limit);
echo '<ul class="pagination admin-pagination">';
if($page > 1){
echo '<li><a href="query.php?page='.($page - 1).'">Prev</a></li>';
}
for($i = 1; $i <= $total_page; $i++){
if($i == $page){
$active = "active";
}else{
$active = "";
}
echo '<li class="'.$active.'"><a href="query.php?page='.$i.'">'.$i.'</a></li>';
}
if($total_page > $page){
echo '<li><a href="query.php.php?page='.($page + 1).'">Next</a></li>';
}
echo '</ul>';
}
?>
</div>
</div>
</div>
<?php
} else {
echo '<div class="alert alert-danger"><b> Please Login First To Access Admin Portal.</b></div>';
?>
<form method="post" name="" action="login.php" class="form-horizontal">
<div class="form-group">
<div class="col-sm-8 col-sm-offset-4" style="float:left">
<button class="btn btn-primary" name="submit" type="submit">Go to Login Page</button>
</div>
</div>
</form>
<?php }
?>
</body>
</html>