-
Notifications
You must be signed in to change notification settings - Fork 2
/
admin.php
150 lines (137 loc) · 5.08 KB
/
admin.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
<!DOCTYPE html>
<?php
session_start();require 'connect.php';require 'function.php';
//access controlling
if(!isset($_SESSION["memID"]) || !isset($_SESSION["password"])){
header ("location:login.php");
}
if($_SESSION["memID"]!="admin000") {
header ("location:login.php");
}
if(isset($_POST['search'])){
seach_query();
}
?>
<html>
<head><title>Hello, Admin!</title>
<!-- importing bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
body{
width:100%;
height:100%;
background-size:cover;
padding:15px;
}
#one{
width:100%;
height:100%;
background-image:url('navbar.jpg');
background-size:cover;
}
</style>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Admin</a>
</div>
<div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#"><span class="glyphicon glyphicon-tasks"></span> Options<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="change_password.php"><span class="glyphicon glyphicon-pushpin"></span> Change Password</a></li>
<li><a href="login.php"><span class="glyphicon glyphicon-off"></span> Logout</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</nav>
<br>
<br>
<br>
<div class='container'>
<div class="row">
<form action="admin.php" method="post">
<div class='col-md-4'>
<input class='form-control' type='text' name='search_name' value="<?php
if(isset($_SESSION['searched_name'])){echo $_SESSION['searched_name'];}?>">
</div>
<div class="col-md-2">
<input class="form-control" type="submit" name="searchN" value="Search by Name">
</div>
</form>
</div>
<div class='row'>
<h2></h2>
<form action='admin.php' method='post'>
<div class='col-md-4'>
<input class='form-control' type='text' name='search_memID' value="<?php
if(isset($_SESSION['searched_memID'])){echo $_SESSION['searched_memID'];}?>">
</div>
<div class='col-md-2'>
<input class='form-control' type='submit' name='search' value='Search by ID'>
</div>
<div class='col-md-2'>
<input class='form-control' type='button' name='reset_password' onclick="location.href='reset_password.php'" value='Reset Password'>
</div>
</form>
</div>
<h2></h2>
<div class='row'>
<?php if(isset($_POST['search'])){echo "<h1>".seach_query()[0]."</h1><h1>".seach_query()[1]."</h1><h1>".seach_query()[2]."</h1>" ;}?>
</div>
</div>
<?php
$itr1=0;
if(isset($_POST['searchN'])){
$_SESSION['searched_memID']='';
echo "<div class='container'><table class='table table-striped'><thead><tr><th>MembershipID</th><th>Firstname</th><th>Lastname</th><th></th><th></th></tr></thead><tbody>";
$seach_by_name_query="SELECT * FROM `member_details` WHERE Firstname='".$_POST['search_name']."'";
if($is_seach_by_name_query_run=mysqli_query($connect,$seach_by_name_query)){
while($seach_by_name_query_execute=mysqli_fetch_assoc($is_seach_by_name_query_run)){
echo "<tr>";
echo "<td>".$seach_by_name_query_execute['MembershipID']."</td>";
echo "<td>".$seach_by_name_query_execute['Firstname']."</td>";
echo "<td>".$seach_by_name_query_execute['Lastname']."</td>";
if($seach_by_name_query_execute['Pic']!=NULL){
echo "<td><img src = '".$seach_by_name_query_execute['Pic']."' style = 'height:150px;width:150px'></td>";}
else{
echo "<td><img src = 'pics/default.png' style = 'height:150px;width:150px'></td>";}
echo "<td> <a href='advanced_direct_reset.php?direct_searched_memID=".$seach_by_name_query_execute['MembershipID']."' >Reset</a></td>";
$itr1++;
echo "</tr>";
}
}
$seach_by_lname_query="SELECT * FROM `member_details` WHERE Lastname='".$_POST['search_name']."'";
if($is_seach_by_lname_query_run=mysqli_query($connect,$seach_by_lname_query)){
while($seach_by_lname_query_execute=mysqli_fetch_assoc($is_seach_by_lname_query_run)){
echo "<tr>";
echo "<td>".$seach_by_lname_query_execute['MembershipID']."</td>";
echo "<td>".$seach_by_lname_query_execute['Firstname']."</td>";
echo "<td>".$seach_by_lname_query_execute['Lastname']."</td>";
if($seach_by_lname_query_execute['Pic']!=NULL){
echo "<td><img src = '".$seach_by_lname_query_execute['Pic']."' style = 'height:150px;width:150px'></td>";}
else{
echo "<td><img src = 'pics/default.png' style = 'height:150px;width:150px'></td>";}
echo "<td> <a href='advanced_direct_reset.php?direct_searched_memID=".$seach_by_lname_query_execute['MembershipID']."' >Reset</a></td>";
$itr1++;
echo "</tr>";
}
}
echo "</table></div>";
}
?>
</body>
</html>