( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ HEX
HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux mail.thebrand.ai 6.8.0-107-generic #107-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 13 19:51:50 UTC 2026 x86_64
User: www-data (33)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/www/html/tmpr/../tmpr/../tmpr/../wowZ/debug_folder.php
<?php
require_once __DIR__ . '/dashboard/config.php';

$folderId = 7;
$currentUserId = $userid; // From config.php

echo "Current User ID: $currentUserId\n";
echo "Checking access for Folder ID: $folderId\n";

// Access check logic from brandDetails.php
$allowed = false;
$foldersOwnerCol = teams_find_owner_column($conn, 'brand_teams_folders');
echo "Owner Column: " . ($foldersOwnerCol ? $foldersOwnerCol : "None") . "\n";

if ($foldersOwnerCol) {
    $stmt = $conn->prepare("SELECT * FROM brand_teams_folders WHERE id=? AND `$foldersOwnerCol`=? LIMIT 1");
    if ($stmt) {
        $stmt->bind_param('ii', $folderId, $currentUserId);
        $stmt->execute();
        $res = $stmt->get_result();
        if ($res && $res->num_rows) {
            $allowed = true;
            echo "Access allowed via ownership.\n";
            $row = $res->fetch_assoc();
            print_r($row);
        } else {
             echo "Not owner.\n";
        }
        $stmt->close();
    }
}

if (!$allowed) {
    $stmt = $conn->prepare("SELECT * FROM brand_teams_folder_members WHERE folder_id=? AND user_id=? LIMIT 1");
    if ($stmt) {
        $stmt->bind_param('ii', $folderId, $currentUserId);
        $stmt->execute();
        $res = $stmt->get_result();
        if ($res && $res->num_rows) {
            $allowed = true;
            echo "Access allowed via membership.\n";
            $row = $res->fetch_assoc();
            print_r($row);
        } else {
            echo "Not a member.\n";
        }
        $stmt->close();
    }
}

if (!$allowed) {
    echo "Access DENIED.\n";
} else {
    echo "Access GRANTED.\n";
    
    // Check content
    echo "Fetching content...\n";
    $stmt = $conn->prepare("SELECT f.id, f.file_path, f.title, f.url, f.kind, p.title AS p_title, p.poster AS p_poster 
                            FROM brand_teams_folder_files f 
                            LEFT JOIN profilepicture p ON p.id=f.file_path 
                            WHERE f.folder_id=? 
                            ORDER BY f.id DESC LIMIT 200");
                            
    if ($stmt) {
        $stmt->bind_param('i', $folderId);
        $stmt->execute();
        $res = $stmt->get_result();
        $count = 0;
        while ($res && ($row = $res->fetch_assoc())) {
            $count++;
            echo "Item $count: ID={$row['id']}, Kind={$row['kind']}, URL={$row['url']}, P_Poster={$row['p_poster']}\n";
        }
        if ($count == 0) {
            echo "No content found in brand_teams_folder_files for folder_id=$folderId.\n";
        }
        $stmt->close();
    } else {
        echo "Prepare failed: " . $conn->error . "\n";
    }
}