| Server IP : 10.200.247.200 / Your IP : 216.73.217.19 Web Server : Apache System : Linux synergy-usa-sites 6.8.0-138-generic #138-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 31 22:41:49 UTC 2026 x86_64 User : jeremy ( 1001) PHP Version : 8.4.25 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/usa_sites/usagrantapplications.org/vsa/ |
Upload File : |
<?php
/*
Copyright (c) 2007-present InnAnTech Industries
Author: Dave Guindon
Web: www.VirtualSmartAgent.com
Support: www.DaveGuindonSupport.com
Please send bug reports, suggestions and/or feedback to the support
website given above.
Virtual Smart Agent is a commercial software. Any distribution is strictly prohibited
unless a resale rights license was delivered along with this software.
*/
//get posted campaign id
$cid = $_GET['cid'];
//obtain data from cookies
$lid = $_COOKIE['vsa_lid'.$cid];
$aid = $_COOKIE['vsa_aid'.$cid];
$cli = $_COOKIE['vsa_cli'.$cid];
$pid = $_COOKIE['vsa_pid'.$cid];
//only register sale if all data is given
if ((isset($cid))&($cid!='')){
include('functions.php');
include('modfiles/db.php');
//get the ip address
$ip = $_SERVER['REMOTE_ADDR'];
//get todays date
$dtoday = time();
//connect to database here
$conn = mysql_connect("$dbhost", "$dblogin", "$dbpass") or die ('I cannot connect to the database.');
mysql_select_db($dbname, $conn);
//check for testmode
$result = mysql_query("SELECT * FROM $campaignTable WHERE id='$cid'",$conn);mysql_error()?(print(mysql_error())):'';
$camp = mysql_fetch_assoc($result);
if ($camp['testmode'] == '0'){
//try cookies first
if (((isset($lid))&($lid!=''))&&((isset($aid))&($aid!=''))&&((isset($cli))&($cli!=''))&&((isset($pid))&($pid!=''))){
//insert a new stat here
SetStats($cid,$aid,$pid,$cli,$lid,$ip,'sale','0');
//update this chat log with sale
//NEW update the chatend for all interactions for the case when closing doesn't work
$sql = "UPDATE $chatlogTable SET action='operation', chatend='$dtoday' WHERE id='$cli' AND cid='$cid'";
mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
//unset cookies to avoid logging duplicate sales
setcookie("vsa_lid".$cid, "", time()-60*60*24*100, "/");
setcookie("vsa_aid".$cid, "", time()-60*60*24*100, "/");
setcookie("vsa_cli".$cid, "", time()-60*60*24*100, "/");
setcookie("vsa_pid".$cid, "", time()-60*60*24*100, "/");
}else{
//try by ip ... this actually works pretty good. But will register if 2 visitors have the same ip address, which rarely happens.
$sql = "SELECT MAX(id), linksid, agentid, chatid FROM $linksdataTable WHERE cid='$cid' AND ip='$ip' GROUP BY ip";
$result = mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
if ($result){
$nc = mysql_num_rows($result);
if ($nc > 0){
$record = mysql_fetch_assoc($result);
$aid = $record['agentid'];
$cli = $record['chatid'];
$lid = $record['linksid'];
$sql = "SELECT * FROM $agentsTable WHERE id='$aid' AND cid='$cid'";
$picrecord = mysql_fetch_assoc($result);
$pid = $picrecord['picid'];
//check if this sale record already exists
$sql = "SELECT * FROM $statsTable WHERE cid='$cid' AND agentid='$aid' AND picid='$pid' AND chatlogid='$cli' AND linksid='$lid' AND ip='$ip' AND type='sale'";
$result = mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
if ($result){
$nc = mysql_num_rows($result);
if ($nc == 0){
//insert a new stat here
SetStats($cid,$aid,$pid,$cli,$lid,$ip,'sale','0');
//update this chat log with sale
//NEW update the chatend for all interactions for the case when closing doesn't work
$sql = "UPDATE $chatlogTable SET action='operation', chatend='$dtoday' WHERE id='$cli' AND cid='$cid'";
mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
}//end if nc
}//end if result
}//end if nc
}//end if result
}//end if lid,aid,cli,pid
}//end testmode
}//end if cid
exit;
?>