-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchannels.php
279 lines (239 loc) · 8.45 KB
/
channels.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
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
<?php
include 'func.php';
include 'conn.php';
// User ID for which you want to count videos and views
$userID = $_GET['id'];
// Prepare the SQL query to count videos and total views for the specified user
$sql = "SELECT COUNT(*) AS videoCount, SUM(views) AS totalViews FROM videos WHERE user = $userID";
// Execute the query and get the result
$result = $conn->query($sql);
// Check if the query was successful
if ($result === false) {
die("Error: " . $conn->error);
}
// Fetch the row from the result
$row = $result->fetch_assoc();
// Get the number of videos and total views for the specified user
$videoCount = $row['videoCount'];
$totalViews = $row['totalViews'];
$logo = isset(getUser($_GET['id'])[0]->avatar) ? getUser($_GET['id'])[0]->avatar : 'https://i.imgur.com/n5MBy0m.jpg';
$website = isset(getUser($_GET['id'])[0]->website) ? getUser($_GET['id'])[0]->website : 'https://appspages.com';
#description
$description = isset(getUser($_GET['id'])[0]->description) ? getUser($_GET['id'])[0]->description : ' ';
?>
<html lang="en">
<head>
<?php include 'assets/head.php' ?>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
<!-- CSS File -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/5.1.0/lux/bootstrap.min.css"/>
<link rel="stylesheet" href="../../styles.css" />
</head>
<body>
<!-- Header Starts -->
<div class="header" style="background:black;color:wheat;">
<div class="header__left">
<i id="menu" class="material-icons">menu</i>
<img
src="https://driveplyr.appspages.online/dp.png"
alt=""
/>
</div>
<div class="header__search">
<form action="../search.php">
<input type="text" placeholder="Search" />
<button><i class="material-icons">search</i></button>
</form>
</div>
<div class="header__icons">
<i class="material-icons display-this">search</i>
<i class="material-icons">videocam</i>
<i class="material-icons">apps</i>
<i class="material-icons">notifications</i>
<a href="../../dashboard/"><i class="material-icons display-this">account_circle</i></a>
</div>
</div>
<!-- Header Ends -->
<!-- Main Body Starts -->
<div class="mainBody">
<!-- Sidebar Starts -->
<div class="sidebar">
<div class="sidebar__categories">
<div class="sidebar__category">
<a href="../../">
<i class="material-icons">home</i>
<span>Home</span>
</a>
</div>
<div class="sidebar__category">
<i class="material-icons">local_fire_department</i>
<span>Trending</span>
</div>
<div class="sidebar__category">
<i class="material-icons">subscriptions</i>
<a href="../../sitemaps.php"><span>Sitemaps</span></a>
</div>
</div>
<hr />
<div class="sidebar__categories">
<div class="sidebar__category">
<i class="material-icons">library_add_check</i>
<span>Library</span>
</div>
<div class="sidebar__category">
<i class="material-icons">history</i>
<span>History</span>
</div>
<div class="sidebar__category">
<i class="material-icons">play_arrow</i>
<span>Your Videos</span>
</div>
<div class="sidebar__category">
<i class="material-icons">watch_later</i>
<span>Watch Later</span>
</div>
<div class="sidebar__category">
<i class="material-icons">thumb_up</i>
<span>Liked Videos</span>
</div>
<div class="sidebar__category">
<!-- <i class="material-icons">thumb_up</i> -->
<a href="tos.php"><span>Terms of Service</span></a>
</div>
</div>
<hr />
</div>
<!-- Sidebar Ends -->
<!-- Videos Section -->
<div class="videos">
<!DOCTYPE html>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<style>
/* Custom CSS for the circular logo with background image */
.user-logo {
width: 150px;
height: 150px;
border-radius: 50%;
background-color: #f2f2f2;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
background-image: url('background.jpg'); /* Replace 'background.jpg' with the actual background image URL */
background-size: cover;
}
.user-logo img {
max-width: 100%;
max-height: 100%;
}
video {
margine: 2px;
}
</style>
</head>
<body>
<div class="container-fluid">
<div class="card" style="background:black;color:wheat;">
<div class="card-body text-center">
<!-- Circular logo with background image -->
<div class="user-logo mx-auto mb-4">
<!-- Replace 'logo.png' with the actual logo image URL -->
<img src="<?php echo $logo ?>" alt="Logo">
</div>
<!-- User Name -->
<h4 class="card-title"><?php echo getUser($_GET['id'])[0]->name ; ?></h4>
<!-- Website -->
<p class="card-text"><a href="<?php echo $website ?>" target="_blank">
<?php echo $website ?></a></p>
<p><?php echo $description ?></p>
<!-- Follow button (you can replace '#' with the follow action URL) -->
<button class="btn btn-primary mb-3" onclick="followUser('#')">Follow</button>
<!-- Row with number of followers, views, and videos -->
<div class="row text-center">
<div class="col">
<p>100</p>
<p>Followers</p>
</div>
<div class="col">
<p><?php echo $videoCount ?></p>
<p>Videos</p>
</div>
<div class="col">
<p><?php echo $totalViews ?></p>
<p>Views</p>
</div>
</div>
</div>
</div>
</div>
<!-- <h4>Videos From <?php echo getUser($_GET['id'])[0]->name ; ?></h4> -->
<div class="videos__container">
<?php
// Retrieve the video list from the database
$user = $_SESSION['id'];
$uploader = $_GET['id'];
$sql = "SELECT * FROM videos where user = $uploader order by id desc";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// Loop through each video and generate the table rows
while ($row = $result->fetch_assoc()) {
$videoId = $row['id'];
$videoTitle = $row['title'];
$videoPosterURL = $row['poster_url'] ?: 'https://driveplyr.appspages.online/dashboard/api/Image_not_available.png';
$videoStatus = 'Public';//$row['status'];
$videoViews = $row['views'];
$videoDownloads = $row['downloads'];
$videoScore = '100%';//$row['progress'];
$userid = $row['user'];
echo ' <!-- Single Video starts -->
<div class="video">
<div class="video__thumbnail">
<a href="../watch/'.$videoId.'/'.generateSlug($videoTitle).'">
<img src="'.$videoPosterURL.'" alt="" />
</a>
</div>
<div class="video__details">
<div class="author">
<img src="'.$logo.'" alt="" />
</div>
<div class="title">
<h3>
<a href="../watch/'.$videoId.'/'.generateSlug($videoTitle).'">
'.$videoTitle.'
</a>
</h3>
<a href="../channel/'.$userid.'">'.getUser($userid)[0]->name.'</a>
<span>'.formatViewsCount($videoViews).' Views • '.convertToRelativeTime($row['date']).'</span>
</div>
</div>
</div>
<!-- Single Video Ends -->
';
}
} else {
echo '<tr><td colspan="6">No videos found.</td></tr>';
}
?>
</div>
</div>
</div>
<script>
const menu = document.querySelector('#menu');
console.log(menu);
const sidebar = document.querySelector('.sidebar');
console.log(sidebar);
menu.addEventListener('click', function () {
sidebar.classList.toggle('show-sidebar');
});
</script>
<style>
/* Media query for max-width 450px */
@media (max-width: 450px) {
.video {
width: 100%;
}
}
</style>
<!-- Main Body Ends -->
</body>
</html>