Skip to content

Instantly share code, notes, and snippets.

@madeinnordeste
Last active November 30, 2016 04:51
Show Gist options
  • Save madeinnordeste/8865e89bc19036a9c0f2 to your computer and use it in GitHub Desktop.
Save madeinnordeste/8865e89bc19036a9c0f2 to your computer and use it in GitHub Desktop.
Sendy - Global bounce email - http://YOU-SEND-INSTALL/api/subscribers/global-bounce-subscriber.php
<?php include('../_connect.php');?>
<?php include('../../includes/helpers/short.php');?>
<?php
//-------------------------- ERRORS -------------------------//
$error_core = array('No data passed', 'API key not passed', 'Invalid API key');
$error_passed = array('Email not passed', 'List ID not passed', 'Email does not exist in list');
//-----------------------------------------------------------//
//--------------------------- POST --------------------------//
//api_key
if(isset($_POST['api_key'])) $api_key = mysqli_real_escape_string($mysqli, $_POST['api_key']);
else $api_key = null;
//email
if(isset($_POST['email'])) $email = mysqli_real_escape_string($mysqli, $_POST['email']);
else $email = null;
//----------------------- VERIFICATION ----------------------//
//Core data
if($api_key==null && $email==null && $list_id==null)
{
echo $error_core[0];
exit;
}
if($api_key==null)
{
echo $error_core[1];
exit;
}
else if(!verify_api_key($api_key))
{
echo $error_core[2];
exit;
}
//Passed data
if($email==null)
{
echo $error_passed[0];
exit;
}
//-----------------------------------------------------------//
//-------------------------- QUERY --------------------------//
$q = 'UPDATE subscribers SET bounced=1, unsubscribed=1 WHERE email = "'.$email.'"';
$r = mysqli_query($mysqli, $q);
$rows = mysqli_num_rows($r);
if ($r)
{
echo 'success';
}
else
{
echo $error_passed[2];
}
//-----------------------------------------------------------//
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment