![]() 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
/**
* Create cart_snapshots table for purchase validation
*/
require_once 'config/database.php';
session_start();
if (!isset($_SESSION['is_admin']) || !$_SESSION['is_admin']) {
die("Admin access required");
}
$pdo = getDBConnection();
try {
$pdo->exec("
CREATE TABLE IF NOT EXISTS cart_snapshots (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
payment_intent_id VARCHAR(255) NOT NULL UNIQUE,
cart_items TEXT NOT NULL,
cart_hash VARCHAR(64),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
INDEX idx_payment_intent (payment_intent_id),
INDEX idx_user (user_id),
INDEX idx_created (created_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
");
echo "<h2>✅ Cart Snapshots Table Created</h2>";
echo "<p>The cart_snapshots table has been created successfully.</p>";
echo "<p>This table will store cart data before payment to validate purchases.</p>";
} catch (Exception $e) {
echo "<h2>❌ Error</h2>";
echo "<p>Error: " . htmlspecialchars($e->getMessage()) . "</p>";
}
?>