-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshared_passwords.php
196 lines (164 loc) · 7.62 KB
/
shared_passwords.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
<?php
error_reporting(E_ALL ^ E_WARNING);
error_reporting(E_ERROR | E_PARSE);
?>
<?php
session_start();
if ($_SESSION['passed_user_email'] === NULL){
header('Location: login.php');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Shared | Password Manager</title>
<link rel = "icon" href = "img/titleicon.png" type = "image/x-icon">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<style>
.navbar-nav {
margin-left: auto;
}
</style>
<body>
<?php include 'themenav0.php'; ?>
<?php
// Check if the user is logged in
session_start();
if (isset($_SESSION['passed_user_email'])) {
// User is logged in, display "My Account" and "Logout"
echo '
<li class="nav-item">
<a class="nav-link" href="home.php">Home</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="shared_passwords.php">Shared Passwords</a>
</li>
<li class="nav-item">
<a class="nav-link" href="password_generator.php">Password Generator</a>
</li>
<li class="nav-item">
<a class="nav-link" href="myaccount.php">My Account</a>
</li>
<li class="nav-item">
<a class="nav-link" href="logout.php">Logout</a>
</li>
';
}
?>
<?php include 'themenav1.php'; ?>
<div class="container-fluid">
<table class="table table-striped">
<thead>
<h2>Shared with Me</h2>
<hr style="background-color:gray">
</thead>
<tbody>
<!-- table body -->
<?php
include 'sql_conn.php';
$loggedinusermailid = $_SESSION['passed_user_email'];
$sql = "SELECT * from shared_accounts where tosharedemailid = '$loggedinusermailid' and deleteflag = 0";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "<tr style='background-color: rgb(60, 210, 255);'> ";
echo "<th>Group</th> ";
echo "<th>App</th> ";
echo "<th>User</th> ";
echo "<th>Actions</th> ";
echo "</tr> ";
while($row = $result->fetch_assoc()){
$vaultfetcheduniqueid = $row['sharedaccountuniqueid'];
$sqlvault = "SELECT * from vault where UniqueId = '$vaultfetcheduniqueid' and DeleteFlag = 0";
$sqlvaultresult = $conn->query($sqlvault);
if ($sqlvaultresult->num_rows > 0) {
while($sqlvaultrow = $sqlvaultresult->fetch_assoc()){
echo "<tr style='background-color: #D6EEEE;'>";
echo "<td>" . $sqlvaultrow['GroupName'] . "</td>";
echo "<td>" . $sqlvaultrow['AppName'] . "</td>";
echo "<td>" . $sqlvaultrow['UserName'] . "</td>";
echo "<td> <a href='view_password.php?id=" . $sqlvaultrow['UniqueId'] . "' class='btn btn-primary'>View</a> </td>";
echo "</tr>";
}
}
}
} else {
echo "<tr><td colspan='5'> <div class='alert alert-danger alert-dismissible' role='alert'> No Accounts found. </div> </td></tr>";
}
?>
</tbody>
</table>
<table class="table table-striped">
<thead>
<h2>Shared with Others</h2>
<hr style="background-color:gray">
</thead>
<tbody>
<!-- table body -->
<?php
include 'sql_conn.php';
$loggedinusermailid = $_SESSION['passed_user_email'];
$sql1 = "SELECT * from shared_accounts where fromsharedemailid = '$loggedinusermailid' and deleteflag = 0";
$result1 = $conn->query($sql1);
if ($result1->num_rows > 0) {
echo "<tr style='background-color: rgb(60, 210, 255);'> ";
echo "<th>Group</th> ";
echo "<th>App</th> ";
echo "<th>User</th> ";
echo "<th>Shared with</th> ";
echo "<th>Actions</th> ";
echo "</tr> ";
while($roww = $result1->fetch_assoc()){
$vaultfetcheduniqueid = $roww['sharedaccountuniqueid'];
$sqlvault1 = "SELECT * from vault where UniqueId = '$vaultfetcheduniqueid' and DeleteFlag = 0";
$sqlvaultresult1 = $conn->query($sqlvault1);
if ($sqlvaultresult1->num_rows > 0) {
while($sqlvaultroww = $sqlvaultresult1->fetch_assoc()){
echo "<tr style='background-color: #D6EEEE;'>";
echo "<td>" . $sqlvaultroww['GroupName'] . "</td>";
echo "<td>" . $sqlvaultroww['AppName'] . "</td>";
echo "<td>" . $sqlvaultroww['UserName'] . "</td>";
echo "<td>" . $roww['tosharedemailid'] . "</td>";
echo "<td> <a href='delete_share.php?id=" . $sqlvaultroww['UniqueId'] . $roww['tosharedemailid'] . "' class='btn btn-danger'>Unshare</a> </td>";
echo "</tr>";
}
}
}
} else {
echo "<tr><td colspan='6'> <div class='alert alert-danger alert-dismissible' role='alert'> No Accounts found. </div> </td></tr>";
}
?>
</tbody>
</table>
<hr>
<footer>
<div class="container">
<div class="row">
<div class="col-md-6">
<p> Password Manager </p>
</div>
<div class="col-md-6">
<p>
<?php
$sqlversion = "SELECT AppVersion FROM version ORDER BY AppVersion DESC LIMIT 1";
$resultversion = $conn->query($sqlversion);
if ($resultversion->num_rows > 0) {
while ($row = $resultversion->fetch_assoc()) {
$AppVersion = $row['AppVersion'];
}
}
echo $AppVersion;
?>
</p>
</div>
</div>
</div>
</footer>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</body>
</html>