-
Notifications
You must be signed in to change notification settings - Fork 1
/
connections.php
96 lines (76 loc) · 1.91 KB
/
connections.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
<?php
include_once('./vendor/autoload.php');
\Dotenv\Dotenv::createImmutable(__DIR__)->load();
include './includes/db_conn.php';
include './includes/login_check.php';
// Allow only logged in users to visit this page
login_check(1);
$q = "SELECT * FROM connections WHERE userA_id = {$_SESSION['user_id']} OR userB_id = {$_SESSION['user_id']}";
$res = mysqli_query($db_conn, $q);
if ($res) {
if (mysqli_num_rows($res) > 0) {
while ($r = mysqli_fetch_assoc($res)) {
echo "<pre><code class='prettyprint'>" . json_encode($r) . "</code></pre><br>";
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
@import "https://cdn.rawgit.com/google/code-prettify/master/styles/desert.css";
body {
width: 50%;
margin: 0 auto;
}
@media (max-width: 650px) {
body {
width: 75%;
}
}
@media (max-width: 430px) {
body {
width: 100%;
}
}
code,
.code,
pre {
font-family: 'Source Code Pro';
background: #292929;
color: #fafafa;
font-size: 16px;
padding: 0;
padding: 10px;
}
code:before,
.code:before,
pre:before {
display: block;
width: calc(100%);
margin-left: -3px;
margin-top: -3px;
padding: 3px;
text-transform: uppercase;
content: attr(data-lang);
background: #9baecf;
}
code .o,
.code .o,
pre .o {
color: orange;
}
code .w,
.code .w,
pre .w {
color: white;
}
</style>
</head>
<body>
</body>
</html>