| 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/boxes/ |
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.
*/
include('../modfiles/db.php');
include('../globals.php');
include('boxfunctions.php');
//some vars
$buttonstyle = 'style="width: 130px"';
$cancelstyle = 'style="width: 55px"';
//get posted data
$cid = $_GET['cid'];
$conn = mysql_connect("$dbhost", "$dblogin", "$dbpass") or die ('ERROR');
mysql_select_db($dbname, $conn);
$sql = "SELECT * FROM $campaignTable WHERE id='$cid'";
$result = mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
$data = mysql_fetch_assoc($result);
$label = $data['label'];
$description = $data['description'];
$actionbutton = $_POST['actionbutton'];
if ($actionbutton){
//validate inputs
$label = $_POST['label'];
$description = $_POST['description'];
$cid = $_POST['cid'];
$t = $_POST['t'];
$clearcheckbox = $_POST['clearcheckbox'];
//check for errors first
$err = '';
if ((!isset($label))||($label=='')){
$err[] = "The label was not entered.";
}
if ($err !== ''){
$show = 'There were some errors with the data you are trying to input:<br />';
$show .= '<ul>';
foreach($err as $value){
$show .= '<li>'.$value.'</li>';
}
$show .= '</ul><br />';
$show .= '<a href="campaignbox.php?t='.$t.'&cid='.$cid.'">Click Here to Go Back</a>';
$show = '<span style="color: #FF0000">'.$show.'</span>';
}else{
//all good ... lets update the database now
$conn = mysql_connect("$dbhost", "$dblogin", "$dbpass") or die ('ERROR');
mysql_select_db($dbname, $conn);
//prepare data for enter into the database
$label = addslashes($label);
$description = addslashes($description);
//update given campaign
$sql = "UPDATE $campaignTable SET label='$label',description='$description' WHERE id='$cid'";
mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
//check if user wants to clear the campaign data only
if ($clearcheckbox == 'clear'){
//delete chat logs
$sql = "DELETE FROM $chatlogTable WHERE cid='$cid'";
mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
//delete chat log data
$sql = "DELETE FROM $chatdataTable WHERE cid='$cid'";
mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
//delete unanswered chat data
$sql = "DELETE FROM $nocommentTable WHERE cid='$cid'";
mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
//delete link data
$sql = "DELETE FROM $linksdataTable WHERE cid='$cid'";
mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
//delete stats
$sql = "DELETE FROM $statsTable WHERE cid='$cid'";
mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
//delete visitor data
$sql = "DELETE FROM $userdataTable WHERE cid='$cid'";
mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
//delete visitor name data
$sql = "DELETE FROM $usernameTable WHERE cid='$cid'";
mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
}
$show = 'The campaign <font color="#0000FF">'.$label.'</font> has been updated.';
//output message
$show .= '<br /><br /><a href="../index.php?ncid='.$cid.'" target="_parent">click here to continue</a>';
$show = '<center>'.$show.'</center>';
}
//wrap html in a table and hide the input table
$show = '<table width="100%" cellspacing="0" cellpadding="10"><tr><td>'.$show.'</td></tr></table>';
$hide1 = '<!--';
$hide2 = '-->';
}
//remove this campaign from the database
$deletebutton = $_POST['deletebutton'];
if ($deletebutton){
$label = $_POST['label'];
$cid = $_POST['cid'];
//check if this is the last campaign in table
$conn = mysql_connect("$dbhost", "$dblogin", "$dbpass") or die ('ERROR');
mysql_select_db($dbname, $conn);
$sql = "SELECT * FROM $campaignTable";
$result = mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
$nc = mysql_num_rows($result);
if ($nc == 1){
$show = '<font color="#FF0000"><strong>Sorry</strong> but you cannot delete this campaign because it is the last one in the database.';
$show .='There must always be at least one campaign. You need to create a new campaign and then ';
$show .='delete this one afterwards.</font>';
}else{
//delete this campaign
$sql = "DELETE FROM $campaignTable WHERE id='$cid'";
mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
//delete campaign agents
$sql = "DELETE FROM $agentsTable WHERE cid='$cid'";
mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
//delete chat logs
$sql = "DELETE FROM $chatlogTable WHERE cid='$cid'";
mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
//delete chat log data
$sql = "DELETE FROM $chatdataTable WHERE cid='$cid'";
mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
//delete unanswered chat data
$sql = "DELETE FROM $nocommentTable WHERE cid='$cid'";
mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
//delete instant messages
$sql = "DELETE FROM $messTable WHERE cid='$cid'";
mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
//delete smart messages
$sql = "DELETE FROM $smartTable WHERE cid='$cid'";
mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
//delete links
$sql = "DELETE FROM $linksTable WHERE cid='$cid'";
mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
//delete link data
$sql = "DELETE FROM $linksdataTable WHERE cid='$cid'";
mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
//delete stats
$sql = "DELETE FROM $statsTable WHERE cid='$cid'";
mysql_query($sql,$conn);mysql_error()?(print(mysql_error())):'';
$show = 'The campaign <font color="#0000FF">'.$label.'</font> and all associated data has been deleted.';
}
//display results
$show .= '<br /><br /><a href="../index.php" target="_parent">click here to continue</a>';
$show = '<center>'.$show.'</center>';
$show = '<table width="100%" cellspacing="0" cellpadding="10"><tr><td>'.$show.'</td></tr></table>';
$hide1 = '<!--';
$hide2 = '-->';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<LINK href="style.css" type=text/css rel=stylesheet>
<title>campaign</title>
<script language="JavaScript">
function deleteClient(){
var m = 'WARNING: Are you sure you want to remove? All data'+"\n";
m = m + 'associated with this campaign will be deleted!'+"\n";
m = m + 'Click "OK" to remove.'+"\n";
var agree=confirm(m);
if (agree)
return true;
else
return false;
}
function ClearAll(){
var m = 'WARNING: Are you sure you want to clear all data'+"\n";
m = m + 'associated with this campaign?'+"\n";
m = m + 'Click "OK" to clear all.'+"\n";
if (document.boxform.clearcheckbox.checked){
if (confirm(m)) return true;
else return false;
}else{
return true;
}
}
</script>
</head>
<body>
<?php echo $show; ?>
<?php echo $hide1; ?>
<form name="boxform" action="campaigneditbox.php" method="post">
<input type="hidden" name="cid" value="<?php echo $cid; ?>" />
<table width="320" border="0" align="center" cellpadding="10" cellspacing="0">
<tr>
<td width="314"><table width="100%" border="0" cellspacing="1" cellpadding="2">
<tr>
<td colspan="2" valign="top"><div align="center"><strong>Edit Campaign</strong></div></td>
</tr>
<tr>
<td width="33%" valign="top" bgcolor="#E9E9E9"><div align="right">Label:</div></td>
<td width="67%" bgcolor="#E9E9E9"><input name="label" type="text" id="label" style="width: 200px" value="<?php echo $label; ?>" /></td>
</tr>
<tr>
<td valign="top" bgcolor="#E9E9E9"><div align="right">Description:<br />
(optional)</div></td>
<td bgcolor="#E9E9E9"><textarea name="description" cols="45" rows="5" id="description" style="width: 200px; height: 90px;"><?php echo $description; ?></textarea></td>
</tr>
<tr>
<td valign="top" bgcolor="#E9E9E9"><div align="right">Clear all:</div></td>
<td bgcolor="#E9E9E9"><input name="clearcheckbox" type="checkbox" id="clearcheckbox" value="clear" />
(if checked, this will clear all statistical data associated with this campaign)</td>
</tr>
<tr>
<td colspan="2" bgcolor="#E9E9E9"><table align="center" width="100" border="0" cellspacing="0" cellpadding="2">
<tr>
<td><div align="left">
<input type="submit" name="actionbutton" value="Update Campaign" <?php echo $buttonstyle; ?> onClick="return ClearAll();" />
</div></td>
<td><input type="submit" name="deletebutton" id="button" value="Remove Campaign" onClick="if(!deleteClient()) return false;" <?php echo $buttonstyle; ?> /></td>
<td><div align="right">
<input type="submit" id="Login" value="Cancel" onclick="self.parent.tb_remove();" <?php echo $cancelstyle; ?> />
</div></td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<?php echo $hide2; ?>
</body>
</html>