| Server IP : 127.0.0.1 / Your IP : 216.73.216.48 Web Server : Apache/2.4.58 (Win64) OpenSSL/3.1.3 PHP/8.2.12 System : Windows NT DESKTOP-3H4FHQJ 10.0 build 19045 (Windows 10) AMD64 User : win 10 ( 0) PHP Version : 8.2.12 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : D:/xampp/htdocs-coblaa/Cinevaa/ |
Upload File : |
<?php
session_start();
include 'db.php';
if (!isset($_SESSION['my_id'])) {
header("Location: login.php");
exit();
}
$userID = $_SESSION['my_id'];
// Price list
$prices = ['daily' => 1000, 'weekly' => 5000, 'monthly' => 20000];
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['plan'])) {
$selectedPlan = $_POST['plan'];
// Check if user already has an active plan
$checkSql = "SELECT expiry_date FROM cine_subscriptiontb WHERE my_id = ? AND subscription_status = 'active' AND expiry_date > NOW()";
$checkStmt = $con->prepare($checkSql);
$checkStmt->bind_param("s", $userID);
$checkStmt->execute();
$result = $checkStmt->get_result();
if ($result->num_rows > 0) {
$currentPlan = $result->fetch_assoc();
$_SESSION['error_msg'] = "Active subscription exists until " . $currentPlan['expiry_date'];
header("Location: index.php?error=active_sub");
exit();
} else {
$_SESSION['selected_plan'] = $selectedPlan;
$_SESSION['amount'] = isset($prices[$selectedPlan]) ? $prices[$selectedPlan] : 0;
header("Location: payment_page.php");
exit();
}
}
?>