-
Notifications
You must be signed in to change notification settings - Fork 0
/
paid_posts.php
155 lines (145 loc) · 5.2 KB
/
paid_posts.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
<?php include 'includes/header.php' ?>
<div id="container">
<div id="left-nav2" style="margin-top:20px;">
<div class="clip2">
<a href="profile.php" title="Profile"><img src="<?php echo $row['profile_picture'] ?>"></a>
</div>
<div class="user-details2">
<h2><?php echo $username ?></h2>
</div>
</div>
<?php
include("includes/database.php");
$query=mysqli_query($conn,"SELECT * from user where user_id='$id' order by user_id DESC");
while($row=mysqli_fetch_array($query)){
$id = $row['user_id'];
?>
<div id="left-nav1" style="margin-top:200px;">
<h2>Personal Info</h2>
<table>
<tr>
<td><label>Firstname</label></td>
<td width="20"></td>
<td><b><?php echo $row['firstname']; ?></b></td>
</tr>
<tr>
<td><label>Lastname</label></td>
<td width="20"></td>
<td><b><?php echo $row['lastname']; ?></b></td>
</tr>
<tr>
<td><label>Credits</label></td>
<td width="20"></td>
<td><b><?php echo $row['credits']; ?></b></td>
</tr>
<tr>
<td><label>Birthday</label></td>
<td width="20"></td>
<td><b><?php echo $row['birthday']; ?></b></td>
</tr>
<tr>
<td><label>Gender</label></td>
<td width="20"></td>
<td><b><?php echo $row['gender']; ?></b></td>
</tr>
<tr>
<td><label>Contact</label></td>
<td width="20"></td>
<td><b><?php echo $row['number']; ?></b></td>
</tr>
</table>
</div>
<?php
}
?>
<?php
include("includes/database.php");
$q = mysqli_query($conn, "SELECT * from transaction t WHERE t.from_id = '$id' ORDER BY t.id DESC");
if($q->num_rows > 0){
while($r=mysqli_fetch_array($q)){
$pid = $r['post_id'];
$query=mysqli_query($conn, "SELECT * from post LEFT JOIN user on user.user_id = post.user_id WHERE post.post_id='$pid'");
while($row=mysqli_fetch_array($query)){
$posted_by = $row['firstname']." ".$row['lastname'];
$location = $row['post_image'];
$location1 = $row['doc_file'];
$profile_picture = $row['profile_picture'];
$content=$row['content'];
$post_id = $row['post_id'];
$post_user_id = $row['user_id'];
$time=$row['created'];
?>
<div id="right-nav1" style="margin-top:20px;">
<div class="profile-pics">
<img src="<?php echo $profile_picture ?>">
<a href="user.php?id=<?php echo $post_user_id ?>"><b><?php echo $posted_by ?></b></a>
<strong><?php echo $time = time_stamp($time); ?></strong>
</div>
<br />
<div class="post-content">
<?php if ($post_user_id == $id) { ?>
<div class="delete-post">
<a href="delete_post.php<?php echo '?id='.$post_id; ?>" title="Delete your post"><button class="btn-delete">X</button></a>
</div>
<?php } ?>
<p><?php echo $row['content']; ?></p>
<center>
<img src="<?php echo $location; ?>">
</center>
<center>
<a href="<?php echo $location1; ?>" class="btn btn-sign-up" download style="color: #fff; background-color: #0bacff; border-radius: 10px; margin-top:10px; margin-bottom:10px;">
<i class="fa fa-download" style="font-size: 20px;"></i> Download file
</a>
</center>
</div>
<?php
include("includes/database.php");
$comment=mysqli_query($conn, "SELECT * from comments where post_id='$post_id' order by post_id DESC");
while($row=mysqli_fetch_array($comment)){
$comment_id=$row['comment_id'];
$content_comment=$row['content_comment'];
$time=$row['created'];
$post_id=$row['post_id'];
$comment_user_id = $row['user_id'];
$user=$_SESSION['id'];
?>
<div class="comment-display"<?php echo $comment_id ?>>
<?php if ($comment_user_id == $id) { ?>
<div class="delete-post">
<a href="delete_comment.php<?php echo '?id='.$comment_id; ?>" title="Delete your comment"><button class="btn-delete">X</button></a>
</div>
<?php } ?>
<div class="user-comment-name"><img src="<?php echo $row['image']; ?>"> <a href="user.php?id=<?php echo $comment_user_id ?>"><?php echo $row['name']; ?></a><strong class="time-comment"><?php echo $time = time_stamp($time); ?></strong></div>
<div class="comment"><?php echo $row['content_comment']; ?></div>
</div>
<br />
<?php
}
?>
<form method="POST" action="comment.php">
<div class="comment-area">
<?php $image=mysqli_query($conn, "select * from user where user_id='$id'");
while($row=mysqli_fetch_array($image)){
?>
<img src="<?php echo $row['profile_picture']; ?>" width="50" height="50">
<?php } ?>
<input type="text" name="content_comment" placeholder="Write a comment..." class="comment-text">
<input type="hidden" name="post_id" value="<?php echo $post_id ?>">
<input type="hidden" name="user_id" value="<?php echo $firstname . ' ' . $lastname ?>">
<input type="hidden" name="image" value="<?php echo $profile_picture ?>">
<input type="submit" name="post_comment" value="Send" class="btn-comment">
</div>
</form>
</div>
<?php
}
}
}
else { ?>
<div id="right-nav" style="text-align:center; margin-top:18%;">
<h1>No Contributions yet!</h1>
</div>
<?php } ?>
</div>
</body>
</html>