* @date 2019 * @name index.php */ # require the helper require_once '/var/www/scripts/help.php'; # defining separators define('DS',DIRECTORY_SEPARATOR); define('RDS','/'); # links $api = decrypt('5dsLIhCDmoRXMh4D+2Duyxx3UPryVHhBAvZGgl+6I6b71rwZC52akuPGz3J2QU9eT0oVhMsFFOnkuEbsdZqLlY6X06exOZ7bKbBq3sMNuHs='); $upcenter = decrypt('VKowNMaY4x0KHczcnKqTux7nlkefYz44ybZ6L1NB2WcFWt5aTKHXrMQIJ+/XIlxyHyslHCCrSuv4sYiMVpmTHw=='); # parse url to get parameters $url = (filter_input(INPUT_SERVER, 'HTTP_X_REWRITE_URL') != null) ? ltrim(filter_input(INPUT_SERVER, 'HTTP_X_REWRITE_URL'),'/') : ltrim(filter_input(INPUT_SERVER, 'REQUEST_URI'),'/'); # check if is an image checkForImage($url,$upcenter); # check for short link ?> parameters not found !'); # check for ids if($data['process-id'] == 0 && $data['offer-id'] == 0) die('
offer not found !'); # get user's info $clientIp = getIp(); $agent = (filter_input(INPUT_SERVER,'HTTP_USER_AGENT') != null) ? filter_input(INPUT_SERVER,'HTTP_USER_AGENT') : ''; # opt out case if($data['act'] == 'oop') { $message = ""; if(count($_POST)) { $email = (filter_input(INPUT_POST,'email') != null) ? filter_input(INPUT_POST,'email') : ''; # send tracking information to bluemail if(!filter_var($email,FILTER_VALIDATE_EMAIL)) { $message = "Please check your email !"; } else { # check if email is the same $parameters = ['email' => md5($email),'list-id' => $data['list-id'],'client-id' => $data['client-id']]; $results = cmd('php /var/www/scripts/request.php ' . base64_encode($api) . ' ' . base64_encode('Tracking') . ' ' . base64_encode('checkEmail') . ' ' . base64_encode(json_encode($parameters))); # check results if(!is_array($results) || count($results) == 0 || !key_exists('output', $results) || json_decode($results['output']) == false || $results['status'] != '200') $message = "Your Email is not registered !"; # parse results $results = json_decode($results['output'],true); # check http status if($results['status'] != '200') $message = "Your Email is not registered !"; if(strtolower(trim($result['message'])) == 'email is correct !') { # preparing parameters $parameters = [ 'action' => $data['act'], 'process-id' => $data['process-id'], 'process-type' => $data['process-type'], 'user-id' => $data['user-id'], 'vmta-id' => $data['vmta-id'], 'list-id' => $data['list-id'], 'client-id' => $data['client-id'], 'offer-id' => $data['offer-id'], 'ip' => $clientIp, 'agent' => $agent ]; # execute tracking job cmd('nohup php /var/www/scripts/request.php ' . base64_encode($api) . ' ' . base64_encode('Tracking') . ' ' . base64_encode('procceed') . ' ' . base64_encode(json_encode($parameters)) . ' &'); $message = "Sorry to see you leaving :("; } else { $message = "Your Email is not registered !"; } } } include_once 'optout.php'; } else { # preparing parameters $parameters = [ 'action-id' => 0, 'action' => $data['act'], 'process-id' => $data['process-id'], 'process-type' => $data['process-type'], 'user-id' => $data['user-id'], 'vmta-id' => $data['vmta-id'], 'list-id' => $data['list-id'], 'client-id' => $data['client-id'], 'offer-id' => $data['offer-id'], 'ip' => $clientIp, 'agent' => $agent, 'info' => [] ]; # get offer link $link = ''; if(in_array($data['act'],['cl','un'])) { $results = cmd('php /var/www/scripts/request.php ' . base64_encode($api) . ' ' . base64_encode('Tracking') . ' ' . base64_encode('getLink') . ' ' . base64_encode(json_encode($parameters))); # check results if(!is_array($results) || count($results) == 0 || !key_exists('output', $results) || json_decode($results['output']) == false) die('
offer unavailable !'); # parse results $results = json_decode($results['output'],true); # check http status if($results['status'] != '200') die("
{$results['status']} : {$results['message']}"); # check link if(!key_exists('data',$results) || !key_exists('link',$results['data']) || strpos($results['data']['link'],'http') === false) die('
offer link is unavailable !'); $link = trim($results['data']['link']); $parameters['action-id'] = intval($results['data']['action_id']); $parameters['info'] = $results['data']['info']; } # send tracking information to master app if(in_array($data['act'],['op','cl','un']) && $data['process-id'] > 0) { # execute tracking job cmd('nohup php /var/www/scripts/request.php ' . base64_encode($api) . ' ' . base64_encode('Tracking') . ' ' . base64_encode('procceed') . ' ' . base64_encode(json_encode($parameters)) . ' &'); } # redirecting in case of a click or unsub if($link == '') die('
operation completed !'); header('Location: ' . $link); die(); }