MOON
Server: Apache
System: Linux e2e-78-16.ssdcloudindia.net 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
User: imensosw (1005)
PHP: 8.0.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/imensosw/www/imenso.co/demo/mcm/stripe_payment.php
<?php
function olddb()
{
   $conn=mysql_connect("localhost","root","") or die(mysql_error());
   $db=mysql_select_db("mcm",$conn) or die(mysql_error()); 
}
// Stripe library
require 'stripe/Stripe.php';

$params = array(
  "testmode"   => "on",
  "private_live_key" => "sk_live_WMIPZ1LdvHKwsQAewdqqzRak",
  "public_live_key"  => "sk_live_WMIPZ1LdvHKwsQAewdqqzRak",
  "private_test_key" => "sk_test_S1fCgaaB46VML0cVZUYt0U6d",
  "public_test_key"  => "pk_test_PuroXKb9Rtn0zqh1ZVbYg42H"
);

if ($params['testmode'] == "on") {
  Stripe::setApiKey($params['private_test_key']);
  $pubkey = $params['public_test_key'];
} else {
  Stripe::setApiKey($params['private_live_key']);
  $pubkey = $params['public_live_key'];
}

if(isset($_POST['stripeToken']))
{
  $amount_cents = str_replace(".","","10.52");  // Chargeble amount
  $invoiceid = "14526321";                      // Invoice ID
  $description = "Invoice #" . $invoiceid . " - " . $invoiceid;
  
  try {

    $charge = Stripe_Charge::create(array(     
        "amount" => $amount_cents,
        "currency" => "usd",
        "source" => $_POST['stripeToken'],
        "description" => $description)        
    );

    if ($charge->card->address_zip_check == "fail") {
      throw new Exception("zip_check_invalid");
    } else if ($charge->card->address_line1_check == "fail") {
      throw new Exception("address_check_invalid");
    } else if ($charge->card->cvc_check == "fail") {
      throw new Exception("cvc_check_invalid");
    }
    // Payment has succeeded, no exceptions were thrown or otherwise caught       

    $result = "success";

  } catch(Stripe_CardError $e) {      

  $error = $e->getMessage();
    $result = "declined";

  } catch (Stripe_InvalidRequestError $e) {
    $result = "declined";     
  } catch (Stripe_AuthenticationError $e) {
    $result = "declined";
  } catch (Stripe_ApiConnectionError $e) {
    $result = "declined";
  } catch (Stripe_Error $e) {
    $result = "declined";
  } catch (Exception $e) {

    if ($e->getMessage() == "zip_check_invalid") {
      $result = "declined";
    } else if ($e->getMessage() == "address_check_invalid") {
      $result = "declined";
    } else if ($e->getMessage() == "cvc_check_invalid") {
      $result = "declined";
    } else {
      $result = "declined";
    }     
  }
if(isset($_POST['Daniel']))
{


  olddb();
 $create_date = date('d-m-y');
 $sql="insert into SaveContactForm7_3(created_on,Daniel,Week,Appelbee,email,Tittle,FirstName,LastName,UnitedKingdom,Housenumber,ZipCode, country)values('".$create_date."','".$_POST['Daniel']."','".$_POST['Week']."','".$_POST['Appelbee']."','".$_POST['email']."','".$_POST['Tittle']."','".$_POST['FirstName']."','".$_POST['LastName']."','".$_POST['UnitedKingdom']."','".$_POST['Housenumber']."','".$_POST['ZipCode']."','".$_POST['country']."')";
     $q=mysql_query($sql)  or die(mysql_error());

     /*
       $txnid = $_POST['txnid'];
     $sql="insert into payments(txnid) values('".$txnid."')";
     $q=mysql_query($sql)  or die(mysql_error());*/
}

  echo json_encode(array('status'=>'y');
 /* echo "<BR>Stripe Payment Status : ".$result;
  
  echo "<BR>Stripe Response : ";
  
  print_r($charge); exit;*/
}
?>
?>