| 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/usafundingapplications.org/vsa/ |
Upload File : |
<?php
die();
/*
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.
Some code for FF and Opera
window.onbeforeunload = function (e) {
var e = e || window.event;
// For IE and Firefox
if (e) {
e.returnValue = 'Any string';
}
// For Safari
return 'Any string';
};
*/
include('modfiles/db.php');
include('functions.php');
//------some variables that can be changed--------//
$mousetop = 5; //px from top above active mouse band
$mouseheight = 5; //height of active mouse band in px
//---------don't change anything below------------//
//get posted data
$cid = $_GET['cid']; //campaign id
$testmode = $_GET['tmd']; //posted test mode variable
if (!isset($testmode)||$testmode==''){$testmode=0;}
if (!isset($cid)||$cid==''){$cid=1;}
//connect to database
$conn = mysql_connect("$dbhost", "$dblogin", "$dbpass") or die ('I cannot connect to the database.');
mysql_select_db($dbname, $conn);
//first check if there are any live agents
$sql = "SELECT * FROM $agentsTable WHERE cid='$cid'";
$result = mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
if ($result){
$nc = mysql_num_rows($result);
if ($nc == 0){
echo '';
exit;
}
}else{
//an error - no table resource
echo '';
exit;
}
//collect more information about the visitor here
$ip = $_SERVER['REMOTE_ADDR'];
//incrememnt and record pageview here
SetStats($cid,0,0,0,0,$ip,'pageview',$testmode);
//get required data for the agent chat window
$sql = "SELECT * FROM $settingsTable";
$result = mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
$data = mysql_fetch_assoc($result);
$installfolder = $data['installfolder'];
$installsite = $data['installsite'];
$location = $installsite.$installfolder.'agentfiles/agent.php?cid='.$cid.'&ip='.$ip.'&tmd='.$testmode;
//need more campaign settings here
$sql = "SELECT * FROM $campaignTable WHERE id='$cid'";
$result = mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
$camp = mysql_fetch_assoc($result);
$bordercolor = $camp['bordercolor'];
$bordersize = $camp['bordersize'];
$borderstyle = $camp['borderstyle'];
$captioncolor = $camp['captioncolor'];
$captiontext = $camp['captiontext'];
$captiontextcolor = $camp['captiontextcolor'];
$captiontextbold = $camp['captiontextbold'];
$captiontextitalic = $camp['captiontextitalic'];
$captiontextsize = $camp['captiontextsize'];
$alertmessage = $camp['alertmessage'];
$chatwintype = $camp['chatwintype'];
$disable = $camp['disablelinks'];
$backcolor = $camp['backcolor'];
$aweber_useaweber = $camp['aweber_useaweber'];
$chatwidth = $camp['chatwidth'];
$chatheight = $camp['chatheight'];
$displayperiod = $camp['displayperiod'];
$displaymethod = $camp['displaymethod']; //dialog,mouse,none
$mousetimes = $camp['mousetimes']; //1: once per session, 2: every time mouse moves up off page
$usemousemessage = $camp['usemousemessage'];
$captiontext = stripslashes($captiontext);
//extract disable links and forms data
$tmp = explode(':',$disable);
$disablelinks = $tmp[0];
if (!$tmp[1]){
$disableforms = 'yes';
}else{
$disableforms = $tmp[1];
}
//dimensions for popup style agent window
$awinWidth = $chatwidth ; //510
$awinHeight = $chatheight; //340
$awinFrameWidth = $chatwidth - 10; //500
$awinFrameHeight = $chatheight - 30; //300
//dimensions for thickbox modal style agent window
$tboxWidth = $chatwidth - 50; //450
$tboxHeight = $chatheight - 50; //280
//check if the built-in aweber form is used
if ($aweber_useaweber == '1'){
$ww = 70;
$awinHeight = $awinHeight + $ww;
$awinFrameHeight = $awinFrameHeight + $ww;
$tboxHeight = $tboxHeight + $ww;
}
//determine if this chat is set to display once during a set number of hours
if (($testmode == 0)&&($displayperiod > 0)){
$cp = 'function createVSACookie(name,value,hours) { if (hours) { var date = new Date(); date.setTime(date.getTime()+(hours*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; }'."\n";
$cp .= 'function readVSACookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(\';\'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==\' \') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; }'."\n";
$cp .= 'var gx = 0; if (readVSACookie(\'vsacookie\') != null){ gx = 1; }else{ createVSACookie(\'vsacookie\',\'yes\','.$displayperiod.'); }'."\n";
}else{
$cp = 'var gx = 0;'."\n";
}
//use an addLoadEvent function to deal with mutliple window.onload functions
$cp .= 'function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != \'function\') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); }}}'."\n";
//this function checks to see if any anchor tags already have the onclick event assigned
$cp .= 'function addClickEvent(a,i,func) { if (typeof a[i].onclick != \'function\') { a[i].onclick = func; } }'."\n";
//set onclick events for links on the page .. check for initiating chat through links containing the rel attribute
$cp .= 'var lx = 0;'."\n";
if (($disablelinks == 'yes')&&($displaymethod == 'dialog')){
$onclick = 'var a = document.getElementsByTagName(\'A\'); for (var i = 0; i < a.length; i++) { var st = a[i].rel; st = st.toLowerCase(); var stt = a[i].rev; stt = stt.toLowerCase(); var sttt = a[i].id; sttt = sttt.toLowerCase(); if ((st == "showvsachat")||(stt == "showvsachat")||(sttt == "showvsachat")){ addClickEvent(a,i,function(){ if(lx==0){DisplayLinkChat();} }); }else{ addClickEvent(a,i, function(){gx=1;}); }}';
}else{
$onclick = 'var a = document.getElementsByTagName(\'A\'); for (var i = 0; i < a.length; i++) { var st = a[i].rel; st = st.toLowerCase(); var stt = a[i].rev; stt = stt.toLowerCase(); var sttt = a[i].id; sttt = sttt.toLowerCase(); if ((st == "showvsachat")||(stt == "showvsachat")||(sttt == "showvsachat")){ addClickEvent(a,i, function(){ if(lx==0){DisplayLinkChat();} }); }}';
}
$onclick = 'vsadisablelinksfunc = function(){'.$onclick.'}'."\n";
$onclick .= 'addLoadEvent(vsadisablelinksfunc);'."\n";
//this disables the chat from appearing for all form submits. This only applies to the on exit initiation method
if (($disableforms == 'yes')&&($displaymethod == 'dialog')){
//this disables all forms using onclick
//$cp .= 'var f = document.getElementsByTagName(\'FORM\'); for (var i=0;i<f.length;i++){ f[i].onclick=function(){gx=1;} }'."\n";
//this one looks for forms that are not using the OnClick or OnSubmit events and applies the disabled code. If both are already being used, then the form will not be disabled. I did this so that vsa
//will not interfere with other scripts forms may already be using.
$onclick .= 'vsadisableformsfunc = function(){ var f = document.getElementsByTagName(\'FORM\'); for (var i=0;i<f.length;i++){ if (!f[i].onclick){ f[i].onclick=function(){ gx=1; } }else if (!f[i].onsubmit){ f[i].onsubmit=function(){ gx=1; }}}}'."\n";
$onclick .= 'addLoadEvent(vsadisableformsfunc);'."\n";
}
//build the mouse moving function
if ($displaymethod == 'mouse'){
$cp .= 'var ox = '.$mousetimes.';'."\n";
$cp .= 'if ((ox == 1) || (ox == 2)){ var ytt = 0; var yy = 0; var yp = 0; var st = 0; var xh = '.$mouseheight.'; var xt = '.$mousetop.'; var dd = 0; var ff = 0; var IE = document.all?true:false; if (!IE) { document.captureEvents(Event.MOUSEMOVE); document.captureEvents(Event.MOUSEDOWN); document.captureEvents(Event.MOUSEUP);} document.onmousemove = getMouseXY; document.onmousedown = getMouseDown; document.onmouseup = getMouseUp;}'."\n";
$cp .= 'function getMouseXY(e) { if (!e) var e = window.event; if (IE) { ytt = event.clientY + document.body.scrollTop; } else { ytt = e.pageY - window.pageYOffset; } yp = yy; yy = ytt; dd = yy-yp; if (ox == 2){ if (yy >= xh){st = 1;} }else{ if ((yy >= xh) & (st != 2)){ st = 1; }} if ((st == 1) & (yy <= (xh+xt)) & (yy >= xt) & (dd <= 0)){ if(IE){ DisplayMouseChat(); st = 2;}else{ if(ff == 0){DisplayMouseChat(); st = 2;} }}}'."\n";
$cp .= 'function getMouseDown(e) { if (!e) var e = window.event; if ((!IE)&&(e.which==1)) ff = 1; }'."\n";
$cp .= 'function getMouseUp(e) { if (!e) var e = window.event; if ((!IE)&&(e.which==1)) ff = 0; }'."\n";
}else{
$cp .= 'var ox = 0;'."\n";
}
//build the normal agent window code with dragabble option
$awin = $cp."\n";
//add css code to force non-modal floating window to display above everything on the page
$awin .= 'document.write('."'".'<style type="text/css">'."'".');'."\n";
$awin .= 'document.write('."'".'#floatingWindow {'."'".');'."\n";
$awin .= 'document.write('."'".'z-index:999;'."'".');'."\n";
$awin .= 'document.write('."'".'position:absolute;'."'".');'."\n";
$awin .= 'document.write('."'".'top:50px;'."'".');'."\n";
$awin .= 'document.write('."'".'}'."'".');'."\n";
$awin .= 'document.write('."'".'</style>'."'".');'."\n";
$awin .= 'var ns4=document.layers;var ie4=document.all;var ns6=document.getElementById&&!document.all;var dragswitch=0;var nsx;var nsy;var nstemp;'."\n";
$awin .= 'function drag_dropns(name){if (!ns4) return;temp=eval(name);temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP);temp.onmousedown=gons; temp.onmousemove=dragns; temp.onmouseup=stopns;}'."\n";
$awin .= 'function gons(e){temp.captureEvents(Event.MOUSEMOVE);nsx=e.x;nsy=e.y; }'."\n";
$awin .= 'function dragns(e){if (dragswitch==1){temp.moveBy(e.x-nsx,e.y-nsy);return false;}}'."\n";
$awin .= 'function stopns(){temp.releaseEvents(Event.MOUSEMOVE);}'."\n";
$awin .= 'function drag_drop(e){if (ie4&&dragapproved){crossobj.style.left=tempx+event.clientX-offsetx;crossobj.style.top=tempy+event.clientY-offsety;return false;}else if (ns6&&dragapproved){crossobj.style.left=tempx+e.clientX-offsetx+"px";crossobj.style.top=tempy+e.clientY-offsety+"px";return false;}}'."\n";
$awin .= 'function initializedrag(e){crossobj=ns6? document.getElementById("agentpopup") : document.all.agentpopup;var firedobj=ns6? e.target : event.srcElement;var topelement=ns6? "html" : document.compatMode && document.compatMode!="BackCompat"? "documentElement" : "body";while (firedobj.tagName!=topelement.toUpperCase() && firedobj.id!="dragbar"){firedobj=ns6? firedobj.parentNode : firedobj.parentElement;}if (firedobj.id=="dragbar"){offsetx=ie4? event.clientX : e.clientX;offsety=ie4? event.clientY : e.clientY;tempx=parseInt(crossobj.style.left);tempy=parseInt(crossobj.style.top);dragapproved=true;document.onmousemove=drag_drop;}}'."\n";
$awin .= 'document.onmouseup=new Function("dragapproved=false; if (ox > 0){document.onmousemove = getMouseXY;}");'."\n";
$awin .= 'function CloseAgent(){if(window.confirm("Are you sure you wish to close this chat?")){lx = 0; if(ox > 0){gx = 0;} if(ns4){document.agentpopup.display = "none";}else if (ie4){document.all[\'agentpopup\'].style.display = "none";}else if (ns6){document.getElementById(\'agentpopup\').style.display = "none";}}}'."\n";
$awin .= 'function ShowChatNew(){if(ns4 && document.agentpopup){document.agentpopup.display = "inline";}else if (ie4 && document.all[\'agentpopup\']){document.all[\'agentpopup\'].style.display = "inline";}else if (ns6 && document.getElementById(\'agentpopup\')){document.getElementById(\'agentpopup\').style.display = "inline";}else{showChat();}}'."\n";
$awin .= 'function showChat(){'."\n";
$awin .= 'theDiv = \'<div id="agentpopup" name="agentpopup" style="width: '.$awinWidth.'px; height: '.$awinHeight.'px; display: block; position: absolute; top: 50px; left: 50px; border: #'.$bordercolor.' '.$bordersize.'px '.$borderstyle.'; padding-bottom: 0; padding-left: 0; padding-right: 0; padding-top: 0; margin: 0; background: #'.$backcolor.'" >\';'."\n";
$awin .= 'theDiv = theDiv + \'<table width="100%" cellpadding="3" cellspacing="0" border="0">\';'."\n";
$awin .= 'theDiv = theDiv + \'<tr>\';'."\n";
$awin .= 'theDiv = theDiv + \'<td align="left" bgcolor="#'.$captioncolor.'" width="90%" style="cursor: move" id="dragbar" onMousedown="initializedrag(event)"><ilayer width="100%" onSelectStart="return false"><layer width="100%" onMouseover="dragswitch=1;if (ns4) drag_dropns(showimage)" onMouseout="dragswitch=0"><span style="font-size: '.$captiontextsize.'; font-family:Arial, Helvetica, sans-serif; color: #'.$captiontextcolor.'; font-weight: '.$captiontextbold.'; font-style: '.$captiontextitalic.'">'.$captiontext.'</span></layer></ilayer></td>\';'."\n";
$awin .= 'theDiv = theDiv + \'<td align="right" bgcolor="#'.$captioncolor.'"><a href="#" onclick="javascript:CloseAgent();" style="font-size: 12px; font-family: Arial, Helvetica, sans-serif; color: #CCCCCC; text-decoration: none">Close</a></td>\';'."\n";
$awin .= 'theDiv = theDiv + \'</tr>\';'."\n";
$awin .= 'theDiv = theDiv + \'<tr><td colspan="2">\';'."\n";
$awin .= 'theDiv = theDiv + \'<center>\';'."\n";
$awin .= 'theDiv = theDiv + \'<iframe src="'.$location.'" width="'.$awinFrameWidth.'px" height="'.$awinFrameHeight.'px" align="middle" frameborder="0"></iframe>\';'."\n";
$awin .= 'theDiv = theDiv + \'</center>\';'."\n";
$awin .= 'theDiv = theDiv + \'</td>\';'."\n";
$awin .= 'theDiv = theDiv + \'</tr>\';'."\n";
$awin .= 'theDiv = theDiv + \'</table>\';'."\n";
$awin .= 'theDiv = theDiv + \'</div>\';'."\n";
$awin .= 'var floatingWindow = document.createElement("div");floatingWindow.id = "floatingWindow";floatingWindow.innerHTML = theDiv;theBody = document.body;if (!theBody) {theBody = document.getElementById("body");if (!theBody) {theBody = document.getElementsByTagName("body")[0];}}theBody.appendChild(floatingWindow);}'."\n";
$awin .= 'function DisplayLinkChat(){ShowChatNew();lx = 1; gx = 1;}'."\n";
if ($usemousemessage == '1'){
$awin .= 'function DisplayMouseChat(){if(gx == 0){ if(window.confirm("'.$alertmessage.'")){ShowChatNew(); gx = 1;}}}'."\n";
}else{
$awin .= 'function DisplayMouseChat(){if(gx == 0){ShowChatNew(); gx = 1;}}'."\n";
}
$awin .= 'function DisplayChat(){if(gx == 0){window.scroll(0,0);showChat();gx = 1;var m = "'.$alertmessage.'";return m;}}'."\n";
$awin .= 'function DisableVSAChat(){gx=1;}'."\n";
$awin .= $onclick;
//build the thickbox code
$tbox = $cp."\n";
$tbox .= 'document.write('."'".'<script type="text/javascript" src="'.$installsite.$installfolder.'thickbox/jquery.js"></script>'."'".');'."\n";
$tbox .= 'document.write('."'".'<script type="text/javascript" src="'.$installsite.$installfolder.'thickbox/thickboxagent.js"></script>'."'".');'."\n";
$tbox .= 'document.write('."'".'<link rel="stylesheet" href="'.$installsite.$installfolder.'thickbox/thickbox.css" type="text/css" media="screen" />'."'".');'."\n";
$tbox .= 'document.write('."'".'<style type="text/css">'."'".');'."\n";
$tbox .= 'document.write('."'".'#TB_window {'."'".');'."\n";
$tbox .= 'document.write('."'".' font-size: '.$captiontextsize.'px;'."'".');'."\n";
$tbox .= 'document.write('."'".' font-family: Arial, Helvetica, sans-serif;'."'".');'."\n";
$tbox .= 'document.write('."'".' font-weight: '.$captiontextbold.';'."'".');'."\n";
$tbox .= 'document.write('."'".' font-style: '.$captiontextitalic.';'."'".');'."\n";
$tbox .= 'document.write('."'".' color: #'.$captiontextcolor.';'."'".');'."\n";
$tbox .= 'document.write('."'".' background: #'.$backcolor.';'."'".');'."\n";
$tbox .= 'document.write('."'".' border: '.$bordersize.'px '.$borderstyle.' #'.$bordercolor.';'."'".');'."\n";
$tbox .= 'document.write('."'".'}'."'".');'."\n";
$tbox .= 'document.write('."'".'#TB_title{'."'".');'."\n";
$tbox .= 'document.write('."'".' background-color: #'.$captioncolor.';'."'".');'."\n";
$tbox .= 'document.write('."'".'}'."'".');'."\n";
$tbox .= 'document.write('."'".'</style>'."'".');'."\n";
$tbox .= 'var tb_pathToImage=\''.$installsite.$installfolder.'thickbox/loadingAnimation.gif\';'."\n";
$tbox .= 'function DisplayLinkChat(){tb_show(\''.$captiontext.'\',\''.$location.'&keepThis=true&TB_iframe=true&height='.$tboxHeight.'&width='.$tboxWidth.'\',\'false\');lx = 1; gx = 1;}'."\n";
if ($usemousemessage == '1'){
$tbox .= 'function DisplayMouseChat(){if(gx==0){ if(window.confirm("'.$alertmessage.'")){tb_show(\''.$captiontext.'\',\''.$location.'&keepThis=true&TB_iframe=true&height='.$tboxHeight.'&width='.$tboxWidth.'\',\'false\'); gx = 1;}}}'."\n";
}else{
$tbox .= 'function DisplayMouseChat(){if(gx==0){ tb_show(\''.$captiontext.'\',\''.$location.'&keepThis=true&TB_iframe=true&height='.$tboxHeight.'&width='.$tboxWidth.'\',\'false\'); gx = 1;}}'."\n";
}
$tbox .= 'function DisplayChat(){if(gx==0){tb_show(\''.$captiontext.'\',\''.$location.'&keepThis=true&TB_iframe=true&height='.$tboxHeight.'&width='.$tboxWidth.'\',\'false\');gx=1;var m = "'.$alertmessage.'";return m;}}'."\n";
$tbox .= 'function DisableVSAChat(){gx=1;}'."\n";
$tbox .= $onclick;
//which chat window style to display
if ($chatwintype == 'default'){
$outputchat = $awin;
}else{
$outputchat = $tbox;
}
//which chat display method
if ($displaymethod == 'dialog'){
$outputchat .= 'window.onbeforeunload = DisplayChat;'."\n";
}
//finally output all code
echo $outputchat;
?>