![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/gositeme.com/public_html/whmcs/ |
<?php
/**
* Affiliate Cookie Tracking + Redirection Handler
*
* @package WHMCS
* @author WHMCS Limited <development@whmcs.com>
* @copyright Copyright (c) WHMCS Limited 2005-2018
* @license https://www.whmcs.com/license/ WHMCS Eula
* @version $Id$
* @link https://www.whmcs.com/
*/
use WHMCS\Affiliate\Referrer;
use WHMCS\Carbon;
use WHMCS\Cookie;
define("CLIENTAREA",true);
require("init.php");
// if affiliate id is present, update visitor count & set cookie
if ($aff = $whmcs->get_req_var('aff')) {
update_query("tblaffiliates",array("visitors"=>"+1"),array("id"=>$aff));
Cookie::set('AffiliateID',$aff,'3m');
$referrer = trim($_SERVER['HTTP_REFERER'] ?? '');
Referrer::firstOrCreate([
'affiliate_id' => $aff,
'referrer' => $referrer,
])->hits()->create([
'affiliate_id' => $aff,
'created_at' => Carbon::now()->toDateTimeString(),
]);
}
/**
* Executes when a user has clicked an affiliate referral link.
*
* @param int $affiliateId The unique id of the affiliate that the link belongs to
*/
run_hook("AffiliateClickthru", array(
'affiliateId' => $aff,
));
// if product id passed in, redirect to order form
if ($pid = $whmcs->get_req_var('pid')) redir("a=add&pid=".(int)$pid,"cart.php");
// if product group id passed in, redirect to product group
if ($gid = $whmcs->get_req_var('gid')) redir("gid=".(int)$gid,"cart.php");
// if register = true, redirect to registration form
if ($whmcs->get_req_var('register')) redir("","register.php");
// if gocart = true, redirect to cart with request params
if ($whmcs->get_req_var('gocart')) {
$reqvars = '';
foreach ($_GET AS $k=>$v) $reqvars .= $k.'='.urlencode($v).'&';
redir($reqvars,"cart.php");
}
// perform redirect
header("HTTP/1.1 301 Moved Permanently");
header("Location: ".$whmcs->get_config('Domain'),true,301);