![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/soundstudiopro.com/public_html/ |
<?php
session_start();
require_once 'config/database.php';
echo "<h2>Cart Test Page</h2>";
// Check if user is logged in
if (!isset($_SESSION['user_id'])) {
echo "<p style='color: red;'>❌ User not logged in</p>";
echo "<p>Session ID: " . session_id() . "</p>";
echo "<p>Session status: " . session_status() . "</p>";
} else {
echo "<p style='color: green;'>✅ User logged in: " . $_SESSION['user_id'] . "</p>";
}
// Check cart contents
echo "<h3>Cart Contents:</h3>";
if (isset($_SESSION['cart']) && !empty($_SESSION['cart'])) {
echo "<p style='color: green;'>✅ Cart has " . count($_SESSION['cart']) . " items:</p>";
echo "<ul>";
foreach ($_SESSION['cart'] as $index => $item) {
echo "<li>Item $index: " . json_encode($item) . "</li>";
}
echo "</ul>";
} else {
echo "<p style='color: orange;'>⚠️ Cart is empty or not set</p>";
}
// Check credit cart contents
echo "<h3>Credit Cart Contents:</h3>";
if (isset($_SESSION['credit_cart']) && !empty($_SESSION['credit_cart'])) {
echo "<p style='color: green;'>✅ Credit cart has " . count($_SESSION['credit_cart']) . " items:</p>";
echo "<ul>";
foreach ($_SESSION['credit_cart'] as $index => $item) {
echo "<li>Item $index: " . json_encode($item) . "</li>";
}
echo "</ul>";
} else {
echo "<p style='color: orange;'>⚠️ Credit cart is empty or not set</p>";
}
// Test adding a track to cart
echo "<h3>Test Add to Cart:</h3>";
echo "<form method='POST'>";
echo "<input type='hidden' name='action' value='add'>";
echo "<input type='hidden' name='track_id' value='1'>";
echo "<input type='hidden' name='artist_plan' value='free'>";
echo "<button type='submit'>Add Test Track to Cart</button>";
echo "</form>";
if ($_POST['action'] ?? '' === 'add') {
$track_id = intval($_POST['track_id'] ?? 0);
// Initialize cart if not exists
if (!isset($_SESSION['cart'])) {
$_SESSION['cart'] = [];
}
// Add test item to cart
$_SESSION['cart'][] = [
'track_id' => $track_id,
'title' => 'Test Track',
'artist_name' => 'Test Artist',
'artist_id' => 1,
'price' => 1.99,
'quantity' => 1,
'audio_url' => 'test.mp3',
'user_plan' => 'free',
'revenue_recipient' => 'platform',
'recipient_id' => 1,
'is_free_user_track' => true,
'type' => 'track'
];
echo "<p style='color: green;'>✅ Test track added to cart!</p>";
echo "<p>Cart now has " . count($_SESSION['cart']) . " items</p>";
// Force session write
session_write_close();
session_start();
}
// Show session info
echo "<h3>Session Info:</h3>";
echo "<p>Session ID: " . session_id() . "</p>";
echo "<p>Session status: " . session_status() . "</p>";
echo "<p>Session save path: " . session_save_path() . "</p>";
echo "<p>Session name: " . session_name() . "</p>";
// Test checkout redirect
echo "<h3>Test Checkout:</h3>";
echo "<a href='checkout.php' target='_blank'>Go to Checkout</a>";
echo "<br><br>";
echo "<a href='cart.php' target='_blank'>Go to Cart</a>";
?>