-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdashboard.php
126 lines (104 loc) · 3.15 KB
/
dashboard.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
<?php
session_start();
if (!isset($_SESSION["username"])) {
header("Location: login.php");
exit();
}
$username = $_SESSION["username"];
// Handle channel creation form submission
if ($_SERVER["REQUEST_METHOD"] === "POST" && isset($_POST["createChannel"])) {
$channelName = $_POST["channelName"];
// Assuming you have a directory structure for channels
$channelDirectory = "channels/$username/$channelName";
if (!is_dir($channelDirectory)) {
mkdir($channelDirectory, 0777, true);
file_put_contents("$channelDirectory/channel_name.txt", $channelName);
// Redirect to the channel customization page
header("Location: customize_channel.php?channel=" . urlencode($channelName));
exit();
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dashboard</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
margin: 0;
padding: 0;
}
.header {
background-color: #007bff;
color: #fff;
padding: 10px;
text-align: center;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
h1 {
margin: 0;
padding: 0;
}
h2 {
margin-top: 20px;
}
ul {
list-style: none;
padding: 0;
}
li {
border: 1px solid #ccc;
border-radius: 5px;
padding: 10px;
margin: 10px 0;
display: flex;
justify-content: space-between;
align-items: center;
}
a {
color: #007bff;
text-decoration: none;
}
.delete-link {
color: #ff0000;
margin-left: 10px;
}
</style>
</head>
<body>
<h1>Dashboard</h1>
<p>Welcome, <?php echo $username; ?>!</p>
<h2>Your Uploaded Videos</h2>
<ul>
<?php
$videosData = json_decode(file_get_contents("videos.json"), true);
foreach ($videosData as $video) {
if ($video["username"] === $username) {
echo '<li>';
echo '<a href="watch.php?filename=' . urlencode($video["filename"]) . '">' . $video["filename"] . '</a>';
echo '<span>Views: ' . $video["views"] . '</span>';
echo '<span>Likes: ' . $video["likes"] . '</span>';
echo '<span>Dislikes: ' . $video["dislikes"] . '</span>';
echo '<a href="delete_video.php?filename=' . urlencode($video["filename"]) . '">Delete</a>';
echo '</li>';
}
}
?>
</ul>
<a href="upload.php">Upload New Video</a>
<br>
<a href="logout.php">Log Out</a>
<br>
<a href="index.php">Home</a>
<br>
<a href="create_channel.php">Create Channel</a>
</body>
</html>