############################################### # FILE: index.php (place in webroot) ############################################### $user_dir, 'csv' => $user_dir . '/products.csv', 'html' => PAGES_DIR . '/' . $safe . '_shop.html', 'public_url' => 'data/pages/' . $safe . '_shop.html', // served via web ]; } /** * Check if logged in */ function is_logged_in(): bool { return !empty($_SESSION['logged_in']) && !empty($_SESSION['username']); } /** * Require login */ function require_login() { if (!is_logged_in()) { header('Location: index.php?page=login'); exit; } } /** * Simple navigation active helper */ function nav_active(string $p, string $current): string { return $p === $current ? 'class="active"' : ''; } /** * Generate HTML shopper page for user from CSV */ function generate_user_shop_page(string $username): ?string { $paths = get_user_paths($username); $csv_file = $paths['csv']; $html_file = $paths['html']; $rows = []; if (file_exists($csv_file)) { if (($fh = fopen($csv_file, 'r')) !== false) { while (($data = fgetcsv($fh)) !== false) { // Expect: [title, description, price, image_url, link_url] if (count($data) < 5) continue; $rows[] = [ 'title' => $data[0], 'description' => $data[1], 'price' => $data[2], 'image_url' => $data[3], 'link_url' => $data[4], ]; } fclose($fh); } } $safe_username = htmlspecialchars($username); ob_start(); ?> <?= $safe_username ?> Shopper Page - WorldRealm

Shopper Page

Curated products posted via WorldRealm WebID.

No products posted yet.

<?= htmlspecialchars($product['title']) ?>

$

View / Buy

Powered by WorldRealm.org

$username, 'email' => $email, // NOTE: simple hash for file-based; you can upgrade to password_hash if you want 'password' => password_hash($password, PASSWORD_DEFAULT), ]; if (save_users($users)) { // create dirs/CSV/HTML for user $paths = get_user_paths($username); if (!file_exists($paths['csv'])) { // create CSV header $fh = fopen($paths['csv'], 'w'); if ($fh) { fputcsv($fh, ['title','description','price','image_url','link_url']); fclose($fh); } } generate_user_shop_page($username); $register_success = true; } else { $register_errors[] = 'Failed to save user. Check file permissions.'; } } } /** * Handle login */ $login_errors = []; if ($page === 'login' && $_SERVER['REQUEST_METHOD'] === 'POST') { $ue = trim($_POST['username_or_email'] ?? ''); $password = $_POST['password'] ?? ''; if ($ue === '' || $password === '') { $login_errors[] = 'Both fields are required.'; } else { $users = load_users(); $user = find_user('username', $ue, $users); if (!$user) { $user = find_user('email', $ue, $users); } if ($user && password_verify($password, $user['password'])) { $_SESSION['username'] = $user['username']; $_SESSION['logged_in'] = true; header('Location: index.php?page=dashboard'); exit; } else { $login_errors[] = 'Invalid credentials.'; } } } /** * Handle logout */ if ($page === 'logout') { $_SESSION = []; session_destroy(); header('Location: index.php?page=home'); exit; } /** * Handle adding a product (CSV-based, no DB) for logged-in user */ $product_errors = []; $product_success = false; if ($page === 'dashboard' && $_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['add_product'])) { require_login(); $title = trim($_POST['title'] ?? ''); $description = trim($_POST['description'] ?? ''); $price = trim($_POST['price'] ?? ''); $image_url = trim($_POST['image_url'] ?? ''); $link_url = trim($_POST['link_url'] ?? ''); if ($title === '' || $price === '') { $product_errors[] = 'Title and price are required.'; } if (!$product_errors) { $username = $_SESSION['username']; $paths = get_user_paths($username); $csv_file = $paths['csv']; $fh = fopen($csv_file, 'a'); if ($fh) { fputcsv($fh, [$title, $description, $price, $image_url, $link_url]); fclose($fh); $url = generate_user_shop_page($username); $product_success = $url !== null; } else { $product_errors[] = 'Unable to write to CSV. Check permissions.'; } } } /** * HTML OUTPUT */ ?> WorldRealm Global Hub

WorldRealm � Double Dollar Portal

Unified hub for your radio, products, AI, and external apps.

Live Stream & Media

Pay $5 to Upload a Video

Pay $5 to submit your video for publishing on WorldRealm.

  1. Click the payment button and complete your $5 payment.
  2. Return here and submit your video file and payment email.

Pay $5 and Get Upload Access

(This demo does not verify payment automatically; you can review submissions manually or extend it later.)

Login to WorldRealm

No account yet? Register here.

Create WorldRealm Account

Registration successful. Log in now.

WorldRealm Dashboard

Welcome, .

Your CSV Product Manager

Product added and shopper page updated.

Your public shopper page:

Not available (check file permissions).

Add a new product

Links

WorldRealm WebID � Video Area

Dedicated hub for featured videos and paid uploads under /webid.

To upload your own video to WebID, complete the payment and submission from the Home portal. This demo does not automatically gate access yet, but the structure is in place.

Why WebID?

Page Not Found

The requested page does not exist. Return home.

############################################### # END index.php ###############################################