Esempio n. 1
0
<div style="margin: 0 auto;padding-top:200px;text-align:center;"><img src="images/ajax-loader.gif" /></div>
<?php 
session_start();
include_once 'class/class.cookie.php';
include_once 'class/class.main.php';
$db = new db();
$connector = new fucn();
/*
if(isset($_REQUEST['cust_id']) && !empty($_COOKIE[phpaffiliateid])){
    $db->db_connect();
    $affid = $_COOKIE[phpaffiliateid];
	$customerId = $_REQUEST['cust_id'];
	$url_details = 'http://'. $db->xmluser .':'. $db->xmlpwd .'@tabluu.chargify.com/customers/'.$customerId.'/subscriptions.xml';
	//$url_details = 'http://'. $db->xmluser .':'. $db->xmlpwd .'@tripbull.chargify.com/customers/'.$customerId.'/subscriptions.xml';	
	$result = file_get_contents($url_details);
	$objxml = simplexml_load_string($result);	
	$prodId = $objxml->subscription->product->id;
	if($db->freever == $prodId){
		$sql = "INSERT INTO affplan SET affId = $affid,chargify_cust_id = '$customerId'" ; $query = mysql_query($sql);
		//header("Location: http://tabluu.applicationcraft.com/app#/app?cust_id=$cust_id&subs_id=$subs_id");
		header("Location: app/signup.html?cust_id=$cust_id&subs_id=$subs_id");
	}else{
		$sql = "INSERT INTO affplan SET affId = $affid,paid=1,chargify_cust_id = '$customerId'" ; $query = mysql_query($sql);
		$sqlsale = "SELECT sales,commission,unpaid,paid FROM affsale WHERE affId = ".$affid;
		$resultsale = mysql_query($sqlsale);
		if(mysql_num_rows($resultsale)){
			$row2 = mysql_fetch_object($resultsale);
			$sales =  $row2->sales + 1;
			$commision =  $row2->commission + 20;
			$unpaid =  $row2->unpaid + 20;
			$sql = "UPDATE affsale SET sales=". $sales .",commission=". $commision .",unpaid=". $unpaid ." WHERE affId = ".$affid;
Esempio n. 2
0
function checkshortULR()
{
    include_once 'class/class.main.php';
    $connect = new db();
    $connect->db_connect();
    $con = new fucn();
    $link = strtolower($con->rand_string(6));
    $result = mysql_query("SELECT id,source FROM businessshorturl WHERE link = '{$link}'");
    //check if link is existed
    if (mysql_num_rows($result)) {
        checkshortULR();
    } else {
        return $link;
    }
    $connect->db_connect();
}
Esempio n. 3
0
function checknicename()
{
    include_once 'class/class.main.php';
    $connect = new db();
    $connect->db_connect();
    $con = new fucn();
    $link = strtolower($con->rand_string(7));
    $result = mysql_query("SELECT id FROM businessProfile WHERE nicename = '{$link}'");
    //check if link is existed
    if (mysql_num_rows($result)) {
        checknicename();
    } else {
        return $link;
    }
    $connect->db_connect();
}
Esempio n. 4
0
<?php

include_once 'class/class.phpmailer2.php';
include_once 'class/class.main.php';
$connector = new fucn();
$connect = new db();
$connect->db_connect();
//if(isset($_REQUEST['Guid'])){
$request = json_encode($_REQUEST);
$request = json_decode($request);
//$sql = "INSERT INTO `webhooks` (`details`) VALUES ('". json_encode($_REQUEST) ."')";
//$result = mysql_query($sql);
if ($_REQUEST['event'] == 'renewal_failure') {
    $subscription_id = (int) $request->payload->subscription->id;
    $sql = "SELECT g.productId,g.gId FROM businessUserGroup AS g WHERE g.subscription_id = {$subscription_id} LIMIT 1";
    $row = mysql_fetch_object(mysql_query($sql));
    $groupID = $row->gId;
    $comp_id_prev = $connector->getCurrentComponentId((int) $row->productId);
    $url = '/subscriptions/' . $subscription_id . '/components/' . $comp_id_prev . '.xml';
    $result = $connector->sendRequest($url, $format = 'xml', $method = 'GET', $data = '');
    if ($result->code == 200) {
        $objxml = simplexml_load_string($result->response);
        $allocate = (int) $objxml->allocated_quantity;
        if ($allocate > 0) {
            $url = '/subscriptions/' . $subscription_id . '/components/' . $comp_id_prev . '/allocations.xml';
            $data = '<?xml version="1.0" encoding="UTF-8"?>
				  <allocation>
					  <quantity>0</quantity>
					  <proration_downgrade_scheme>"no-prorate"</proration_downgrade_scheme>
					   <proration_upgrade_scheme>"no-prorate"</proration_upgrade_scheme>
				  </allocation>';