| Server IP : 74.208.236.18 / Your IP : 216.73.216.45 Web Server : Apache System : Linux infong654 4.4.400-icpu-108 #2 SMP Wed Feb 11 10:12:42 UTC 2026 x86_64 User : u39365822 ( 135825) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /homepages/7/d147067425/htdocs/ |
Upload File : |
<?php
session_start();
require_once("includes/db_con_get.php");
if(!isset($_SESSION['loggedin']) && @$_SESSION['loggedin'] != '1'):
header("Location:index.php");
endif;
$userID=$_SESSION['CURRENT_THERIPIST']['id'];
$payment_id=$statusMsg=$api_error='';
$ordStatus='error';
if(!empty($userID) && !empty($_POST['stripeToken'])){
$token = $_POST['stripeToken'];
$name = $_POST['card_name'];
$email = $_POST['email_address'];
$WP_quantity=$PP_quantity=$PMG_quantity=0;
if(isset($_POST['WP-price-checkbox'])){
$WP_quantity = $_POST['WP-quantity'];
}
$WP_base_price = $_POST['WP-price-checkbox'];
if(isset($_POST['PP-price-checkbox'])){
$PP_quantity = $_POST['PP-quantity'];
}
$PP_base_price = $_POST['PP-price-checkbox'];
if(isset($_POST['PMG-price-checkbox'])){
$PMG_quantity = $_POST['PMG-quantity'];
}
$PMG_base_price = $_POST['PMG-price-checkbox'];
$totalamount = $_POST['totalamount'];
$card_number = preg_replace('/\s+/', '', $_POST['card_number']);
$card_exp_month = $_POST['card_exp_month'];
$card_exp_year = $_POST['card_exp_year'];
$card_cvc = $_POST['card_cvc'];
$currency = "usd";
require_once 'stripe-php/init.php';
\Stripe\Stripe::setApiKey(STRIPE_API_KEY);
$customer = \Stripe\Customer::create(array(
'email' => $email,
'description' => 'WP/PP/PMG Purchase',
'source' => $token
));
$totalAmount = 100*$totalamount;
if($customer){
try {
$payDetails = \Stripe\Charge::create(array(
'customer' => $customer->id,
'amount' => $totalAmount,
'currency' => $currency,
'description' => "WP/PP/PMG Purchase"
));
}catch(Exception $e) {
$api_error = $e->getMessage();
}
}
if(empty($api_error) && $payDetails){
$payData = $payDetails->jsonSerialize();
if($payData['status'] == 'succeeded'){
$subscrID= $payData['id'];
$custID = $payData['customer'];
$planID = '';
$planAmount = ($payData['amount']/100);
$planCurrency = $payData['currency'];
$planinterval = '';
$planIntervalCount = '';
$created = date("Y-m-d H:i:s", $payData['created']);
$current_period_start = '';
$current_period_end = '';
$status = $payData['status'];
$sql = "INSERT INTO therepist_payment (txn_id,user_id,stripe_customer_id,stripe_plan_id,plan_amount,plan_amount_currency,plan_interval,plan_interval_count,payer_email,created,plan_period_start,plan_period_end,status,created_at,updated_at) VALUES('".$subscrID."','".$userID."','".$custID."','".$planID."','".$planAmount."','".$planCurrency."','".$planinterval."','".$planIntervalCount."','".$email."','".$created."','".$current_period_start."','".$current_period_end."','".$status."',now(),now())";
$insert = $con->query($sql);
if($insert && !empty($userID)){
//$subscription_id = $con->insert_id;
$therapist_sql="SELECT * FROM therapist where id = {$userID}";
$select = $con->query($therapist_sql);
$row = $select->fetch_array(MYSQLI_ASSOC);
$Total_WP_quantity= $row['profiler'] + $WP_quantity;
$Total_PP_quantity= $row['Periodic_profiler'] + $PP_quantity;
$Total_PMG_quantity= $row['PMG'] + $PP_quantity;
$update = $con->query("UPDATE therapist SET profiler = {$Total_WP_quantity},PMG= {$Total_PMG_quantity}, Periodic_profiler= {$Total_PP_quantity} WHERE id = {$userID}");
}
$ordStatus = 'success';
$statusMsg = 'Your Payment has been Successful!';
}else{
$statusMsg = "Your Payment has been failed!";
}
}else{
$statusMsg = "Your Payment Charge has been failed! ".$api_error;
}
}else{
$statusMsg = "Error on form submission, please try again.";
}
?>
<!DOCTYPE html>
<html lang="en">
<?php include("includes/header.php"); ?>
<body class="sb-nav-fixed">
<?php include("includes/topnavbar.php"); ?>
<div id="layoutSidenav">
<?php include("includes/sidenavbar.php"); ?>
<div id="layoutSidenav_content">
<main>
<div class="container-fluid px-4">
<h3 class="mt-4">Payment Status</h3>
</br>
<div class="card mb-4">
<div class="card-header py-3">
<div class="row">
<div class="col-md-10">
<i class="fas fa-table me-1"></i>Payment Status</div>
<div class="col-md-2">
<a href="dashboard.php" class="btn btn-primary" style="font-size:15px;" ><i class="fas fa-arrow-left"></i> Return to Dashboard</a>
</div>
</div>
</div>
<div class="card-body" style="text-align:center;">
<div class="status">
<h1 class="<?php echo $ordStatus; ?>"><?php echo $statusMsg; ?></h1>
<?php if(!empty($subscrID)){ ?>
<h4>Payment Information</h4>
<p><b>Reference Number:</b> <?php echo $subscription_id; ?></p>
<p><b>Transaction ID:</b> <?php echo $subscrID; ?></p>
<p><b>Amount:</b> <?php echo $planAmount.' '.$planCurrency; ?></p>
<?php } ?>
</div>
<a href="payment_form.php" class="btn-link">Back to Payment Page</a>
</div>
</div>
</main>
<?php include("includes/footer.php"); ?>
</div>
</div>
<?php include("includes/footer_js.php"); ?>
</body>
</html>