-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontacts.php
More file actions
162 lines (141 loc) · 4.83 KB
/
Copy pathcontacts.php
File metadata and controls
162 lines (141 loc) · 4.83 KB
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
<?php
include('includes/header.php');
?>
<section class="contactcards mt-5 px-5">
<div class="infobar">
<p>
<?php
$conn = new mysqli($servername, $username, $password, $dbname);
$sql = 'SELECT c.phone, c.email, c.name, u.profile_pic, u.id FROM contacts c JOIN users u ON(c.email=u.email) WHERE saved_in='.$_SESSION['id'];
$contacts = $conn->query($sql);
if ($contacts->num_rows > 0) {
// output data of each row
echo '
<span> '.$contacts->num_rows.' contact(s)</span>
</p>
</div>
<div class="contacts">
<span class="add"></span>
<table id="contacts_card" border="0">
<thead>
<tr>
<th>Name</th>
<th>Contact</th>
</tr>
</thead>
<tbody>';
while($row = $contacts->fetch_assoc()) {
echo '
<tr>
<td class="pe-2">
<img src="'.$row["profile_pic"].'" alt="'.$row["name"].'" class="avatar"> '.$row["name"].'
</td>
<td class="pe-2">
<a href="mailto:'.$row["email"].'"><button class="btn btn-pink"><i class="far fa-envelope"></i></button></a>
<a href="tel:+91'.$row["phone"].'"><button class="btn btn-pink"><i class="fas fa-phone-alt"></i></button></a>
<a href="chat.php?with='.$row["id"].'"><button class="btn btn-pink"><i class="far fa-comment-dots"></i></button></a>
</td>
</tr>
';
}
}
else {
echo "You don't have any contacts saved. Please <a href='add-contact.php'>add a contact</a>.";
}
?>
</tbody>
</table>
</div>
</section>
<style>
@import url("https://fonts.googleapis.com/css?family=Montserrat:400,800,600");
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body,
html {
font-family: "Montserrat", sans-serif;
}
.avatar {
vertical-align: middle;
width: 50px;
height: 50px;
border-radius: 50%;
}
section.contactcards {
background: #f8f9fb;
}
section.contactcards .infobar p {
font-size: 16px;
color: #000;
font-weight: 600;
}
section.contactcards .contacts {
position: relative;
margin: 20px 0;
}
section.contactcards .contacts span.add {
position: absolute;
right: 10px;
cursor: pointer;
}
section.contactcards .contacts span.add svg {
color: #777;
}
section.contactcards .contacts table {
width: 100%;
border-collapse: collapse;
}
section.contactcards .contacts table thead {
border-bottom: 10px solid #f8f9fb;
}
section.contactcards .contacts table thead th {
text-transform: uppercase;
text-align: left;
font-size: 12px;
color: #777;
font-weight: 600;
}
section.contactcards .contacts table tbody tr {
border-radius: 3px;
border-bottom: 10px solid #f8f9fb;
}
section.contactcards .contacts table tbody tr td {
font-size: 14px;
color: #000;
font-weight: 600;
padding: 30px 0px;
background: #fff;
border: 0px;
margin: 0px;
}
section.contactcards .contacts table tbody tr td span.label {
display: inline-block;
background: #ededfb;
color: #8a88d6;
padding: 5px 12px;
border-radius: 12px;
}
section.contactcards .contacts table tbody tr td span.label:not(:last-child) {
margin-right: 10px;
}
section.contactcards .contacts table tbody tr td:first-child {
padding-left: 10px;
}
</style>
</main><!-- End #main -->
<!-- Vendor JS Files -->
<script src="assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="assets/vendor/glightbox/js/glightbox.min.js"></script>
<script src="assets/vendor/isotope-layout/isotope.pkgd.min.js"></script>
<script src="assets/vendor/php-email-form/validate.js"></script>
<script src="assets/vendor/swiper/swiper-bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.3/dist/umd/popper.min.js" integrity="sha384-W8fXfP3gkOKtndU4JGtKDvXbO53Wy8SZCQHczT5FMiiqmQfUpWbYdTil/SxwZgAN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-/bQdsTh/da6pkI1MST/rWKFNjaCP5gBSY4sEBT38Q/9RBh9AH40zEOg7Hlq2THRZ" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.min.js" integrity="sha384-skAcpIdS7UcVUC05LJ9Dxay8AXcDYfBJqt1CJ85S/CFujBsIzCIv+l9liuYLaMQ/" crossorigin="anonymous"></script>
<!-- Template Main JS File -->
<script src="assets/js/main.js"></script>
</body>
</html>