-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotifications.php
More file actions
86 lines (79 loc) · 2.84 KB
/
Copy pathnotifications.php
File metadata and controls
86 lines (79 loc) · 2.84 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
<?php
/**
* Created by PhpStorm.
* User: Gabriel
* Date: 03/05/2018
* Time: 14:25
*/
include_once "borders.php";
if (!isset($_SESSION['id'])) {
header("Location: index.php");
exit();
}
$user = null;
?>
<div class="connectionRequests">
<?php
$sql = "SELECT * FROM connectionrequest INNER JOIN user ON IDUser = User1 WHERE User2 = $_SESSION[id]";
$result = mysqli_query($conn, $sql);
while ($rowRequest = mysqli_fetch_assoc($result)) {
//$user = $rowRequest['NameUser'];
?>
<div class="connectionRequest" id="<?php echo $rowRequest['User1'] ?>">
<p><?php echo $rowRequest['NameUser'] ?> wants to add you as a <?php echo $rowRequest['Relationship'] ?>
: </p><br>
<button type="button" class="btn btn-success" id="accept">Accept</button>
<button type="button" class="btn btn-danger" id="decline">Decline</button>
</div>
<?php
}
?>
</div>
<div id="messages">
<?php
$sql = "SELECT * FROM publication INNER JOIN user ON IDUser = publication.User WHERE (publication.DatePublication > user.lastDeconnection) AND IDUser=$_SESSION[id]";
$result = mysqli_query($conn, $sql);
while ($row = mysqli_fetch_assoc($result)) {
?>
<div id="message">
<p style="font-size: medium; font-weight: bold; font-style: normal; color: #007179;"> <i class="glyphicon glyphicon-heart" style="margin-right: 10px;"></i> <?php echo $row['NameUser'] ?> published a new post at <?php echo $row['DatePublication'] ?>
</p>
</div>
<?php
}
?>
</div>
<div id="jquery">
<script>
$(document).ready(function () {
$("#accept").click(function (e) {
e.preventDefault();
e.stopImmediatePropagation();
var id = $(this).parent()[0].id;
//alert(id);
$.ajax({
type: "POST",
url: "acceptConnection.php",
data: {
userID: id
}
}).done(function () {
$(".connectionRequest").hide();
});
});
$("#decline").click(function () {
$.ajax({
type: "POST",
url: "declineConnection.php",
data: {
userID: id
}
}).done(function () {
$(".connectionRequest").hide();
});
});
});
</script>
</div>
<?php
include_once "footer.php";