Skip to content

Instantly share code, notes, and snippets.

@azhurb
Last active August 29, 2015 14:18
Show Gist options
  • Select an option

  • Save azhurb/324439ee8c9ff61165d8 to your computer and use it in GitHub Desktop.

Select an option

Save azhurb/324439ee8c9ff61165d8 to your computer and use it in GitHub Desktop.
on_unsubscribe.php
<?php
include "../common.php";
if (empty($_REQUEST['mac']) || empty($_REQUEST['tariff_id']) || empty($_REQUEST['package_id'])){
echo '{"status":"ERROR","results":false,"error":"mac and tariff_id required"}';
exit;
}
//$mac = $_REQUEST['mac'];
//$tariff_id = $_REQUEST['tariff_id'];
$logger = new Logger();
$logger->setPrefix("subscription_");
$date = new DateTime('now', new DateTimeZone(Config::get('default_timezone')));
$logger->access(sprintf("%s - [%s] unsubscribe mac:%s, tariff_id:%s, package_id:%s\n",
empty($_SERVER['HTTP_X_REAL_IP']) ? $_SERVER['REMOTE_ADDR'] : $_SERVER['HTTP_X_REAL_IP'] ,
$date->format('r'),
$_REQUEST['mac'],
$_REQUEST['tariff_id'],
$_REQUEST['package_id']
));
// Success!
echo '{"status":"OK","results":true}';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment