-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviewaccount.php
146 lines (128 loc) · 4.06 KB
/
viewaccount.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
<?php
include('config.php');
include('class/userClass.php');
$userClass = new userClass();
$userDetails=$userClass->userDetails($_SESSION['uid']);
include('session.php');
include('session2.php');
$userDetails=$userClass->userDetails($session_uid);
if ($_SESSION['uid']!="8888")
{
$url=BASE_URL.'home.php';
header("Location: $url");
}
?>
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html lang="en">
<head>
<link rel="stylesheet" type="text/css" href="css/style.css"/>
<?php
include "head.php";
?>
<title>SIT</title>
</head>
<body>
<?php
include "navbar.php";
?>
<main class="container">
<div class="settings">
<h1>Administrator Settings</h1>
</div>
<div class="part6">
<br>
<h4><b>Search User</b></h4>
<form method=POST action="viewaccount.php" class="container form-content" name="user">
<div class="form-row">
<div class="form-group col-lg-12">
<input class="form-control" type="text" id="uname" name="uname"
maxlength="45" placeholder="Enter Username" onkeyup="lettersOnly(this)" aria-label="Search">
</div>
<div class="form-group col-lg-12">
<button type="submit" class="btn btn-secondary btn-sm" value="yes" name="user">Find User</button>
</div>
</div>
</form>
</div>
<div>
<?php
$conn=mysqli_connect("localhost","sqldev","password","project");
if(isset($_POST["user"])) {
if($_POST["user"]=="yes") {
$username = $_POST['uname'];
$query=$conn->prepare("select * from project.users WHERE username=?");
$query->bind_param('s',$username);
$query->execute();
$query->bind_result($uid,$username,$password,$email,$name,$profile_pic,$google_auth_code );
echo "<table class='table'>";
echo "<thead>";
echo "<tr>";
echo "<th scope='col'>UID</td>";
echo "<th scope='col'>Email</td>";
echo "<th scope='col'>Name</td>";
echo "<th scope='col'>Edit</td>";
echo "<th scope='col'>Delete</td>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
while($query->fetch())
{
echo "<tr>";
echo "<td>".$uid."</td>";
echo "<td>".$email."</td>";
echo "<td>".$username."</td>";
echo "<td><a href='edituser.php?operation=edit&uid=".$uid."&username=".$username."&email=".$email."'>edit</a></td>";
echo "<td><a href='delete2.php?operation=delete&uid=".$uid."'>Delete</a></td>";
echo "</tr>";
}
echo "</tbody>";
}
echo "</table>";
}
?>
<br>
<br>
</div>
<script>
// Accordion
function myAccFunc() {
var x = document.getElementById("demoAcc");
if (x.className.indexOf("w3-show") == -1) {
x.className += " w3-show";
} else {
x.className = x.className.replace(" w3-show", "");
}
}
// Click on the "Jeans" link on page load to open the accordion for demo purposes
document.getElementById("myBtn").click();
// Script to open and close sidenav
function w3_open() {
document.getElementById("mySidenav").style.display = "block";
document.getElementById("myOverlay").style.display = "block";
}
function w3_close() {
document.getElementById("mySidenav").style.display = "none";
document.getElementById("myOverlay").style.display = "none";
}
var deleteAcc = document.getElementById('deleteAcc');
window.onclick = function(event) {
if (event.target == deleteAcc) {
deleteAcc.style.display ="none";
}
}
</script>
</main>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<div id="footer">
<?php
include "footer.php";
?>
</div>
</div>
</body>
</html>