/** * Check if the key is valid and get the user * associated with it * @param string api_key * @return iduser or false */ function checkKey($api_key) { $do_api_user = new User(); $iduser = $do_api_user->validateAPIKey($api_key); if ($iduser) { $this->iduser = $iduser; return $this->iduser; } else { $this->setMessage("501", "The supplied API key is not valid"); return false; } }
<?php ob_start(); include_once "config.php"; include_once "class/OfuzApiMethods.class.php"; include_once "class/OfuzApiClient.class.php"; $api_key = 'f1976041736ccb95fbb322e1e5c07cbf'; // replace this with your API key $user = new User(); $iduser = $user->validateAPIKey($api_key); $idcontact = $_SESSION['do_User']->idcontact; //check for invoice already generated but not paid, if yes redirect to payment page if (!empty($idcontact)) { $invoice = new Invoice(); $idinvoice = $invoice->getContactInvoiceDetailsForPlanUpgrade($idcontact, $iduser); //echo "idinvoice: ".$idinvoice;exit(); if ($idinvoice != '0') { $do_api_user_rel = new UserRelations(); //$pay_url = 'http://ofuz.localhost/pay/'.$do_api_user_rel->encrypt($idinvoice).'/'.$do_api_user_rel->encrypt($idcontact); $pay_url = $GLOBALS['cfg_ofuz_site_https_base'] . 'pay/' . $do_api_user_rel->encrypt($idinvoice) . '/' . $do_api_user_rel->encrypt($idcontact); @header("location:{$pay_url}"); exit; } } $do_ofuz = new OfuzApiClient($api_key, 'php'); // $iduser = $do_ofuz->setAuth($api_key); // $do_ofuz->format = "php";// json,xml,php $do_ofuz->firstname = $_SESSION['do_User']->firstname; $do_ofuz->lastname = $_SESSION['do_User']->lastname; $response = $do_ofuz->search_contact(); $response = unserialize($response);
<?php require_once 'config.php'; include_once "class/OfuzApiMethods.class.php"; include_once "class/OfuzApiClient.class.php"; require_once 'class/User.class.php'; require_once 'class/Stripe.class.php'; require_once "class/stripe-lib/Stripe.php"; $api_key = 'f1976041736ccb95fbb322e1e5c07cbf'; // replace this with your API key $membership_amount = 24.0; set_time_limit(3600); $do_user = new User(); $adm_iduser = $do_user->validateAPIKey($api_key); if ($adm_iduser === false) { echo "Supplied api key is wrong"; exit; } $today = date('Y-m-d'); echo 'Monthly billing for Paid users ', $today, "\n\n"; $do_invoice1 = new Invoice(); $stripe_details = $do_invoice1->getUserStripeDetails($adm_iduser); if ($stripe_details !== false) { $stripe_api_key = $stripe_details['stripe_api_key']; $admin_email = $stripe_details['email']; } else { echo "Stripe api key is Missing"; exit; } $read_qry = new sqlQuery($conx); $sql_get_user = "******" . $today . "'";