-
Notifications
You must be signed in to change notification settings - Fork 0
/
my_messages.php
221 lines (192 loc) · 7.43 KB
/
my_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
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<?php
session_start();
include('includes/connection.php');
include('functions/function.php');
if(!isset($_SESSION['user_email']))
{
header("location: index.php");
}
else
{
?>
<!DOCTYPE html>
<html>
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Theme CSS -->
<link href="css/freelancer.css" rel="stylesheet">
<!-- Custom Fonts -->
<link href="vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic" rel="stylesheet" type="text/css">
<head>
<title>Welcome <?php echo $_SESSION['user_email'] ;?></title>
</head>
<style>
.contents
{
background-color: #4c5a68;
height:100vh;
}
#user_timeline
{background-color:white;
border:2px solid black;
height:100vh;
}
#post_style
{
border:1px black solid;
margin:10px;
}
hr {
display: block;
margin-top: 0.5em;
margin-bottom: 0.5em;
margin-left: auto;
margin-right: auto;
border-style: inset;
border-width: 2px;
}
</style>
<body>
<?php include('home_header.php'); ?>
<div class="container contents">
<div class="row" style='background-color:white;'>
<div class="col-md-3 col-lg-offset-1" id="user_timeline">
<div id="user_details">
<?php
$user=$_SESSION['user_email'];
$get_user="select * from users where user_email='$user'";
$run_user=mysqli_query($con,$get_user) or die(mysql_error());
$row=mysqli_fetch_array($run_user) or die(mysql_error());
$user_id=$row['user_id'];
$user_name=$row['user_name'];
$user_email=$row['user_email'];
$user_gender=$row['user_gender'];
$user_b_day=$row['user_b_day'];
$user_image=$row['user_image'];
$user_register=$row['register_date'];
$user_last=$row['last_login'];
$get_user_post="select * from post where user_id='$user_id'";
$run_user_post=mysqli_query($con,$get_user_post);
$count=mysqli_num_rows($run_user_post);
$sel_msg="select * from messages where receiver='$user_id' AND status='unread' ORDER BY 1 DESC";
$run=mysqli_query($con,$sel_msg) OR die("ERROR :".mysqli_error($con));
$count_msg=mysqli_num_rows($run);
echo"
<div class='row'>
<div class='col-md-12'>
<p>
<center><img class='img-responsive' style='margin-top:10vh;' width='200' height='200' src='user/user_images/$user_image'></center>
</p>
</div>
</div>
<hr style='color:black;'>
<div class='row'>
<div class='col-md-12 '>
<h5 style='margin:3vh 2vh 2vh 2vh;'>Name :$user_name</h5>
</div>
</div>
<div class='row'>
<div class='col-md-12 '>
<h5 style='margin:2vh;'>Member Since:$user_register</h5>
</div>
</div>
<div class='row'>
<div class='col-md-12 '>
<h5 style='margin:2vh;'>Last Login :$user_last</h5>
</div>
</div>
<div class='row'>
<div class='col-md-12 '>
<a style='margin:2vh;font-size:1.3em;text-decoration:none;' href='my_messages.php?u_id=$user_id'>Messages ($count_msg):</a>
</div>
</div>
<div class='row'>
<div class='col-md-12'>
<a style='margin:2vh;font-size:1.3em;text-decoration:none;' href='posts.php'>Posts ($count):</a>
</div>
</div>
<div class='row'>
<div class='col-md-12 '>
<a style='margin:2vh;font-size:1.3em;text-decoration:none;' href='edit.php'>Edit my Account :</a>
</div>
</div>
<div class='row'>
<div class='col-md-12 '>
<a style='margin:2vh;font-size:1.3em;text-decoration:none;' href='logout.php'>Logout</a>
</div>
</div>
";
?>
</div>
</div>
<div class="col-md-6 col-lg-offset-1" id="content_timeline" style='background-color:white;'>
<br><br>
<br>
<h2>See Your Message <span> <?php echo $user_name; ?></span></h2>
<p align="center">
<a href="my_messages.php?inbox">My Inbox</a> || <a href="my_messages.php?sent">Sent items</a>
</p>
<?php
while($row_msg=mysqli_fetch_array($run))
{
$msg_id=$row_msg['msg_id'];
$msg_sender=$row_msg['sender'];
$msg_receiver=$row_msg['receiver'];
$msg_sub=$row_msg['msg_sub'];
$msg_topic=$row_msg['msg_topic'];
$msg_date=$row_msg['msg_date'];
$get_sender="select * from users where user_id='$msg_sender' ORDER by 1 DESC";
$run_sender=mysqli_query($con,$get_sender);
$row_sender=mysqli_fetch_array($run_sender);
$sender_name=$row_sender['user_name'];
?>
<?php
if(isset($_GET['sent']))
{
include("sent.php");
}
?>
<?php if(isset($_GET['inbox']))
{ ?>
<table class="table table-hover">
<thead>
<tr>
<th>Sender Name</th>
<th>Subject</th>
<th>Date</th>
<th>Reply</th>
</tr>
</thead>
<tbody>
<tr>
<?php echo "<td><a href='user_profile.php?u_id=$msg_sender'>
$sender_name
</a></td> "; ?>
<?php echo"<td><a href='my_messages.php?msg_id=$msg_id'> $msg_sub </a></td>
";?>
<td><?php echo $msg_date ;?></td>
<?php echo "<td><a href='my_messages.php?msg_id=$msg_id' target='self'>Reply</a></td>
";?>
</tr>
</tbody>
</table>
<?php }
}
single_message();
?>
</div>
</div>
</div>
<?php } ?>
</body>
<script src="vendor/jquery/jquery.min.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>
<!-- Plugin JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
<!-- Contact Form JavaScript -->
<script src="js/jqBootstrapValidation.js"></script>
<!-- Theme JavaScript -->
<script src="js/freelancer.min.js"></script>
</html>