-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgroup.php
More file actions
80 lines (67 loc) · 2.7 KB
/
group.php
File metadata and controls
80 lines (67 loc) · 2.7 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
<?php
session_start();
require 'php/classes/Post.php';
include 'partials/header.php';
require 'php/group_handling.php';
?>
<html>
<head>
<title><?= $current_group['name'] ?></title>
<link rel="stylesheet" type="text/css" href="/social_network/styles/group.css">
</head>
<body>
<div class="heading" style="text-align:center;margin-bottom:20px">
<h1 style="margin-bottom:15px"><?= $current_group['name'] ?></h1>
<?= $current_group['description'] ?>
</div>
<?php
if(!isMember($user_id, $current_group_id) && $_SESSION['email']!="admin@gmail.com"){
?>
<form method="POST">
<input type="submit" name="join_group" value="Join Group">
</form>
<?php
}
?>
<?php
if($_SESSION['email']!="admin@gmail.com" && isMember($user_id, $current_group_id))
echo '<div class="post_status_area">
<form method="POST">
<input type="text" placeholder="Post into this group" name="post_value">
<input type="submit" value="Post" name="Post">
</form>
</div>';
?>
<?php
$post=new Post();
if(isMember($user_id, $current_group_id) || $_SESSION['email']=="admin@gmail.com")
$post->loadGroupPosts($current_group['group_id']);
else
echo "<h2>Join the group to view its posts!</h2>";
?>
<div class="members_list">
<?php
//Listing members:
echo "<h3>Members:</h3>";
if(isMember($user_id, $current_group_id) || $_SESSION['email']=="admin@gmail.com"){
$query=mysql_query("SELECT * FROM users");
$start_indicator=0;
while($user = mysql_fetch_array($query)){
if(isMember($user['id'], $current_group_id)){
$start_indicator++;
?>
<a href="/social_network/<?= $user['profile_name']?>">
<img src="<?= $user['profile_image'] ?>" style="width:40px;height:40px">
<?= $user['first_name'] . " " . $user['last_name'] ?>
</a><br>
<?php
}
}
if($start_indicator==0){
echo "<h4>No members yet!</h4>";
}
}
?>
</div>
</body>
</html>