0byt3m1n1
Path:
/
data
/
applications
/
aps.bak
/
vtiger
/
5.0.4
/
custom
/
14010000
/
files
/
[
Home
]
File: unsubscribeuser.php
<?php /** * Created on 23-Dec-08 by Raj Boyapati to unsubcribe end users from campaigns. * ******************************************************************************* * Version * Modified by * Date * Details * * ******************************************************************************* * * * * * * * * * * * * * * * * ******************************************************************************* */ // INFO: required files require('config.inc.php'); require_once('include/logging.php'); // INFO: Variable $pipe="|"; $seperator="!"; $email=""; $campid=""; $leadid=""; $campaignleadid = ""; $log =& LoggerManager::getLogger('index'); //INFO: Database connection $dbhost = $dbconfig['db_hostname']; $dbuser = $dbconfig['db_username']; $dbpass = $dbconfig['db_password']; $dbname = $dbconfig['db_name']; try { $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to database'); mysql_select_db($dbname); } catch (Exception $e) { $errMsg = $e->getMessage(); $log->fatal("Unsubscribe -> Error while connecting to database. ".$errMsg); throw new Exception("Unsubscribe -> Database connection failed."); } // INFO: get contact information if(isset($_POST["campid"])) $campid=$_POST["campid"]; if(isset($_POST["email"])) $email=$_POST["email"]; if($campid!='' && $email!='') { // INFO: unsubscribe user to campaign $query="delete from vtiger_campaignleadrel where campaignid='".$campid."' and leadid in (select leadid from vtiger_leaddetails where email='".$email."')"; mysql_query($query); } else { $errmsg = "Sorry, request can not be processed. Missing required information."; } //if($campid!='' && $email!='') mysql_close($conn); if (isset($errmsg) && $errmsg != '') { $log->fatal("Final error: ".$errmsg); echo $errmsg; } else { echo "Thanks, you have been successfully unsubscribed."; } ?>