-
Notifications
You must be signed in to change notification settings - Fork 1
/
messages.php
105 lines (58 loc) · 1.31 KB
/
messages.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
<?php
session_start();
if (!isset($_SESSION['sess_user'])) {
header ("location:index.php");
}
$servername = "localhost";
$username = "root";
$password = ".Rubberband12.";
$dbname = "thecdpda_thecounsellor.io";
$conn = new mysqli ($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$id = $_SESSION['sess_user'];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset ="UTF-8">
<title>Messages - TheCounsellor</title>
<meta name="description" content="Website for Counselling">
<meta name="author" content="Maaz">
<meta name="viewport" content="width=device-width, inital-scale=1, maximum-scale=1">
<link rel="shortcut icon" href="images/icon.png">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<?php include "header.php"; ?>
<br>
<div>
<?php
$users=array();
$query ="SELECT haash, sender, receiver FROM message_group WHERE sender ='$id' OR receiver='$id'";
$result = $conn->query($query);
$j = 1;
while ($row=$result->fetch_assoc())
{
$haash=$row["haash"];
$sender=$row["sender"];
$receiver=$row["receiver"];
if ($sender == $id)
{
$select_id = $receiver;
}
else
{
$select_id = $sender;
}
if(! array_search($select_id, $users)){
$users[] = $select_id;
}
$j++;
}
?>
<br>
<br>
<br>
<br>