forked from ringelweb/RingelNew
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmsg_buyer.php
167 lines (101 loc) · 5.22 KB
/
msg_buyer.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
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
163
164
165
166
167
<?php
require 'includes/connect.php';
$buyer_user_name=$_SESSION['buyer_user_name'];
$buyerid=$_SESSION['buyerid'];
if(isset($_POST['message_submit']))
{
if (isset($_SESSION['msg_to'])) {
$message_to=$_SESSION['msg_to'];
}
$message_body = $_POST['comment_body'];
if (isset($_SESSION['user_name'])) {
$user_name=$_SESSION['user_name'];
}
echo $message_to;
$query = "INSERT INTO pvt_msgs(_to, _from, message, _read) VALUES ('".$message_to."','".$user_name."','".$message_body."', 'no')";
$insert_message = mysqli_query($con,$query) or die(mysqli_error($con));;
$msg="Message Sent SucccessFully";
header("location:msg.php?msg='".$sellerid."'");
}
?>
<title>Welcome to Home Feed</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://www.w3schools.com/lib/w3-theme-blue-grey.css">
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Open+Sans'>
<body >
<?php include 'includes/header.php';
//$user_name=$_SESSION['user_name'];
//$sellerid=$_SESSION['sellerid'];
?>
<div class="container margin-container">
<?php
$query_notif = "SELECT * FROM pvt_msgs WHERE _to = '".$buyerid."' ";
if($run_query_notif = mysqli_query($con,$query_notif))
{
$no_of_unread_messages = mysqli_num_rows($run_query_notif);
}
$query_notif_badge = "SELECT * FROM pvt_msgs WHERE _to = '".$buyerid."' AND _read = 'no' ";
if($run_query_notif_badge = mysqli_query($con,$query_notif_badge))
{
$no_of_unread_messages_badge = mysqli_num_rows($run_query_notif_badge);
}
?>
<div class="panel panel-primary" style="margin-bottom:250px;" >
<div class="panel-heading panel_heading_height">
<span class="glyphicon glyphicon-comment font-icon" aria-hidden="true"> Inbox</span>
</div>
<div class="panel-body">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Your Inbox!</h4>
</div>
<div class="modal-body">
<!-- form starts here-->
<?php
while($row_messages = mysqli_fetch_array($run_query_notif))
{
?>
<div class="panel panel-warning">
<div class="panel-heading"><strong>From:</strong> <?php echo $row_messages['_from'];
?>
</div>
<div class="panel-body">
<div class="dropdown">
<button class="btn btn-info dropdown-toggle" id ="message_drop" name = "dropdown_button" method="POST" type="button" data-toggle="dropdown">Your Message:
</button>
<ul class="dropdown-toggle">
<li><?php echo $row_messages['message'];
//$msgid = $row_messages['msgid'];
$msgid = $row_messages['msgid'];
$update_query = "UPDATE pvt_msgs SET _read= 'yes' WHERE msgid = '".$msgid."' ";
$run_query_update = mysqli_query($con,$update_query);
?></li>
<button class="btn btn-success"><a href="buyer_profile.php">Mark as read!</a></button>
<a href ="delete_msg.php?id=<?php echo $msgid; ?>"><button type="submit" class="btn btn-danger btn-lg" value="submit" name="delete"><span class='glyphicon glyphicon-trash'></span></button></a>
</ul>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
include("includes/footer.php");
?>
</body>
</html>