-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinvite.php
More file actions
329 lines (290 loc) · 19.5 KB
/
invite.php
File metadata and controls
329 lines (290 loc) · 19.5 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
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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
<?php include 'config.php';
$search_mem = isset($_REQUEST['search_mem']) ? htmlentities($_REQUEST['search_mem']) : '';
$view = isset($_REQUEST['view']) ? htmlentities($_REQUEST['view']) : '';
$eid = isset($_REQUEST['eid']) ? htmlentities($_REQUEST['eid']) : '';
if($view=='event'){ // for event invitation
if($eid==''){
$sql_last_event=mysqli_query($dbconfig,"SELECT * FROM user_events WHERE userID='".$userid."' ORDER BY eventID DESC LIMIT 1");
$row_last_event=mysqli_fetch_assoc($sql_last_event);
$eid=$row_last_event['eventID'];
}else{
$sql_last_event=mysqli_query($dbconfig,"SELECT * FROM user_events WHERE eventID='".$eid."'");
$row_last_event=mysqli_fetch_assoc($sql_last_event);
$eid=$row_last_event['eventID'];
}
//if eventid is empty
if($eid==''){
include 'includes/error.php';
}
}else if($view==''){ include 'includes/error.php'; }
if($view=='group'){ // for group invitation
$gid = isset($_REQUEST['gid']) ? htmlentities($_REQUEST['gid']) : '';
//fetching group info
$sql_group=mysqli_query($dbconfig,"SELECT * FROM user_groups WHERE groupID='".$gid."' ")or die (mysqli_error($dbconfig));
$row_group=mysqli_fetch_assoc($sql_group);
//checking access of the user to the group
if($gid!=''){
$sql_access=mysqli_query($dbconfig,"SELECT * FROM user_groups AS g LEFT JOIN group_members USING (groupID)
WHERE g.groupID=".$gid." AND memberID='".$userid."' ") or die (mysqli_error($dbconfig));
$check_access_of_group=mysqli_num_rows($sql_access);
$check_access_of_group = isset($check_access_of_group) ? htmlentities($check_access_of_group) : '';
if($check_access_of_group==''){
include 'includes/error.php';
}
}
}else if($view==''){ include 'includes/error.php'; }
?>
<!DOCTYPE html>
<html>
<head>
<title>Invite <?php include 'includes/title.php'; ?></title>
<link href="assets/css/bootstrap.css" rel='stylesheet' type='text/css' />
<!-- Custom Theme files -->
<link href="assets/css/style.css" rel="stylesheet" type="text/css" media="all" />
<!-- Custom Theme files -->
<?php include 'includes/stylesheets.php'; ?>
</head>
<body>
<?php include 'includes/header.php'; ?>
<div class="container">
<div class="total-info">
<?php include 'includes/left_panel.php'; ?>
<?php if($view=='group'){ // for group invitation ?>
<div class="col-md-4 grid_2">
<div class="white-area"><h5>Invite Friends to <?php echo $row_group['groupName']; ?></h5></div>
<div class="hire-me">
<ul class="cute">
<!--Search Form-->
<li>
<form action="invite.php" method="get">
<input type="hidden" name="gid" value="<?php echo $gid; ?>">
<span class="inline-display">
<input type="text" name="search_mem" class="form-control-search" placeholder="Search Member" />
<input type="submit" class="btn btn-primary btn-sm search_btn" value="Search" />
</span>
</form>
</li>
<!--Search Members-->
<?php if($search_mem!=''){ ?>
<li><hr><h5 class="grey">Search Members</h5></li>
<?php
$sql=$conn->prepare("SELECT *,$name FROM users WHERE (firstName LIKE :search_mem OR lastName LIKE :search_mem) AND userID!=".$userid." ");
$sql->bindValue(':search_mem','%'.$search_mem.'%');
$sql->execute();
$sql>0;
while($row_search_members=$sql->fetch(PDO::FETCH_ASSOC)) {
//counting no of groups person member of
$sql_no_of_groups=mysqli_query($dbconfig,"SELECT * FROM group_members WHERE memberID=".$row_search_members['userID']." ");
$check_no_of_groups=mysqli_num_rows($sql_no_of_groups);
$check_no_of_groups = isset($check_no_of_groups) ? htmlentities($check_no_of_groups) : '';
//checking if already a member of the group
$sql_mem_already=mysqli_query($dbconfig,"SELECT * FROM group_members WHERE groupID='".$gid."' AND memberID=".$row_search_members['userID']." ");
$check_member=mysqli_num_rows($sql_mem_already);
$check_member = isset($check_member) ? htmlentities($check_member) : '';
if($check_member!=true){
?>
<li class="" style="padding:5px; border-bottom:1px solid #f0f0f0; ">
<a href="<?php if($row_search_members['webName']==''){echo 'user/'.$row_search_members["userID"].'';}else{ echo 'user/'.$row_search_members["webName"].'';} ?>">
<img src="<?php if($row_search_members['userImg']==''){echo 'images/default.jpg';}else {
echo 'uploads/'.$row_search_members['userImg']; } ?>" alt="User Avatar" class="recent_chat">
<small class="" style="margin-left: 5px;">
<?php echo $row_search_members['name']; ?>
</small>
</a>
<small class="about" id="right_btn">
<small class="grey">Member of <?php echo $check_no_of_groups; ?> Groups </small> |
<!-- Invite-->
<a href="javascript:void(0);" rel="<?php echo $row_search_members['userID'] ?>" data-gid="<?php echo $gid; ?>" class="group_invite grey invite">
<span id="approve<?php echo $row_search_members['userID'] ?>"></span> <span id="approve_mem<?php echo $row_search_members['userID'] ?>">
<i class="icon-gift"></i> Invite</span></a>
</small>
</li>
<?php }}} ?>
<li><hr><h5 class="grey1">Suggested Friends</h5></li>
<?php
$sql_members=mysqli_query($dbconfig,"SELECT *,$name FROM users WHERE userID!=".$userid." ORDER BY RAND()");
while($row_members=mysqli_fetch_assoc($sql_members)){
//counting no of groups person member of
$sql_no_of_groups=mysqli_query($dbconfig,"SELECT * FROM group_members WHERE memberID=".$row_members['userID']." ");
$check_no_of_groups=mysqli_num_rows($sql_no_of_groups);
$check_no_of_groups = isset($check_no_of_groups) ? htmlentities($check_no_of_groups) : '';
//checking if already a member of the group
$sql_mem_already=mysqli_query($dbconfig,"SELECT * FROM group_members AS m LEFT JOIN invitation AS i ON m.groupID=i.referenceID
WHERE m.groupID='".$gid."' AND (memberID=".$row_members['userID']." OR (inviteTo=".$row_members['userID']." AND type='group.invite'))
") or die (mysqli_error($dbconfig)) ;
$check_member=mysqli_num_rows($sql_mem_already);
$check_member = isset($check_member) ? htmlentities($check_member) : '';
if($check_member!=true){
?>
<li class="" style="padding:5px; border-bottom:1px solid #f0f0f0; ">
<a href="<?php if($row_members['webName']==''){echo 'user/'.$row_members["userID"].'';}else{ echo 'user/'.$row_members["webName"].'';} ?>">
<img src="<?php if($row_members['userImg']==''){echo 'images/default.jpg';}else {
echo 'uploads/'.$row_members['userImg']; } ?>" alt="User Avatar" class="recent_chat">
<small class="" style="margin-left: 5px;">
<?php echo $row_members['name']; ?>
</small>
</a>
<small class="about" id="right_btn">
<small class="grey1">Member of <?php echo $check_no_of_groups; ?> Groups </small> |
<!-- Invite-->
<a href="javascript:void(0);" rel="<?php echo $row_members['userID'] ?>" data-gid="<?php echo $gid; ?>" class="click_group_invite grey invite">
<span id="invited<?php echo $row_members['userID'] ?>"></span> <span id="hide_invite<?php echo $row_members['userID'] ?>">
<i class="icon-gift"></i> Invite</span></a>
</small>
</li>
<?php }} ?>
</ul>
</div>
</div><!--end col-md-4 grid_2-->
<div class="col-md-3 grid_2">
<!--Invited People to group-->
<div class="white-area"><h5><small>Invited Friend to <b><?php echo $row_group['groupName']; ?></b></small></h5></div>
<div class=" profile_container">
<ul class="cute">
<?php
$sql_invited_people=mysqli_query($dbconfig,"SELECT * FROM invitation AS i LEFT JOIN users AS u ON i.inviteTo=u.userID
WHERE referenceID='".$gid."'AND type='group.invite' ");
$check_if_people=mysqli_num_rows($sql_invited_people);
$check_if_people = isset($check_if_people) ? htmlentities($check_if_people) : '';
if($check_if_people==''){echo '<h5 class="invite1 grey1">No Invitation sent</h5>';}else{
while($row_invited_people=mysqli_fetch_assoc($sql_invited_people)){
?>
<li class="about">
<a href="user/<?php echo $row_invited_people['userID']; ?>">
<img src="<?php if($row_invited_people['userImg']==''){echo 'images/default.jpg';}else {
echo 'uploads/'.$row_invited_people['userImg']; } ?>" alt="User Avatar" class="recent_chat">
<small class="" style="margin-left: 5px;">
<?php echo $row_invited_people['firstName']; ?>
<?php echo $row_invited_people['lastName']; ?>
</small>
</a>
<small class="about" id="right_btn">
<a href="javascript:void(0);" rel="<?php echo $row_invited_people['inviteID'] ?>" class="click_cancel_ginvite">
<span id="cancelled<?php echo $row_invited_people['inviteID'] ?>"></span> <span id="hide_cancel<?php echo $row_invited_people['inviteID'] ?>">
<i class="icon-remove"></i> Cancel</span></a>
</small>
</li>
<?php }} ?>
</ul>
</div>
</div><!--end col-md-3 grid_2-->
<?php } ?>
<?php if($view=='event'){ // for event invitation ?>
<div class="col-md-4 grid_2">
<!--Invited People to event+Form-->
<div class="white-area"><h5>Invite People to <?php echo $row_last_event['eventName']; ?></h5></div>
<div class="hire-me">
<ul class="cute">
<!--Search Form-->
<li>
<form action="invite.php" method="get">
<input type="hidden" name="view" value="<?php echo $view; ?>">
<span class="inline-display">
<input type="text" name="search_mem" class="form-control-search" placeholder="Search Member" />
<input type="submit" class="btn btn-primary btn-sm search_btn" value="Search" />
</span>
</form>
</li>
<?php if($search_mem!=''){ ?>
<li><hr><h5 class="grey">Search Members</h5></li>
<?php
$sql=$conn->prepare("SELECT *,$name FROM users WHERE (firstName LIKE :search_mem OR lastName LIKE :search_mem) AND userID!=".$userid." ");
$sql->bindValue(':search_mem','%'.$search_mem.'%');
$sql->execute();
$sql>0;
while($row_search_members=$sql->fetch(PDO::FETCH_ASSOC)) {
//checking if already a member of the group
$sql_mem_already=mysqli_query($dbconfig,"SELECT * FROM invitation WHERE inviteTo=".$row_search_members['userID']."
AND type='event.invite' AND referenceID='".$eid."' ") or die (mysqli_error($dbconfig)) ;
$check_member=mysqli_num_rows($sql_mem_already);
$check_member = isset($check_member) ? htmlentities($check_member) : '';
if($check_member!=true){
?>
<li class="" style="padding:5px; border-bottom:1px solid #f0f0f0; ">
<a href="<?php if($row_search_members['webName']==''){echo 'user/'.$row_search_members["userID"].'';}else{ echo 'user/'.$row_search_members["webName"].'';} ?>">
<img src="<?php if($row_search_members['userImg']==''){echo 'images/default.jpg';}else {
echo 'uploads/'.$row_search_members['userImg']; } ?>" alt="User Avatar" class="recent_chat">
<small class="" style="margin-left: 5px;">
<?php echo $row_search_members['name']; ?>
</small>
</a>
<small id="right_btn">
<!-- Invite-->
<a href="javascript:void(0);" rel="<?php echo $row_search_members['userID'] ?>" data-eid="<?php echo $eid; ?>" class="click_event_invite grey invite">
<span id="invited<?php echo $row_search_members['userID'] ?>"></span> <span id="hide_invite<?php echo $row_search_members['userID'] ?>">
<i class="icon-gift"></i> Invite</span></a>
</small>
</li>
<?php }}} ?>
<li><hr><h5 class="grey1">Suggested Friends</h5></li>
<?php
$sql_members=mysqli_query($dbconfig,"SELECT *,$name FROM users WHERE userID!=".$userid." ORDER BY RAND()");
while($row_members=mysqli_fetch_assoc($sql_members)){
//checking if already a sent invitation
$sql_mem_already=mysqli_query($dbconfig,"SELECT * FROM invitation WHERE inviteTo=".$row_members['userID']."
AND type='event.invite' AND referenceID='".$eid."' ") or die (mysqli_error($dbconfig)) ;
$check_member=mysqli_num_rows($sql_mem_already);
$check_member = isset($check_member) ? htmlentities($check_member) : '';
if($check_member!=true){
?>
<li class="" style="padding:5px; border-bottom:1px solid #f0f0f0; ">
<a href="<?php if($row_members['webName']==''){echo 'user/'.$row_members["userID"].'';}else{ echo 'user/'.$row_members["webName"].'';} ?>">
<img src="<?php if($row_members['userImg']==''){echo 'images/default.jpg';}else {
echo 'uploads/'.$row_members['userImg']; } ?>" alt="User Avatar" class="recent_chat">
<small class="" style="margin-left: 5px;">
<?php echo $row_members['name']; ?>
</small>
</a>
<small id="right_btn">
<!-- Invite-->
<a href="javascript:void(0);" rel="<?php echo $row_members['userID'] ?>" data-eid="<?php echo $eid; ?>" class="click_event_invite grey invite">
<span id="invited<?php echo $row_members['userID'] ?>"></span> <span id="hide_invite<?php echo $row_members['userID'] ?>">
<i class="icon-gift"></i> Invite</span></a>
</small>
</li>
<?php }} ?>
<li><small><a href="event/<?php echo $row_last_event['eventID']; ?>" class="">Skip</a></small></li>
</ul>
</div>
</div><!--end col-md-4 grid_2-->
<div class="col-md-3 grid_2">
<!--Invited People to event-->
<div class="white-area"><h5><small>Invited People to <b><?php echo $row_last_event['eventName']; ?></b></small></h5></div>
<div class=" profile_container">
<ul class="cute">
<?php
$sql_invited_people=mysqli_query($dbconfig,"SELECT *,$name FROM invitation AS i LEFT JOIN users AS u ON i.inviteTo=u.userID
WHERE referenceID='".$eid."' AND type='event.invite' AND i.userID='".$userid."' ");
$check_if_people=mysqli_num_rows($sql_invited_people);
$check_if_people = isset($check_if_people) ? htmlentities($check_if_people) : '';
if($check_if_people==''){echo '<h5 class="invite1 grey1">No Invitation sent</h5>';}else{
while($row_invited_people=mysqli_fetch_assoc($sql_invited_people)){
?>
<li class="about">
<a href="<?php if($row_invited_people['webName']==''){echo 'user/'.$row_invited_people["userID"].'';}else{ echo 'user/'.$row_invited_people["webName"].'';} ?>">
<img src="<?php if($row_invited_people['userImg']==''){echo 'images/default.jpg';}else {
echo 'uploads/'.$row_invited_people['userImg']; } ?>" alt="User Avatar" class="recent_chat">
<small class="" style="margin-left: 5px;">
<?php echo $row_invited_people['name']; ?>
</small>
</a>
<small id="right_btn">
<a href="javascript:void(0);" rel="<?php echo $row_invited_people['inviteID'] ?>" class="click_cancel_ginvite">
<span id="cancelled<?php echo $row_invited_people['inviteID'] ?>"></span> <span id="hide_cancel<?php echo $row_invited_people['inviteID'] ?>">
<i class="icon-remove"></i> Cancel</span></a>
</small>
</li>
<?php }} ?>
</ul>
</div>
</div><!--end col-md-3 grid_2-->
<?php } ?>
<?php include 'includes/right_panel.php'; ?>
<!--Container Ends Here-->
<div class="clearfix"></div>
</div>
<script src="assets/js/myscript.js"></script>
<script src="assets/my-js/invitation.js"></script>
</div>
</body>
</html>