-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnew_messages.php
20 lines (20 loc) · 926 Bytes
/
new_messages.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<div class="ch-container">
<h1>New messages</h1>
<?php
$pdo = new PDO('mysql:host=localhost;dbname=users', 'root', 'pwd');
$query = $pdo->prepare("select * from message where receiver=? and isRead=false order by date");
$query->bindValue(1, openssl_decrypt($_SESSION['token'], "AES-128-CTR", "11112000", 0, "1234567890123456"));
$query->execute();
while ($result = $query->fetch(PDO::FETCH_ASSOC)) {
$q2 = $pdo->prepare("select * from chatters where email=?");
$q2->bindValue(1, $result['receiver']);
$q2->execute();
$r = $q2->fetch();
echo "<a href='dashbord?show=message&with=".$r['id']."' class='ch-element'>
<img src='https://i.pravatar.cc/150?img=69' />
<span>".$r['first_name']." ".$r['last_name']."</span>
<p>".$result['message']."</p>
</a>";
}
?>
</div>