From e899fb7f076feba7b1e2f6567a76649da0aaeb52 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Wed, 26 Nov 2025 18:47:09 +0000 Subject: [PATCH] 1.0 --- admin.php | 166 ++++++++++++++++++++ admin_content.php | 135 ++++++++++++++++ admin_login.php | 62 ++++++++ admin_settings.php | 155 ++++++++++++++++++ admin_users.php | 117 ++++++++++++++ assets/css/custom.css | 88 +++++++++++ assets/js/main.js | 228 +++++++++++++++++++++++++++ auth.php | 91 +++++++++++ help.php | 115 ++++++++++++++ index.php | 355 +++++++++++++++++++++++++----------------- player.php | 102 ++++++++++++ playlist_manager.php | 47 ++++++ premium.php | 84 ++++++++++ premium_content.json | 16 ++ settings.json | 8 + 15 files changed, 1625 insertions(+), 144 deletions(-) create mode 100644 admin.php create mode 100644 admin_content.php create mode 100644 admin_login.php create mode 100644 admin_settings.php create mode 100644 admin_users.php create mode 100644 assets/css/custom.css create mode 100644 assets/js/main.js create mode 100644 auth.php create mode 100644 help.php create mode 100644 player.php create mode 100644 playlist_manager.php create mode 100644 premium.php create mode 100644 premium_content.json create mode 100644 settings.json diff --git a/admin.php b/admin.php new file mode 100644 index 0000000..6ac0043 --- /dev/null +++ b/admin.php @@ -0,0 +1,166 @@ +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; +} + +?> + + + + + + Admin Panel - gomoviz.asia + + + + + + + + +
+

Dashboard

+

Welcome to the Admin Panel. Here you can manage your application.

+ +
+
+
+
+
+
+
Total Users
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+
Total Playlists
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+
Premium Content
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+
Site Settings
+
Manage
+
+
+ +
+
+
+ + View Details + + +
+
+
+ +
+ + + diff --git a/admin_content.php b/admin_content.php new file mode 100644 index 0000000..39231af --- /dev/null +++ b/admin_content.php @@ -0,0 +1,135 @@ + $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; + } + } +} +?> + + + + + + Premium Content - Admin Panel + + + + + + + + +
+

Premium Content

+ +
+
+
Content
+
+ +
+
+
+
+
+
+ + Cancel Edit +
+
+
+ +
+
+
Content Library
+
+ + + + + + + + + + + +
TitleCategoryActions
+ +
+ + +
+
+
+
+
+
+ + + diff --git a/admin_login.php b/admin_login.php new file mode 100644 index 0000000..1b845da --- /dev/null +++ b/admin_login.php @@ -0,0 +1,62 @@ + + + + + + + Admin Login - gomoviz.asia + + + + + +
+
+

Admin Login

+
+
+ + +
+ +
+ + +
+
+
+ + diff --git a/admin_settings.php b/admin_settings.php new file mode 100644 index 0000000..762f51d --- /dev/null +++ b/admin_settings.php @@ -0,0 +1,155 @@ +POST data: '; + print_r($_POST); + echo ''; + + $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 '
Settings to save: ';
+    print_r($settings);
+    echo '
'; + + if (is_writable($settings_file)) { + echo '

settings.json is writable.

'; + } else { + echo '

settings.json is NOT writable.

'; + } + + $result = file_put_contents($settings_file, json_encode($settings, JSON_PRETTY_PRINT)); + + if ($result === false) { + echo '

Error saving settings!

'; + $error = error_get_last(); + if ($error) { + echo '
Error details: ';
+            print_r($error);
+            echo '
'; + } + } else { + echo '

Settings saved successfully.

'; + header('Location: admin_settings.php?success=1'); + exit; + } + exit; // Stop execution to see debug output +} + +?> + + + + + + App Settings - Admin Panel + + + + + + + + +
+

App Settings

+ + +
Settings saved successfully.
+ + +
+
+
+

Trial Durations (in days)

+
+
+ + +
+
+ + +
+
+ +

Subscription Pricing ($)

