<?php

session_start();
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST');
header("Access-Control-Allow-Headers: X-Requested-With");


/*if(isset($_POST['user_id']) && isset($_POST['auth']) && isset($_POST['ref']) && isset($_POST['package_id']))
{
    
include 'config.php';
$user_id=$_POST['user_id'];
$email=$_POST['email'];
$auth=$_POST['auth'];
$ref=$_POST['ref'];
$package_id=$_POST['package_id'];

$user_id=stripslashes($user_id);
$user_id=mysqli_escape_string($con, $user_id);

$auth=stripslashes($auth);
$auth=mysqli_escape_string($con, $auth);

$ref=stripslashes($ref);
$ref=mysqli_escape_string($con, $ref);

$package_id=stripslashes($package_id);
$package_id=mysqli_escape_string($con, $package_id);

$date_t = date("d-m-Y");
$date_t2 = date("m/d/Y");
$date_t2 = strtotime($date_t);



$sqlx=$con->query("SELECT * FROM packages WHERE  package_id = '$package_id'") or die("Error2 : ". mysqli_error($con));

if($sqlx)
{
$rowx=mysqli_fetch_array($sqlx);
$level = $rowx['level'];
$plan_id = $rowx['package_id'];
$package = $rowx['package_name'];
$plan = $rowx['plan'];
$package_type = $rowx['package_type'];
$period = $rowx['duration'];
$package_amount = $rowx['amount'];
$currency = "NGN";
}

  $sqlz=$con->query("INSERT INTO reference  (user_id, reference, plan_id, plan, plan_level, amount, email, status, date_t) 
      VALUES ('$user_id', '$ref', '$plan_id', '$package', '$level', '$package_amount', '$email', 'Pending', '$date_t')") or die("Error: ".mysqli_error($con));

if($sqlz)
{
$status = true;
$suc = "Success";
}
else
{
  $status = false;
$suc = "Error";
  
}
$output = array('status' => $status, 'success'=>$suc, 'user_id' => $user_id, 'email'=> $email, 'package'=> $package, 'package_id'=> $plan_id);
echo json_encode($output); //output JSON data
*/

$status = true;
$suc = "Success";

$output = array('status' => $status, 'success'=>$suc, 'user_id' => $user_id, 'email'=> $email, 'package'=> $package, 'package_id'=> $plan_id);
echo json_encode($output); //output JSON data


//}

?>