34132-vm/payment_handler.php
Flatlogic Bot 7a4a20350d MagiCV
2025-09-17 12:13:33 +00:00

28 lines
663 B
PHP

<?php
session_start();
require 'db/config.php';
if (!isset($_SESSION['user_id'])) {
header('Location: login.php');
exit();
}
$user_id = $_SESSION['user_id'];
// Simulate a successful payment
// Update user role to 'pro'
$sql = "UPDATE users SET role = 'pro' WHERE id = ?";
$stmt = $pdo->prepare($sql);
if ($stmt->execute([$user_id])) {
// Update role in session
$_SESSION['role'] = 'pro';
$_SESSION['success_message'] = "Congratulations! You have successfully upgraded to the PRO plan.";
} else {
$_SESSION['error_message'] = "Something went wrong during the upgrade. Please try again.";
}
header('Location: dashboard.php');
exit();