+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + + diff --git a/admin_users.php b/admin_users.php new file mode 100644 index 0000000..ea4b99b --- /dev/null +++ b/admin_users.php @@ -0,0 +1,117 @@ +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(); +} + +?> + + + + + + User Management - Admin + + + + + + + + +
+

User Management

+ + +
+ + +
+
+
Registered Users
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
IDUsernameRegistration DateActions
No users found.
+ + +
+
+
+
+
+ + + diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..78f1b3f --- /dev/null +++ b/assets/css/custom.css @@ -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; +} diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000..bf413d7 --- /dev/null +++ b/assets/js/main.js @@ -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)} `; + 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 = '

Loading...

'; + 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 = '

Your added playlists will appear here.

'; + if (!isLoggedIn) { + playlistsList.innerHTML += '

Sign up to save your playlists to your account.

'; + } + 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 = ` +
+
+
${escapeHTML(playlist.name)}
+

${escapeHTML(playlist.url)}

+
+
+ + +
+
+ `; + 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; +} diff --git a/auth.php b/auth.php new file mode 100644 index 0000000..35912ec --- /dev/null +++ b/auth.php @@ -0,0 +1,91 @@ + 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.']); diff --git a/help.php b/help.php new file mode 100644 index 0000000..f067e08 --- /dev/null +++ b/help.php @@ -0,0 +1,115 @@ + + + + + + + Help & Contact - gomoviz.asia + + + + + + + +
+
+
+
+
+

Contact Us

+

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.

+ + +
+ + +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+
+
+
+
+
+ + + + + + + + diff --git a/index.php b/index.php index 7205f3d..1f19c40 100644 --- a/index.php +++ b/index.php @@ -1,150 +1,217 @@ - - + - - - New Style - - - - - - - - - - - - - - - - - - - + + + + + gomoviz.asia - Your Ultimate IPTV Experience + + + + + + + + + + + + + + + + + + + + -
-
-

Analyzing your requirements and generating your website…

-
- Loading… -
-

AI is collecting your requirements and applying the first changes.

-

This page will update automatically as the plan is implemented.

-

Runtime: PHP — UTC

+ + + + + +
+ +
+ +
+

Your Ultimate IPTV Experience

+

Add your playlists and enjoy seamless streaming. Simple, fast, and modern.

+
+ + +
+

Categories

+
+ $category): + ?> +
+
+
+ +
+
+
+
+ +
+
+ + +
+

How to Get Started

+
+
+
+

1. Add Your Playlist

+

Go to "My Playlists" and add your M3U URL or log in with your credentials. Your channels will be loaded automatically.

+
+
+
+
+

2. Start Streaming

+

Browse your channels, search for your favorite content, and start watching instantly with our advanced built-in player.

+
+
+
+
+
+ + + +
+ + + -
- + + + + + + + + + + + + - + \ No newline at end of file diff --git a/player.php b/player.php new file mode 100644 index 0000000..8f092c8 --- /dev/null +++ b/player.php @@ -0,0 +1,102 @@ + $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); + +?> + + + + + + Player - gomoviz.asia + + + + + + +
+
+ +
+ +
+ Logo + +
+ +
+
+
+ +
+
+ + + + diff --git a/playlist_manager.php b/playlist_manager.php new file mode 100644 index 0000000..92a33db --- /dev/null +++ b/playlist_manager.php @@ -0,0 +1,47 @@ + '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']); +} diff --git a/premium.php b/premium.php new file mode 100644 index 0000000..e653e8d --- /dev/null +++ b/premium.php @@ -0,0 +1,84 @@ + + + + + + Premium - gomoviz.asia + + + + + + + + + +
+
+

Premium Content

+

Your 10-day free trial is active. Enjoy exclusive movies and shows.

+
+ + + +
+ +

No premium content is available at the moment. Please check back later.

+ + + + + +
+ +
+ + + + + + diff --git a/premium_content.json b/premium_content.json new file mode 100644 index 0000000..4d2cd55 --- /dev/null +++ b/premium_content.json @@ -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" + } +] diff --git a/settings.json b/settings.json new file mode 100644 index 0000000..2959a46 --- /dev/null +++ b/settings.json @@ -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 +} \ No newline at end of file