Location: PHPKode > projects > MembersGear > membersgear/affiliateSettings.php
<?php
   require_once "config/config.php";
  
   require_once INCLUDE_DIR."/users_class.php";   
   $users=new users_class(); 

   $PaygearWebserviceClient=new PaygearWebserviceClient();
            
    if(isset($_POST))
     {
        if(isset($_POST['vendor']) and isset($_POST['productPaymentOption']) and isset($_POST['product_users_affiliate_id']) )
         {
             
           $vendor=trim($_POST['vendor']);  
           $productPaymentOption=$_POST['productPaymentOption'] ;
           $paygearVendor=$PaygearWebserviceClient->getPaygearAffiliate($vendor);
           $paygearVendor=$paygearVendor['GetUserIdByUserNameResult'];
           $product_users_affiliate_id=$_POST['product_users_affiliate_id'];
           if($paygearVendor>0)
           {
                  $urlAffiliateLink=$PaygearWebserviceClient->getPaygearAffiliateLink($productPaymentOption,$vendor);  
                  $urlAffiliateLink=$urlAffiliateLink['GetAffiliateCampaignLinkResult'];
                  
                  
                   
                  if($urlAffiliateLink==false)
                   {
                     $message->SetMessage('No affiliate link found.');
                     redirect($_SERVER['HTTP_REFERER']) ;
                   } 
                  else
                   {
                     $isactive=1;  
                     $link=urlencode($urlAffiliateLink);
                     $query="update ".TABLE_PREFIX."product_users_affiliate set paygear_campaign_link='$link', 
                              isactive=$isactive where id=$product_users_affiliate_id ";
                              
                     $update=$users->Update($query,false,false);
                     redirect($_POST['sThankyouPageUrl']);   
                   }
             
              }
             else
              {
                   $message->SetMessage('No affiliate found.');
                   redirect($_SERVER['HTTP_REFERER']) ;
               }
                 
         
         }   
         
         
         
     }
?>
Return current item: MembersGear