1.0
This commit is contained in:
parent
eea74ad797
commit
e899fb7f07
166
admin.php
Normal file
166
admin.php
Normal file
@ -0,0 +1,166 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
// If not logged in, redirect to login page
|
||||||
|
if (!isset($_SESSION['admin_logged_in']) || $_SESSION['admin_logged_in'] !== true) {
|
||||||
|
header('Location: admin_login.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle logout
|
||||||
|
if (isset($_GET['action']) && $_GET['action'] === 'logout') {
|
||||||
|
$_SESSION = [];
|
||||||
|
session_destroy();
|
||||||
|
header('Location: admin_login.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
$user_count = 0;
|
||||||
|
$playlist_count = 0;
|
||||||
|
$content_count = 0;
|
||||||
|
|
||||||
|
try {
|
||||||
|
$db = db();
|
||||||
|
$user_count = $db->query('SELECT count(*) FROM users')->fetchColumn();
|
||||||
|
$playlist_count = $db->query('SELECT count(*) FROM user_playlists')->fetchColumn();
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
// DB connection error is handled gracefully
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file_exists('premium_content.json')) {
|
||||||
|
$premium_content = json_decode(file_get_contents('premium_content.json'), true);
|
||||||
|
$content_count = is_array($premium_content) ? count($premium_content) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Admin Panel - gomoviz.asia</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
<style>
|
||||||
|
.sidebar {
|
||||||
|
width: 280px;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
height: 100vh;
|
||||||
|
background-color: #1E1E1E;
|
||||||
|
padding-top: 20px;
|
||||||
|
}
|
||||||
|
.main-content {
|
||||||
|
margin-left: 280px;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="sidebar d-flex flex-column p-3">
|
||||||
|
<h3 class="text-white text-center mb-4">Admin Panel</h3>
|
||||||
|
<ul class="nav nav-pills flex-column mb-auto">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="admin.php" class="nav-link active text-white"><i class="bi bi-speedometer2 me-2"></i>Dashboard</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="admin_users.php" class="nav-link text-white"><i class="bi bi-people-fill me-2"></i>Users</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="admin_content.php" class="nav-link text-white"><i class="bi bi-tv-fill me-2"></i>Premium Content</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="admin_settings.php" class="nav-link text-white"><i class="bi bi-gear-fill me-2"></i>App Settings</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<hr>
|
||||||
|
<div class="dropdown">
|
||||||
|
<a href="?action=logout" class="d-flex align-items-center text-white text-decoration-none">
|
||||||
|
<i class="bi bi-box-arrow-right me-2"></i>
|
||||||
|
<strong>Sign out</strong>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<main class="main-content">
|
||||||
|
<h1 class="mb-4">Dashboard</h1>
|
||||||
|
<p class="lead">Welcome to the Admin Panel. Here you can manage your application.</p>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xl-3 col-md-6 mb-4">
|
||||||
|
<div class="card text-white h-100" style="background-color: #007bff;">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row no-gutters align-items-center">
|
||||||
|
<div class="col mr-2">
|
||||||
|
<div class="text-xs font-weight-bold text-uppercase mb-1">Total Users</div>
|
||||||
|
<div class="h5 mb-0 font-weight-bold"><?php echo $user_count; ?></div>
|
||||||
|
</div>
|
||||||
|
<div class="col-auto">
|
||||||
|
<i class="bi bi-people-fill fs-2 text-gray-300"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-3 col-md-6 mb-4">
|
||||||
|
<div class="card text-white h-100" style="background-color: #28a745;">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row no-gutters align-items-center">
|
||||||
|
<div class="col mr-2">
|
||||||
|
<div class="text-xs font-weight-bold text-uppercase mb-1">Total Playlists</div>
|
||||||
|
<div class="h5 mb-0 font-weight-bold"><?php echo $playlist_count; ?></div>
|
||||||
|
</div>
|
||||||
|
<div class="col-auto">
|
||||||
|
<i class="bi bi-list-task fs-2 text-gray-300"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-3 col-md-6 mb-4">
|
||||||
|
<div class="card text-white h-100" style="background-color: #ffc107;">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row no-gutters align-items-center">
|
||||||
|
<div class="col mr-2">
|
||||||
|
<div class="text-xs font-weight-bold text-uppercase mb-1">Premium Content</div>
|
||||||
|
<div class="h5 mb-0 font-weight-bold"><?php echo $content_count; ?></div>
|
||||||
|
</div>
|
||||||
|
<div class="col-auto">
|
||||||
|
<i class="bi bi-star-fill fs-2 text-gray-300"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xl-3 col-md-6 mb-4">
|
||||||
|
<div class="card text-white h-100" style="background-color: #dc3545;">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row no-gutters align-items-center">
|
||||||
|
<div class="col mr-2">
|
||||||
|
<div class="text-xs font-weight-bold text-uppercase mb-1">Site Settings</div>
|
||||||
|
<div class="h5 mb-0 font-weight-bold">Manage</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-auto">
|
||||||
|
<i class="bi bi-gear-fill fs-2 text-gray-300"></i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<a href="admin_settings.php" class="card-footer text-white clearfix small z-1">
|
||||||
|
<span class="float-left">View Details</span>
|
||||||
|
<span class="float-right"><i class="bi bi-arrow-right-circle-fill"></i></span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
135
admin_content.php
Normal file
135
admin_content.php
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if (!isset($_SESSION['admin_logged_in']) || $_SESSION['admin_logged_in'] !== true) {
|
||||||
|
header('Location: admin_login.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$content_file = 'premium_content.json';
|
||||||
|
$content = json_decode(file_get_contents($content_file), true);
|
||||||
|
|
||||||
|
// Handle Add/Edit/Delete
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
// Delete
|
||||||
|
if (isset($_POST['delete'])) {
|
||||||
|
$id_to_delete = intval($_POST['id']);
|
||||||
|
$content = array_filter($content, function($item) use ($id_to_delete) {
|
||||||
|
return $item['id'] !== $id_to_delete;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// Add or Edit
|
||||||
|
else {
|
||||||
|
$id = intval($_POST['id']);
|
||||||
|
$new_item = [
|
||||||
|
'id' => $id === 0 ? time() : $id, // new id for new items
|
||||||
|
'title' => $_POST['title'],
|
||||||
|
'category' => $_POST['category'],
|
||||||
|
'poster_url' => $_POST['poster_url'],
|
||||||
|
'stream_url' => $_POST['stream_url'],
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($id === 0) { // Add
|
||||||
|
$content[] = $new_item;
|
||||||
|
} else { // Edit
|
||||||
|
foreach ($content as &$item) {
|
||||||
|
if ($item['id'] === $id) {
|
||||||
|
$item = $new_item;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
file_put_contents($content_file, json_encode(array_values($content), JSON_PRETTY_PRINT));
|
||||||
|
header('Location: admin_content.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$edit_item = null;
|
||||||
|
if (isset($_GET['edit'])) {
|
||||||
|
$id_to_edit = intval($_GET['edit']);
|
||||||
|
foreach ($content as $item) {
|
||||||
|
if ($item['id'] === $id_to_edit) {
|
||||||
|
$edit_item = $item;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Premium Content - Admin Panel</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
<style>
|
||||||
|
.sidebar { width: 280px; position: fixed; top: 0; left: 0; height: 100vh; background-color: #1E1E1E; padding-top: 20px; }
|
||||||
|
.main-content { margin-left: 280px; padding: 20px; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="sidebar d-flex flex-column p-3">
|
||||||
|
<h3 class="text-white text-center mb-4">Admin Panel</h3>
|
||||||
|
<ul class="nav nav-pills flex-column mb-auto">
|
||||||
|
<li class="nav-item"><a href="admin.php" class="nav-link text-white"><i class="bi bi-speedometer2 me-2"></i>Dashboard</a></li>
|
||||||
|
<li><a href="admin_users.php" class="nav-link text-white"><i class="bi bi-people-fill me-2"></i>Users</a></li>
|
||||||
|
<li><a href="admin_content.php" class="nav-link active text-white"><i class="bi bi-tv-fill me-2"></i>Premium Content</a></li>
|
||||||
|
<li><a href="admin_settings.php" class="nav-link text-white"><i class="bi bi-gear-fill me-2"></i>App Settings</a></li>
|
||||||
|
</ul>
|
||||||
|
<hr>
|
||||||
|
<a href="admin.php?action=logout" class="d-flex align-items-center text-white text-decoration-none"><i class="bi bi-box-arrow-right me-2"></i><strong>Sign out</strong></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<main class="main-content">
|
||||||
|
<h1 class="mb-4">Premium Content</h1>
|
||||||
|
|
||||||
|
<div class="card form-card mb-4">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title"><?php echo $edit_item ? 'Edit' : 'Add'; ?> Content</h5>
|
||||||
|
<form method="POST" action="admin_content.php">
|
||||||
|
<input type="hidden" name="id" value="<?php echo $edit_item['id'] ?? 0; ?>">
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-md-6"><label class="form-label">Title</label><input type="text" class="form-control" name="title" value="<?php echo htmlspecialchars($edit_item['title'] ?? ''); ?>" required></div>
|
||||||
|
<div class="col-md-6"><label class="form-label">Category</label><input type="text" class="form-control" name="category" value="<?php echo htmlspecialchars($edit_item['category'] ?? ''); ?>" required></div>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3"><label class="form-label">Poster URL</label><input type="url" class="form-control" name="poster_url" value="<?php echo htmlspecialchars($edit_item['poster_url'] ?? ''); ?>" required></div>
|
||||||
|
<div class="mb-3"><label class="form-label">Stream URL</label><input type="url" class="form-control" name="stream_url" value="<?php echo htmlspecialchars($edit_item['stream_url'] ?? ''); ?>" required></div>
|
||||||
|
<button type="submit" class="btn btn-primary"><?php echo $edit_item ? 'Save Changes' : 'Add Content'; ?></button>
|
||||||
|
<?php if ($edit_item): ?><a href="admin_content.php" class="btn btn-secondary">Cancel Edit</a><?php endif; ?>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card form-card">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Content Library</h5>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-dark table-striped">
|
||||||
|
<thead><tr><th>Title</th><th>Category</th><th>Actions</th></tr></thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($content as $item): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo htmlspecialchars($item['title']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($item['category']); ?></td>
|
||||||
|
<td>
|
||||||
|
<a href="?edit=<?php echo $item['id']; ?>" class="btn btn-sm btn-primary"><i class="bi bi-pencil-fill"></i></a>
|
||||||
|
<form method="POST" action="admin_content.php" onsubmit="return confirm('Are you sure you want to delete this item?');" style="display: inline-block;">
|
||||||
|
<input type="hidden" name="id" value="<?php echo $item['id']; ?>">
|
||||||
|
<button type="submit" name="delete" class="btn btn-sm btn-danger"><i class="bi bi-trash-fill"></i></button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
62
admin_login.php
Normal file
62
admin_login.php
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
// If already logged in, redirect to admin panel
|
||||||
|
if (isset($_SESSION['admin_logged_in']) && $_SESSION['admin_logged_in'] === true) {
|
||||||
|
header('Location: admin.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hardcoded password for simplicity. In a real app, use a secure, hashed password.
|
||||||
|
$admin_password = 'deep1'; // Same as the premium access code for now
|
||||||
|
|
||||||
|
$error = '';
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
if (!empty($_POST['password']) && $_POST['password'] === $admin_password) {
|
||||||
|
$_SESSION['admin_logged_in'] = true;
|
||||||
|
header('Location: admin.php');
|
||||||
|
exit;
|
||||||
|
} else {
|
||||||
|
$error = 'Invalid password. Please try again.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Admin Login - gomoviz.asia</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
.login-card {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 400px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="card form-card login-card">
|
||||||
|
<div class="card-body p-4 p-md-5">
|
||||||
|
<h2 class="text-center mb-4">Admin Login</h2>
|
||||||
|
<form method="POST" action="admin_login.php">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="password" class="form-label">Password</label>
|
||||||
|
<input type="password" class="form-control" id="password" name="password" required>
|
||||||
|
</div>
|
||||||
|
<?php if ($error): ?>
|
||||||
|
<div class="alert alert-danger"><?php echo $error; ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<button type="submit" class="btn btn-primary w-100">Login</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
155
admin_settings.php
Normal file
155
admin_settings.php
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if (!isset($_SESSION['admin_logged_in']) || $_SESSION['admin_logged_in'] !== true) {
|
||||||
|
header('Location: admin_login.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$settings_file = 'settings.json';
|
||||||
|
$settings = json_decode(file_get_contents($settings_file), true);
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
echo '<pre>POST data: ';
|
||||||
|
print_r($_POST);
|
||||||
|
echo '</pre>';
|
||||||
|
|
||||||
|
$settings['trial_duration_public'] = intval($_POST['trial_duration_public']);
|
||||||
|
$settings['trial_duration_premium'] = intval($_POST['trial_duration_premium']);
|
||||||
|
$settings['public_price_monthly'] = floatval($_POST['public_price_monthly']);
|
||||||
|
$settings['premium_price_monthly'] = floatval($_POST['premium_price_monthly']);
|
||||||
|
$settings['public_price_yearly'] = floatval($_POST['public_price_yearly']);
|
||||||
|
$settings['premium_price_yearly'] = floatval($_POST['premium_price_yearly']);
|
||||||
|
|
||||||
|
echo '<pre>Settings to save: ';
|
||||||
|
print_r($settings);
|
||||||
|
echo '</pre>';
|
||||||
|
|
||||||
|
if (is_writable($settings_file)) {
|
||||||
|
echo '<p>settings.json is writable.</p>';
|
||||||
|
} else {
|
||||||
|
echo '<p>settings.json is NOT writable.</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = file_put_contents($settings_file, json_encode($settings, JSON_PRETTY_PRINT));
|
||||||
|
|
||||||
|
if ($result === false) {
|
||||||
|
echo '<p>Error saving settings!</p>';
|
||||||
|
$error = error_get_last();
|
||||||
|
if ($error) {
|
||||||
|
echo '<pre>Error details: ';
|
||||||
|
print_r($error);
|
||||||
|
echo '</pre>';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo '<p>Settings saved successfully.</p>';
|
||||||
|
header('Location: admin_settings.php?success=1');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
exit; // Stop execution to see debug output
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>App Settings - Admin Panel</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
<style>
|
||||||
|
.sidebar {
|
||||||
|
width: 280px;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
height: 100vh;
|
||||||
|
background-color: #1E1E1E;
|
||||||
|
padding-top: 20px;
|
||||||
|
}
|
||||||
|
.main-content {
|
||||||
|
margin-left: 280px;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="sidebar d-flex flex-column p-3">
|
||||||
|
<h3 class="text-white text-center mb-4">Admin Panel</h3>
|
||||||
|
<ul class="nav nav-pills flex-column mb-auto">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="admin.php" class="nav-link text-white"><i class="bi bi-speedometer2 me-2"></i>Dashboard</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="admin_users.php" class="nav-link text-white"><i class="bi bi-people-fill me-2"></i>Users</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="admin_content.php" class="nav-link text-white"><i class="bi bi-tv-fill me-2"></i>Premium Content</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="admin_settings.php" class="nav-link active text-white"><i class="bi bi-gear-fill me-2"></i>App Settings</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<hr>
|
||||||
|
<div class="dropdown">
|
||||||
|
<a href="admin.php?action=logout" class="d-flex align-items-center text-white text-decoration-none">
|
||||||
|
<i class="bi bi-box-arrow-right me-2"></i>
|
||||||
|
<strong>Sign out</strong>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<main class="main-content">
|
||||||
|
<h1 class="mb-4">App Settings</h1>
|
||||||
|
|
||||||
|
<?php if (isset($_GET['success'])): ?>
|
||||||
|
<div class="alert alert-success">Settings saved successfully.</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div class="card form-card">
|
||||||
|
<div class="card-body">
|
||||||
|
<form method="POST" action="admin_settings.php">
|
||||||
|
<h4 class="mb-3">Trial Durations (in days)</h4>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label for="trial_duration_public" class="form-label">Public Trial</label>
|
||||||
|
<input type="number" class="form-control" id="trial_duration_public" name="trial_duration_public" value="<?php echo $settings['trial_duration_public']; ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label for="trial_duration_premium" class="form-label">Premium Trial</label>
|
||||||
|
<input type="number" class="form-control" id="trial_duration_premium" name="trial_duration_premium" value="<?php echo $settings['trial_duration_premium']; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 class="mb-3">Subscription Pricing ($)</h4>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label for="public_price_monthly" class="form-label">Public - Monthly</label>
|
||||||
|
<input type="text" class="form-control" id="public_price_monthly" name="public_price_monthly" value="<?php echo $settings['public_price_monthly']; ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label for="public_price_yearly" class="form-label">Public - Yearly</label>
|
||||||
|
<input type="text" class="form-control" id="public_price_yearly" name="public_price_yearly" value="<?php echo $settings['public_price_yearly']; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-4">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label for="premium_price_monthly" class="form-label">Premium - Monthly</label>
|
||||||
|
<input type="text" class="form-control" id="premium_price_monthly" name="premium_price_monthly" value="<?php echo $settings['premium_price_monthly']; ?>">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label for="premium_price_yearly" class="form-label">Premium - Yearly</label>
|
||||||
|
<input type="text" class="form-control" id="premium_price_yearly" name="premium_price_yearly" value="<?php echo $settings['premium_price_yearly']; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-primary">Save Settings</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
117
admin_users.php
Normal file
117
admin_users.php
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
if (!isset($_SESSION['admin_logged_in']) || $_SESSION['admin_logged_in'] !== true) {
|
||||||
|
header('Location: admin_login.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$users = [];
|
||||||
|
try {
|
||||||
|
$db = db();
|
||||||
|
$stmt = $db->query('SELECT id, username, created_at FROM users ORDER BY created_at DESC');
|
||||||
|
$users = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$error = "Error fetching users: " . $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>User Management - Admin</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
<style>
|
||||||
|
.sidebar {
|
||||||
|
width: 280px;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
height: 100vh;
|
||||||
|
background-color: #1E1E1E;
|
||||||
|
padding-top: 20px;
|
||||||
|
}
|
||||||
|
.main-content {
|
||||||
|
margin-left: 280px;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="sidebar d-flex flex-column p-3">
|
||||||
|
<h3 class="text-white text-center mb-4">Admin Panel</h3>
|
||||||
|
<ul class="nav nav-pills flex-column mb-auto">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="admin.php" class="nav-link text-white"><i class="bi bi-speedometer2 me-2"></i>Dashboard</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="admin_users.php" class="nav-link active text-white"><i class="bi bi-people-fill me-2"></i>Users</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="admin_content.php" class="nav-link text-white"><i class="bi bi-tv-fill me-2"></i>Premium Content</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="admin_settings.php" class="nav-link text-white"><i class="bi bi-gear-fill me-2"></i>App Settings</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<hr>
|
||||||
|
<div class="dropdown">
|
||||||
|
<a href="?action=logout" class="d-flex align-items-center text-white text-decoration-none">
|
||||||
|
<i class="bi bi-box-arrow-right me-2"></i>
|
||||||
|
<strong>Sign out</strong>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<main class="main-content">
|
||||||
|
<h1 class="mb-4">User Management</h1>
|
||||||
|
|
||||||
|
<?php if (isset($error)): ?>
|
||||||
|
<div class="alert alert-danger"><?php echo htmlspecialchars($error); ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Registered Users</h5>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>Username</th>
|
||||||
|
<th>Registration Date</th>
|
||||||
|
<th>Actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php if (empty($users)): ?>
|
||||||
|
<tr>
|
||||||
|
<td colspan="4" class="text-center">No users found.</td>
|
||||||
|
</tr>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php foreach ($users as $user): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo htmlspecialchars($user['id']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($user['username']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($user['created_at']); ?></td>
|
||||||
|
<td>
|
||||||
|
<button class="btn btn-sm btn-primary disabled" title="Coming Soon"><i class="bi bi-pencil-fill"></i></button>
|
||||||
|
<button class="btn btn-sm btn-danger disabled" title="Coming Soon"><i class="bi bi-trash-fill"></i></button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
88
assets/css/custom.css
Normal file
88
assets/css/custom.css
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
body {
|
||||||
|
background-color: #121212;
|
||||||
|
color: #E0E0E0;
|
||||||
|
font-family: 'Poppins', sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-brand, .nav-link, .card-title, h1, h2, h3, h4, h5, h6 {
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar {
|
||||||
|
background-color: #1E1E1E;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom-nav {
|
||||||
|
background-color: #1E1E1E;
|
||||||
|
border-top: 1px solid #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom-nav .nav-link {
|
||||||
|
color: #E0E0E0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom-nav .nav-link.active,
|
||||||
|
.bottom-nav .nav-link:hover {
|
||||||
|
color: #00AEEF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-bar, .form-control {
|
||||||
|
background-color: #2F2F2F;
|
||||||
|
border: 1px solid #444;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
.search-bar::placeholder, .form-control::placeholder {
|
||||||
|
color: #888;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-control:focus {
|
||||||
|
background-color: #2F2F2F;
|
||||||
|
border-color: #00AEEF;
|
||||||
|
color: #FFFFFF;
|
||||||
|
box-shadow: 0 0 0 0.25rem rgba(0, 174, 239, 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-card {
|
||||||
|
background-color: #1E1E1E;
|
||||||
|
border: 1px solid #333;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.category-card {
|
||||||
|
background-color: #1E1E1E;
|
||||||
|
border: 1px solid #333;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.category-card:hover {
|
||||||
|
transform: translateY(-5px);
|
||||||
|
box-shadow: 0 8px 25px rgba(0, 174, 239, 0.2);
|
||||||
|
border-color: #00AEEF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.category-card .card-body {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.playlist-card {
|
||||||
|
background-color: #1E1E1E;
|
||||||
|
border: 1px solid #333;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
background-color: #00AEEF;
|
||||||
|
border-color: #00AEEF;
|
||||||
|
transition: background-color 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:hover {
|
||||||
|
background-color: #008fbf;
|
||||||
|
border-color: #008fbf;
|
||||||
|
}
|
||||||
|
|
||||||
|
.accent-text {
|
||||||
|
color: #00AEEF;
|
||||||
|
}
|
||||||
228
assets/js/main.js
Normal file
228
assets/js/main.js
Normal file
@ -0,0 +1,228 @@
|
|||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
const searchInput = document.getElementById('mainSearch');
|
||||||
|
if (searchInput) {
|
||||||
|
searchInput.addEventListener('keypress', function(e) {
|
||||||
|
if (e.key === 'Enter') {
|
||||||
|
e.preventDefault();
|
||||||
|
if (searchInput.value.trim().toLowerCase() === 'deep1') {
|
||||||
|
window.location.href = 'premium.php';
|
||||||
|
} else {
|
||||||
|
alert('Searching for: ' + searchInput.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- AUTHENTICATION ---
|
||||||
|
const authButtons = document.getElementById('auth-buttons');
|
||||||
|
const userGreeting = document.getElementById('user-greeting');
|
||||||
|
const loginForm = document.getElementById('login-form');
|
||||||
|
const signupForm = document.getElementById('signup-form');
|
||||||
|
const loginModal = new bootstrap.Modal(document.getElementById('loginModal'));
|
||||||
|
const signupModal = new bootstrap.Modal(document.getElementById('signupModal'));
|
||||||
|
const loginError = document.getElementById('login-error');
|
||||||
|
const signupError = document.getElementById('signup-error');
|
||||||
|
let isLoggedIn = false;
|
||||||
|
|
||||||
|
async function checkAuth() {
|
||||||
|
try {
|
||||||
|
const response = await fetch('auth.php', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
|
||||||
|
body: 'action=check_auth'
|
||||||
|
});
|
||||||
|
const result = await response.json();
|
||||||
|
isLoggedIn = result.loggedIn;
|
||||||
|
if (isLoggedIn) {
|
||||||
|
authButtons.classList.add('d-none');
|
||||||
|
userGreeting.innerHTML = `Welcome, ${escapeHTML(result.email)} <button id="logout-button" class="btn btn-sm btn-outline-secondary ms-2">Logout</button>`;
|
||||||
|
userGreeting.classList.remove('d-none');
|
||||||
|
} else {
|
||||||
|
authButtons.classList.remove('d-none');
|
||||||
|
userGreeting.classList.add('d-none');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Auth check failed', error);
|
||||||
|
}
|
||||||
|
await renderPlaylists();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(loginForm) {
|
||||||
|
loginForm.addEventListener('submit', async (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
loginError.textContent = '';
|
||||||
|
const response = await fetch('auth.php', {
|
||||||
|
method: 'POST',
|
||||||
|
body: new URLSearchParams({action: 'login', email: document.getElementById('login-email').value, password: document.getElementById('login-password').value})
|
||||||
|
});
|
||||||
|
const result = await response.json();
|
||||||
|
if (result.success) {
|
||||||
|
loginModal.hide();
|
||||||
|
await checkAuth();
|
||||||
|
} else {
|
||||||
|
loginError.textContent = result.message;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if(signupForm) {
|
||||||
|
signupForm.addEventListener('submit', async (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
signupError.textContent = '';
|
||||||
|
const response = await fetch('auth.php', {
|
||||||
|
method: 'POST',
|
||||||
|
body: new URLSearchParams({action: 'register', email: document.getElementById('signup-email').value, password: document.getElementById('signup-password').value})
|
||||||
|
});
|
||||||
|
const result = await response.json();
|
||||||
|
if (result.success) {
|
||||||
|
signupModal.hide();
|
||||||
|
await checkAuth();
|
||||||
|
} else {
|
||||||
|
signupError.textContent = result.message;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
userGreeting.addEventListener('click', async (e) => {
|
||||||
|
if (e.target.id === 'logout-button') {
|
||||||
|
await fetch('auth.php', { method: 'POST', headers: {'Content-Type': 'application/x-www-form-urlencoded'}, body: 'action=logout' });
|
||||||
|
isLoggedIn = false;
|
||||||
|
checkAuth();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// --- END AUTHENTICATION ---
|
||||||
|
|
||||||
|
const navLinks = {
|
||||||
|
home: document.getElementById('nav-home'),
|
||||||
|
playlists: document.getElementById('nav-playlists'),
|
||||||
|
settings: document.getElementById('nav-settings'),
|
||||||
|
help: document.getElementById('nav-help'),
|
||||||
|
};
|
||||||
|
|
||||||
|
const sections = {
|
||||||
|
home: document.getElementById('home-section'),
|
||||||
|
playlists: document.getElementById('playlists-section'),
|
||||||
|
};
|
||||||
|
|
||||||
|
function navigateTo(sectionName) {
|
||||||
|
Object.values(sections).forEach(section => {
|
||||||
|
if (section) section.style.display = 'none';
|
||||||
|
});
|
||||||
|
if (sections[sectionName]) {
|
||||||
|
sections[sectionName].style.display = 'block';
|
||||||
|
}
|
||||||
|
Object.values(navLinks).forEach(link => {
|
||||||
|
if(link) link.classList.remove('active');
|
||||||
|
});
|
||||||
|
if (navLinks[sectionName]) {
|
||||||
|
navLinks[sectionName].classList.add('active');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(navLinks.home) navLinks.home.addEventListener('click', (e) => { e.preventDefault(); navigateTo('home'); });
|
||||||
|
if(navLinks.playlists) navLinks.playlists.addEventListener('click', (e) => { e.preventDefault(); navigateTo('playlists'); });
|
||||||
|
if(navLinks.settings) navLinks.settings.addEventListener('click', (e) => { e.preventDefault(); alert('Settings page is not yet implemented.'); });
|
||||||
|
if(navLinks.help) navLinks.help.addEventListener('click', (e) => { e.preventDefault(); alert('Help page is not yet implemented.'); });
|
||||||
|
|
||||||
|
// --- PLAYLISTS ---
|
||||||
|
const playlistForm = document.getElementById('add-playlist-form');
|
||||||
|
const playlistsList = document.getElementById('playlists-list');
|
||||||
|
|
||||||
|
// Local Storage Functions
|
||||||
|
const getLocalPlaylists = () => JSON.parse(localStorage.getItem('user_playlists')) || [];
|
||||||
|
const saveLocalPlaylists = (playlists) => localStorage.setItem('user_playlists', JSON.stringify(playlists));
|
||||||
|
|
||||||
|
async function renderPlaylists() {
|
||||||
|
playlistsList.innerHTML = '<p class="text-white-50">Loading...</p>';
|
||||||
|
let playlists = [];
|
||||||
|
if (isLoggedIn) {
|
||||||
|
const response = await fetch('playlist_manager.php?action=get');
|
||||||
|
playlists = await response.json();
|
||||||
|
} else {
|
||||||
|
playlists = getLocalPlaylists();
|
||||||
|
}
|
||||||
|
|
||||||
|
playlistsList.innerHTML = '';
|
||||||
|
if (playlists.length === 0) {
|
||||||
|
playlistsList.innerHTML = '<p class="text-white-50">Your added playlists will appear here.</p>';
|
||||||
|
if (!isLoggedIn) {
|
||||||
|
playlistsList.innerHTML += '<p class="text-white-50">Sign up to save your playlists to your account.</p>';
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
playlists.forEach((playlist, index) => {
|
||||||
|
const playlistEl = document.createElement('div');
|
||||||
|
playlistEl.className = 'card playlist-card mb-3';
|
||||||
|
const playlistId = isLoggedIn ? playlist.id : index;
|
||||||
|
playlistEl.innerHTML = `
|
||||||
|
<div class="card-body d-flex justify-content-between align-items-center">
|
||||||
|
<div>
|
||||||
|
<h5 class="card-title mb-1">${escapeHTML(playlist.name)}</h5>
|
||||||
|
<p class="card-text text-white-50 text-truncate" style="max-width: 200px;">${escapeHTML(playlist.url)}</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<button class="btn btn-sm btn-primary play-playlist" data-url="${escapeHTML(playlist.url)}"><i class="bi bi-play-fill"></i></button>
|
||||||
|
<button class="btn btn-sm btn-outline-danger delete-playlist" data-id="${playlistId}"><i class="bi bi-trash-fill"></i></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
playlistsList.appendChild(playlistEl);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (playlistForm) {
|
||||||
|
playlistForm.addEventListener('submit', async function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
const name = document.getElementById('playlist-name').value;
|
||||||
|
const url = document.getElementById('playlist-url').value;
|
||||||
|
|
||||||
|
if (isLoggedIn) {
|
||||||
|
await fetch('playlist_manager.php', {
|
||||||
|
method: 'POST',
|
||||||
|
body: new URLSearchParams({action: 'add', name, url})
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const playlists = getLocalPlaylists();
|
||||||
|
playlists.push({ name, url });
|
||||||
|
saveLocalPlaylists(playlists);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderPlaylists();
|
||||||
|
playlistForm.reset();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
playlistsList.addEventListener('click', async function(e) {
|
||||||
|
const playButton = e.target.closest('.play-playlist');
|
||||||
|
const deleteButton = e.target.closest('.delete-playlist');
|
||||||
|
|
||||||
|
if (playButton) {
|
||||||
|
window.location.href = `player.php?url=${encodeURIComponent(playButton.dataset.url)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (deleteButton) {
|
||||||
|
const id = deleteButton.dataset.id;
|
||||||
|
if (isLoggedIn) {
|
||||||
|
await fetch('playlist_manager.php', {
|
||||||
|
method: 'POST',
|
||||||
|
body: new URLSearchParams({action: 'delete', id})
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
let playlists = getLocalPlaylists();
|
||||||
|
playlists.splice(id, 1);
|
||||||
|
saveLocalPlaylists(playlists);
|
||||||
|
}
|
||||||
|
renderPlaylists();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
checkAuth();
|
||||||
|
});
|
||||||
|
|
||||||
|
function escapeHTML(str) {
|
||||||
|
var p = document.createElement("p");
|
||||||
|
p.appendChild(document.createTextNode(str));
|
||||||
|
return p.innerHTML;
|
||||||
|
}
|
||||||
91
auth.php
Normal file
91
auth.php
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once __DIR__ . '/db/config.php';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
$action = $_POST['action'] ?? '';
|
||||||
|
|
||||||
|
if ($action === 'register') {
|
||||||
|
$email = $_POST['email'] ?? '';
|
||||||
|
$password = $_POST['password'] ?? '';
|
||||||
|
|
||||||
|
if (empty($email) || empty($password) || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Invalid email or password.']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->prepare("SELECT id FROM users WHERE email = ?");
|
||||||
|
$stmt->execute([$email]);
|
||||||
|
if ($stmt->fetch()) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'User with this email already exists.']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$password_hash = password_hash($password, PASSWORD_DEFAULT);
|
||||||
|
|
||||||
|
// Get trial duration from settings
|
||||||
|
$settings = json_decode(file_get_contents('settings.json'), true);
|
||||||
|
$trial_days = $settings['trial_duration_public'] ?? 2;
|
||||||
|
$trial_ends_at = date('Y-m-d H:i:s', strtotime("+{$trial_days} days"));
|
||||||
|
|
||||||
|
$stmt = $pdo->prepare("INSERT INTO users (email, password, trial_ends_at) VALUES (?, ?, ?)");
|
||||||
|
$stmt->execute([$email, $password_hash, $trial_ends_at]);
|
||||||
|
$user_id = $pdo->lastInsertId();
|
||||||
|
|
||||||
|
$_SESSION['user_id'] = $user_id;
|
||||||
|
$_SESSION['user_email'] = $email;
|
||||||
|
echo json_encode(['success' => true]);
|
||||||
|
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Database error.']);
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action === 'login') {
|
||||||
|
$email = $_POST['email'] ?? '';
|
||||||
|
$password = $_POST['password'] ?? '';
|
||||||
|
|
||||||
|
if (empty($email) || empty($password)) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Email and password are required.']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM users WHERE email = ?");
|
||||||
|
$stmt->execute([$email]);
|
||||||
|
$user = $stmt->fetch();
|
||||||
|
|
||||||
|
if ($user && password_verify($password, $user['password'])) {
|
||||||
|
$_SESSION['user_id'] = $user['id'];
|
||||||
|
$_SESSION['user_email'] = $user['email'];
|
||||||
|
echo json_encode(['success' => true]);
|
||||||
|
} else {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Invalid email or password.']);
|
||||||
|
}
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Database error.']);
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action === 'logout') {
|
||||||
|
session_destroy();
|
||||||
|
echo json_encode(['success' => true]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action === 'check_auth') {
|
||||||
|
if (isset($_SESSION['user_id'])) {
|
||||||
|
echo json_encode(['loggedIn' => true, 'email' => $_SESSION['user_email']]);
|
||||||
|
} else {
|
||||||
|
echo json_encode(['loggedIn' => false]);
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo json_encode(['success' => false, 'message' => 'Invalid action.']);
|
||||||
115
help.php
Normal file
115
help.php
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once __DIR__ . '/mail/MailService.php';
|
||||||
|
|
||||||
|
$message = '';
|
||||||
|
$error = '';
|
||||||
|
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||||
|
$name = trim($_POST['name']);
|
||||||
|
$email = trim($_POST['email']);
|
||||||
|
$form_message = trim($_POST['message']);
|
||||||
|
|
||||||
|
if (empty($name) || empty($email) || empty($form_message)) {
|
||||||
|
$error = 'Please fill in all fields.';
|
||||||
|
} elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||||
|
$error = 'Invalid email format.';
|
||||||
|
} else {
|
||||||
|
$to = getenv('MAIL_TO') ?: 'support@example.com'; // Fallback admin email
|
||||||
|
$subject = "New Contact Form Message from {$name}";
|
||||||
|
|
||||||
|
$res = MailService::sendContactMessage($name, $email, $form_message, $to, $subject);
|
||||||
|
|
||||||
|
if (!empty($res['success'])) {
|
||||||
|
$message = 'Your message has been sent successfully!';
|
||||||
|
} else {
|
||||||
|
$error = 'Failed to send message. Please try again later. Error: ' . ($res['error'] ?? 'Unknown Error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$is_logged_in = isset($_SESSION['user_id']);
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Help & Contact - gomoviz.asia</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<a class="navbar-brand" href="index.php"><i class="bi bi-film"></i> gomoviz.asia</a>
|
||||||
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
|
<ul class="navbar-nav ms-auto">
|
||||||
|
<li class="nav-item"><a class="nav-link" href="index.php">Home</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link active" href="help.php">Help</a></li>
|
||||||
|
<?php if ($is_logged_in): ?>
|
||||||
|
<li class="nav-item dropdown">
|
||||||
|
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false"><i class="bi bi-person-circle"></i> <span id="username-display"></span></a>
|
||||||
|
<ul class="dropdown-menu dropdown-menu-dark" aria-labelledby="userDropdown">
|
||||||
|
<li><a class="dropdown-item" href="#" id="logout-btn">Logout</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<?php else: ?>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="#" data-bs-toggle="modal" data-bs-target="#loginModal">Login</a></li>
|
||||||
|
<li class="nav-item"><a class="nav-link" href="#" data-bs-toggle="modal" data-bs-target="#signupModal">Sign Up</a></li>
|
||||||
|
<?php endif; ?>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="container mt-5">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<div class="card form-card">
|
||||||
|
<div class="card-body p-5">
|
||||||
|
<h1 class="text-center mb-4">Contact Us</h1>
|
||||||
|
<p class="text-center mb-5">Have questions? We'd love to hear from you. Fill out the form below and we'll get back to you as soon as possible.</p>
|
||||||
|
|
||||||
|
<?php if ($message): ?>
|
||||||
|
<div class="alert alert-success"><?php echo $message; ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($error): ?>
|
||||||
|
<div class="alert alert-danger"><?php echo $error; ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<form action="help.php" method="POST">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="name" class="form-label">Name</label>
|
||||||
|
<input type="text" class="form-control" id="name" name="name" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="email" class="form-label">Email</label>
|
||||||
|
<input type="email" class="form-control" id="email" name="email" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="message" class="form-label">Message</label>
|
||||||
|
<textarea class="form-control" id="message" name="message" rows="5" required></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="d-grid">
|
||||||
|
<button type="submit" class="btn btn-primary btn-lg">Send Message</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<footer class="bg-dark text-white text-center p-3 mt-5">
|
||||||
|
<p>© <?php echo date('Y'); ?> gomoviz.asia - All Rights Reserved.</p>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<!-- Modals -->
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
355
index.php
355
index.php
@ -1,150 +1,217 @@
|
|||||||
<?php
|
<!DOCTYPE html>
|
||||||
declare(strict_types=1);
|
|
||||||
@ini_set('display_errors', '1');
|
|
||||||
@error_reporting(E_ALL);
|
|
||||||
@date_default_timezone_set('UTC');
|
|
||||||
|
|
||||||
$phpVersion = PHP_VERSION;
|
|
||||||
$now = date('Y-m-d H:i:s');
|
|
||||||
?>
|
|
||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>New Style</title>
|
|
||||||
<?php
|
<!-- SEO & Meta -->
|
||||||
// Read project preview data from environment
|
<title>gomoviz.asia - Your Ultimate IPTV Experience</title>
|
||||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
<meta name="description" content="<?php echo htmlspecialchars($_SERVER['PROJECT_DESCRIPTION'] ?? 'A modern, fully functional Android IPTV live TV application for legal streaming with user-provided playlists.'); ?>">
|
||||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
<meta name="keywords" content="IPTV, live tv, streaming, m3u, movies, series">
|
||||||
?>
|
<meta name="author" content="gomoviz.asia">
|
||||||
<?php if ($projectDescription): ?>
|
|
||||||
<!-- Meta description -->
|
<!-- Open Graph / Twitter Meta (Platform-managed) -->
|
||||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
<meta property="og:image" content="<?php echo htmlspecialchars($_SERVER['PROJECT_IMAGE_URL'] ?? ''); ?>">
|
||||||
<!-- Open Graph meta tags -->
|
<meta name="twitter:image" content="<?php echo htmlspecialchars($_SERVER['PROJECT_IMAGE_URL'] ?? ''); ?>">
|
||||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
||||||
<!-- Twitter meta tags -->
|
<!-- Bootstrap 5 CSS -->
|
||||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
||||||
<?php endif; ?>
|
<!-- Bootstrap Icons -->
|
||||||
<?php if ($projectImageUrl): ?>
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
<!-- Open Graph image -->
|
<!-- Google Fonts -->
|
||||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
<!-- Twitter image -->
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap" rel="stylesheet">
|
||||||
<?php endif; ?>
|
<!-- Custom CSS -->
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
<style>
|
||||||
<style>
|
/* Additional styles for bottom nav and spacing */
|
||||||
:root {
|
body {
|
||||||
--bg-color-start: #6a11cb;
|
padding-bottom: 80px; /* Height of the bottom nav */
|
||||||
--bg-color-end: #2575fc;
|
}
|
||||||
--text-color: #ffffff;
|
.bottom-nav {
|
||||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
height: 70px;
|
||||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
}
|
||||||
}
|
</style>
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
font-family: 'Inter', sans-serif;
|
|
||||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
|
||||||
color: var(--text-color);
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
text-align: center;
|
|
||||||
overflow: hidden;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
body::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
|
||||||
animation: bg-pan 20s linear infinite;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
@keyframes bg-pan {
|
|
||||||
0% { background-position: 0% 0%; }
|
|
||||||
100% { background-position: 100% 100%; }
|
|
||||||
}
|
|
||||||
main {
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
.card {
|
|
||||||
background: var(--card-bg-color);
|
|
||||||
border: 1px solid var(--card-border-color);
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 2rem;
|
|
||||||
backdrop-filter: blur(20px);
|
|
||||||
-webkit-backdrop-filter: blur(20px);
|
|
||||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
.loader {
|
|
||||||
margin: 1.25rem auto 1.25rem;
|
|
||||||
width: 48px;
|
|
||||||
height: 48px;
|
|
||||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
||||||
border-top-color: #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
animation: spin 1s linear infinite;
|
|
||||||
}
|
|
||||||
@keyframes spin {
|
|
||||||
from { transform: rotate(0deg); }
|
|
||||||
to { transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
.hint {
|
|
||||||
opacity: 0.9;
|
|
||||||
}
|
|
||||||
.sr-only {
|
|
||||||
position: absolute;
|
|
||||||
width: 1px; height: 1px;
|
|
||||||
padding: 0; margin: -1px;
|
|
||||||
overflow: hidden;
|
|
||||||
clip: rect(0, 0, 0, 0);
|
|
||||||
white-space: nowrap; border: 0;
|
|
||||||
}
|
|
||||||
h1 {
|
|
||||||
font-size: 3rem;
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 0 0 1rem;
|
|
||||||
letter-spacing: -1px;
|
|
||||||
}
|
|
||||||
p {
|
|
||||||
margin: 0.5rem 0;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
}
|
|
||||||
code {
|
|
||||||
background: rgba(0,0,0,0.2);
|
|
||||||
padding: 2px 6px;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
||||||
}
|
|
||||||
footer {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 1rem;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
|
||||||
<div class="card">
|
<!-- Top Navigation Bar -->
|
||||||
<h1>Analyzing your requirements and generating your website…</h1>
|
<nav class="navbar navbar-expand-lg sticky-top">
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
<div class="container-fluid">
|
||||||
<span class="sr-only">Loading…</span>
|
<a class="navbar-brand fw-bold" href="#">gomoviz.asia</a>
|
||||||
</div>
|
<div class="ms-auto d-flex align-items-center">
|
||||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
<form class="d-flex me-2" role="search" onsubmit="return false;">
|
||||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
<input class="form-control me-2 search-bar" type="search" id="mainSearch" placeholder="Type 'deep1' to discover..." aria-label="Search">
|
||||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
</form>
|
||||||
|
<div id="auth-buttons">
|
||||||
|
<button class="btn btn-outline-primary me-2" data-bs-toggle="modal" data-bs-target="#loginModal">Login</button>
|
||||||
|
<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#signupModal">Sign Up</button>
|
||||||
|
</div>
|
||||||
|
<div id="user-greeting" class="d-none"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<!-- Main Content -->
|
||||||
|
<main class="container my-5">
|
||||||
|
|
||||||
|
<div id="home-section">
|
||||||
|
<!-- Hero Section -->
|
||||||
|
<section class="text-center mb-5">
|
||||||
|
<h1 class="display-5 fw-bold">Your Ultimate IPTV Experience</h1>
|
||||||
|
<p class="lead text-white-50">Add your playlists and enjoy seamless streaming. Simple, fast, and modern.</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- Categories Section -->
|
||||||
|
<section class="mb-5">
|
||||||
|
<h2 class="mb-4">Categories</h2>
|
||||||
|
<div class="row row-cols-2 row-cols-md-3 row-cols-lg-6 g-4">
|
||||||
|
<?php
|
||||||
|
$categories = ['Live TV', 'Movies', 'Series', 'Sports', 'Kids', 'Documentaries'];
|
||||||
|
$icons = ['tv', 'film', 'collection-play', 'trophy', 'joystick', 'book'];
|
||||||
|
foreach ($categories as $index => $category):
|
||||||
|
?>
|
||||||
|
<div class="col">
|
||||||
|
<div class="category-card h-100">
|
||||||
|
<div class="card-body p-4 d-flex flex-column justify-content-center">
|
||||||
|
<i class="bi bi-<?php echo $icons[$index]; ?> fs-1 mb-2 accent-text"></i>
|
||||||
|
<h5 class="card-title mb-0"><?php echo $category; ?></h5>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- How-to Section -->
|
||||||
|
<section>
|
||||||
|
<h2 class="mb-4">How to Get Started</h2>
|
||||||
|
<div class="row g-4">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="category-card h-100 p-4">
|
||||||
|
<h4 class="card-title accent-text">1. Add Your Playlist</h4>
|
||||||
|
<p class="text-white-50">Go to "My Playlists" and add your M3U URL or log in with your credentials. Your channels will be loaded automatically.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="category-card h-100 p-4">
|
||||||
|
<h4 class="card-title accent-text">2. Start Streaming</h4>
|
||||||
|
<p class="text-white-50">Browse your channels, search for your favorite content, and start watching instantly with our advanced built-in player.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="playlists-section" style="display: none;">
|
||||||
|
<h1 class="display-5 fw-bold mb-4">My Playlists</h1>
|
||||||
|
|
||||||
|
<div class="card form-card mb-4">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Add New Playlist</h5>
|
||||||
|
<form id="add-playlist-form">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="playlist-name" class="form-label">Playlist Name</label>
|
||||||
|
<input type="text" class="form-control" id="playlist-name" placeholder="e.g., My Awesome TV" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="playlist-url" class="form-label">M3U URL</label>
|
||||||
|
<input type="url" class="form-control" id="playlist-url" placeholder="https://example.com/playlist.m3u" required>
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary w-100">Add Playlist</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h2 class="mb-4">Your Playlists</h2>
|
||||||
|
<div id="playlists-list">
|
||||||
|
<p class="text-white-50">Your added playlists will appear here.</p>
|
||||||
|
<!-- Playlists will be dynamically inserted here -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<!-- Login Modal -->
|
||||||
|
<div class="modal fade" id="loginModal" tabindex="-1" aria-labelledby="loginModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
<div class="modal-content form-card">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="loginModalLabel">Login</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form id="login-form">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="login-email" class="form-label">Email address</label>
|
||||||
|
<input type="email" class="form-control" id="login-email" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="login-password" class="form-label">Password</label>
|
||||||
|
<input type="password" class="form-control" id="login-password" required>
|
||||||
|
</div>
|
||||||
|
<div id="login-error" class="text-danger mb-3"></div>
|
||||||
|
<button type="submit" class="btn btn-primary w-100">Login</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
|
||||||
<footer>
|
<!-- Sign Up Modal -->
|
||||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
<div class="modal fade" id="signupModal" tabindex="-1" aria-labelledby="signupModalLabel" aria-hidden="true">
|
||||||
</footer>
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
|
<div class="modal-content form-card">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="signupModalLabel">Create an Account</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form id="signup-form">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="signup-email" class="form-label">Email address</label>
|
||||||
|
<input type="email" class="form-control" id="signup-email" required>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="signup-password" class="form-label">Password</label>
|
||||||
|
<input type="password" class="form-control" id="signup-password" required>
|
||||||
|
</div>
|
||||||
|
<div id="signup-error" class="text-danger mb-3"></div>
|
||||||
|
<button type="submit" class="btn btn-primary w-100">Sign Up</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Bottom Navigation Bar -->
|
||||||
|
<footer class="bottom-nav fixed-bottom d-flex justify-content-around align-items-center">
|
||||||
|
<a href="#" id="nav-home" class="nav-link active">
|
||||||
|
<i class="bi bi-house-door-fill fs-4"></i>
|
||||||
|
<div>Home</div>
|
||||||
|
</a>
|
||||||
|
<a href="#" id="nav-playlists" class="nav-link">
|
||||||
|
<i class="bi bi-list-stars fs-4"></i>
|
||||||
|
<div>My Playlists</div>
|
||||||
|
</a>
|
||||||
|
<a href="#" id="nav-settings" class="nav-link">
|
||||||
|
<i class="bi bi-gear-fill fs-4"></i>
|
||||||
|
<div>Settings</div>
|
||||||
|
</a>
|
||||||
|
<a href="help.php" class="nav-link">
|
||||||
|
<i class="bi bi-question-circle-fill fs-4"></i>
|
||||||
|
<div>Help</div>
|
||||||
|
</a>
|
||||||
|
<a href="admin_login.php" style="position: absolute; bottom: 0; right: 0; font-size: 2px; color: #1E1E1E; text-decoration: none;">.</a>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<!-- Bootstrap 5 JS -->
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
|
||||||
|
<!-- Custom JS -->
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
102
player.php
Normal file
102
player.php
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$playlist_url = $_GET['url'] ?? null;
|
||||||
|
|
||||||
|
if (!$playlist_url) {
|
||||||
|
header('Location: index.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
function parse_m3u($content) {
|
||||||
|
$channels = [];
|
||||||
|
$lines = explode("\n", $content);
|
||||||
|
$channel_info = null;
|
||||||
|
|
||||||
|
foreach ($lines as $line) {
|
||||||
|
$line = trim($line);
|
||||||
|
if (empty($line)) continue;
|
||||||
|
|
||||||
|
if (strpos($line, '#EXTINF') === 0) {
|
||||||
|
preg_match('/(?<=tvg-name=").*?(?=")/', $line, $name_match);
|
||||||
|
preg_match('/(?<=tvg-logo=").*?(?=")/', $line, $logo_match);
|
||||||
|
$title = empty($name_match) ? substr(strrchr($line, ","), 1) : $name_match[0];
|
||||||
|
|
||||||
|
$channel_info = [
|
||||||
|
'name' => $title,
|
||||||
|
'logo' => empty($logo_match) ? 'https://via.placeholder.com/150' : $logo_match[0]
|
||||||
|
];
|
||||||
|
} elseif ($channel_info && strpos($line, 'http') === 0) {
|
||||||
|
$channel_info['url'] = $line;
|
||||||
|
$channels[] = $channel_info;
|
||||||
|
$channel_info = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $channels;
|
||||||
|
}
|
||||||
|
|
||||||
|
$m3u_content = file_get_contents($playlist_url);
|
||||||
|
$channels = parse_m3u($m3u_content);
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Player - gomoviz.asia</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
<style>
|
||||||
|
body, html { height: 100%; }
|
||||||
|
.player-wrapper { display: flex; height: 100vh; }
|
||||||
|
.channel-sidebar { width: 300px; background-color: #1E1E1E; overflow-y: auto; height: 100%; }
|
||||||
|
.player-main { flex-grow: 1; background-color: #000; display: flex; align-items: center; justify-content: center; }
|
||||||
|
#video-player { width: 100%; height: 100%; }
|
||||||
|
.channel-item { display: flex; align-items: center; padding: 10px; cursor: pointer; border-bottom: 1px solid #333; }
|
||||||
|
.channel-item:hover { background-color: #2F2F2F; }
|
||||||
|
.channel-item img { width: 50px; height: 50px; border-radius: 50%; margin-right: 15px; }
|
||||||
|
.channel-item span { color: #E0E0E0; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="player-wrapper">
|
||||||
|
<div class="channel-sidebar">
|
||||||
|
<div class="p-3 text-center">
|
||||||
|
<a class="navbar-brand fw-bold" href="index.php">gomoviz.asia</a>
|
||||||
|
</div>
|
||||||
|
<div id="channel-list">
|
||||||
|
<?php foreach ($channels as $channel): ?>
|
||||||
|
<div class="channel-item" data-url="<?php echo htmlspecialchars($channel['url']); ?>">
|
||||||
|
<img src="<?php echo htmlspecialchars($channel['logo']); ?>" alt="Logo">
|
||||||
|
<span><?php echo htmlspecialchars($channel['name']); ?></span>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<main class="player-main">
|
||||||
|
<video id="video-player" controls autoplay src=""></video>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
const channelItems = document.querySelectorAll('.channel-item');
|
||||||
|
const videoPlayer = document.getElementById('video-player');
|
||||||
|
|
||||||
|
channelItems.forEach(item => {
|
||||||
|
item.addEventListener('click', function() {
|
||||||
|
const streamUrl = this.dataset.url;
|
||||||
|
videoPlayer.src = streamUrl;
|
||||||
|
videoPlayer.play();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Auto-play the first channel if available
|
||||||
|
if (channelItems.length > 0) {
|
||||||
|
channelItems[0].click();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
47
playlist_manager.php
Normal file
47
playlist_manager.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
require_once __DIR__ . '/db/config.php';
|
||||||
|
|
||||||
|
if (!isset($_SESSION['user_id'])) {
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode(['error' => 'Authentication required.']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$user_id = $_SESSION['user_id'];
|
||||||
|
$action = $_GET['action'] ?? $_POST['action'] ?? '';
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
|
||||||
|
if ($action === 'get') {
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM user_playlists WHERE user_id = ? ORDER BY created_at DESC");
|
||||||
|
$stmt->execute([$user_id]);
|
||||||
|
$playlists = $stmt->fetchAll();
|
||||||
|
echo json_encode($playlists);
|
||||||
|
}
|
||||||
|
|
||||||
|
elseif ($action === 'add') {
|
||||||
|
$name = $_POST['name'] ?? '';
|
||||||
|
$url = $_POST['url'] ?? '';
|
||||||
|
if (!empty($name) && !empty($url)) {
|
||||||
|
$stmt = $pdo->prepare("INSERT INTO user_playlists (user_id, name, url) VALUES (?, ?, ?)");
|
||||||
|
$stmt->execute([$user_id, $name, $url]);
|
||||||
|
echo json_encode(['success' => true]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
elseif ($action === 'delete') {
|
||||||
|
$id = $_POST['id'] ?? '';
|
||||||
|
if (!empty($id)) {
|
||||||
|
$stmt = $pdo->prepare("DELETE FROM user_playlists WHERE id = ? AND user_id = ?");
|
||||||
|
$stmt->execute([$id, $user_id]);
|
||||||
|
echo json_encode(['success' => true]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
echo json_encode(['error' => 'Database error']);
|
||||||
|
}
|
||||||
84
premium.php
Normal file
84
premium.php
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Premium - gomoviz.asia</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
<style>
|
||||||
|
.poster-card {
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
transition: transform 0.2s ease;
|
||||||
|
}
|
||||||
|
.poster-card img {
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
.poster-card:hover {
|
||||||
|
transform: scale(1.05);
|
||||||
|
}
|
||||||
|
.poster-overlay {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
background: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0));
|
||||||
|
color: white;
|
||||||
|
padding: 2rem 1rem 1rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- Top Navigation Bar (same as index.php) -->
|
||||||
|
<nav class="navbar navbar-expand-lg sticky-top">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<a class="navbar-brand fw-bold" href="index.php">gomoviz.asia</a>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<main class="container my-5">
|
||||||
|
<div class="text-center mb-5">
|
||||||
|
<h1 class="display-5 fw-bold">Premium Content</h1>
|
||||||
|
<p class="lead text-white-50">Your 10-day free trial is active. Enjoy exclusive movies and shows.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$content_file = 'premium_content.json';
|
||||||
|
$premium_content = [];
|
||||||
|
if (file_exists($content_file)) {
|
||||||
|
$premium_content = json_decode(file_get_contents($content_file), true);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="row row-cols-2 row-cols-md-3 row-cols-lg-5 g-4">
|
||||||
|
<?php if (empty($premium_content)): ?>
|
||||||
|
<p class="text-white-50">No premium content is available at the moment. Please check back later.</p>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php foreach ($premium_content as $item): ?>
|
||||||
|
<div class="col">
|
||||||
|
<a href="<?php echo htmlspecialchars($item['stream_url']); ?>" target="_blank" class="text-decoration-none">
|
||||||
|
<div class="card category-card poster-card text-white h-100">
|
||||||
|
<img src="<?php echo htmlspecialchars($item['poster_url']); ?>" class="card-img" alt="<?php echo htmlspecialchars($item['title']); ?>">
|
||||||
|
<div class="poster-overlay">
|
||||||
|
<h5 class="card-title mb-0"><?php echo htmlspecialchars($item['title']); ?></h5>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<!-- You can add a simplified footer or the full nav bar if needed -->
|
||||||
|
<footer class="text-center p-4 text-white-50">
|
||||||
|
© <?php echo date('Y'); ?> gomoviz.asia
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
16
premium_content.json
Normal file
16
premium_content.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"title": "Big Buck Bunny",
|
||||||
|
"category": "Movies",
|
||||||
|
"poster_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Big_buck_bunny_poster_big.jpg/800px-Big_buck_bunny_poster_big.jpg",
|
||||||
|
"stream_url": "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"title": "Elephants Dream",
|
||||||
|
"category": "Movies",
|
||||||
|
"poster_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/e/e8/Elephants_dream_poster.jpg/800px-Elephants_dream_poster.jpg",
|
||||||
|
"stream_url": "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4"
|
||||||
|
}
|
||||||
|
]
|
||||||
8
settings.json
Normal file
8
settings.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"trial_duration_public": 2,
|
||||||
|
"trial_duration_premium": 10,
|
||||||
|
"public_price_monthly": 4.99,
|
||||||
|
"premium_price_monthly": 14.99,
|
||||||
|
"public_price_yearly": 49.99,
|
||||||
|
"premium_price_yearly": 149.99
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user