| Server IP : 208.122.213.31 / Your IP : 216.73.216.185 Web Server : Apache System : Linux msd6191.mjhst.com 4.18.0-553.137.1.el8_10.x86_64 #1 SMP Wed Jun 24 11:40:24 UTC 2026 x86_64 User : WHMCS_MIA_382 ( 1001) PHP Version : 7.4.33 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/httpd/html/_nats_validation/ |
Upload File : |
<?php
/*
* test
* [domain]/natv/?method=validate_affiliate&nats=MC4wLjYuNi4wLjAuMC4wLjA
*/
session_start();
require '_db.php';
require 'lib.php';
//exit('HERE!');
$DB_connector = new DB_connector;
/**
*
*/
if(
(isset($_REQUEST["method"]) && $_REQUEST["method"] == 'validate_affiliate')
&&
(
(isset($_REQUEST["params"]["nats"]) && $_REQUEST["params"]["nats"] != '')
||
(isset($_REQUEST["nats"]) && $_REQUEST["nats"] != '')
)
){
if(isset($_REQUEST["nats"])){
$test_hash = $_REQUEST["nats"];
}else{
$test_hash = $_REQUEST["params"]["nats"];
}
# scrub the input value
# write log in retun array format
# add validation that context is "this" page or return false and die
$validation_hash = validate_affiliate($test_hash);
#echo 'HERE:@'.__LINE__.' '.__FILE__.' $validation==<pre>'.var_export($validation, true).'</pre><br>'.PHP_EOL;
if($test_hash != $validation_hash){
$valid_nats = NULL;
$result = null;
$error = array(
'validation_hash' => $validation_hash,
);
}else{
$result = array(
'valid_nats' => 'true',
);
$error = null;
}
$response = array(
'result' => $result,
'error' => $error,
'id' => microtime().'-'.md5($test_hash["nats"]),
);
$transportResponse = json_encode($response);
echo $transportResponse;
}else{
if(!isset($_SERVER["HTTP_REFERER"]) || '' == $_SERVER["HTTP_REFERER"]){
$_SERVER["HTTP_REFERER"] = 'http://camsallday.com';
}
if(isset($_REQUEST["nats"]) && '' != $_REQUEST["nats"]){
$test_hash = $_REQUEST["nats"];//
}else{
if('' != $_SERVER["REQUEST_URI"]){
$replace = array("");
$search = array(
$_SERVER["REDIRECT_BASE"],
);
$test_hash = str_replace($search, $replace, $_SERVER["REQUEST_URI"]);
#echo 'here: '.__FILE__.'@'.__LINE__.' $test_hash==['.$test_hash.'] <br>'.PHP_EOL;
$test_hash = preg_replace("/[^A-Za-z0-9._-]/", "", $test_hash);
#echo 'here: '.__FILE__.'@'.__LINE__.' $test_hash==['.$test_hash.'] <br>'.PHP_EOL;
}
}
$redirectPath = '/track/';
#$forward = $httpype.'//'.$_SERVER["SERVER_NAME"].'/signup/signup.php?nats='.$_REQUEST["nats"].'&step='.$_REQUEST["step"];
$forward = $_SERVER["SERVER_NAME"].$redirectPath.$test_hash; //.'&step='.$_REQUEST["step"];
$replace = array("");
$search = array(
'join.',
);
$tld = str_replace($search, $replace, $_SERVER["SERVER_NAME"]);
$search = array(
'http:',
'/',
);
$refTld = str_replace($search, $replace, $_SERVER["HTTP_REFERER"]);
#echo 'here: '.__FILE__.'@'.__LINE__.' $forward==['.$forward.'] <br>'.PHP_EOL;
#echo 'here: '.__FILE__.'@'.__LINE__.' $tld==['.$tld.'] $refTld==['.$refTld.'] $test_hash==['.$test_hash.']<br>'.PHP_EOL;
#echo 'here: '.__FILE__.'@'.__LINE__.' strpos($_SERVER["SERVER_NAME"], "join.")==<pre>'.var_export(strpos($_SERVER["SERVER_NAME"], 'join.'), true).'</pre><br>'.PHP_EOL;
if('' != $test_hash){
$validation_hash = validate_affiliate($test_hash);
if($test_hash != $validation_hash && NULL != $validation_hash){
//$forward = $_SERVER["SERVER_NAME"].'/signup/signup.php?nats='.$validation_hash.'&step='.$_REQUEST["step"];
$forward = $_SERVER["SERVER_NAME"].$redirectPath.$validation_hash;
}
}
#echo 'here: '.__FILE__.'@'.__LINE__.' $forward==['.$forward.'] <br>'.PHP_EOL;
#header('Location: '.$forward);
#echo '{"result":null,"error":{"validation_hash":"not supplied"},"id":"'.microtime().'"}';
/*
http://camsallday.com/?nats=Mi40LjYuNi4wLjAuMC4wLjA
http//join.camsallday.com/signup/signup.php?nats=Mi4xLjUuNS4wLjAuMC4wLjA&step=2
echo '{"result":null,"error":{"validation_hash":"not supplied", "data" : '.json_encode($_REQUEST).'},"id":"'.microtime().'"}'.PHP_EOL;
echo PHP_EOL;
$raw_data = file_get_contents('php://input');
echo 'here: '.__FILE__.'@'.__LINE__.' $raw_data==<pre>'.var_export($raw_data, true).'</pre><br>'.PHP_EOL;
echo 'here: '.__FILE__.'@'.__LINE__.' $_POST==<pre>'.var_export($_POST, true).'</pre><br>'.PHP_EOL;
echo 'here: '.__FILE__.'@'.__LINE__.' $_GET==<pre>'.var_export($_GET, true).'</pre><br>'.PHP_EOL;
echo 'here: '.__FILE__.'@'.__LINE__.' $_REQUEST==<pre>'.var_export($_REQUEST, true).'</pre><br>'.PHP_EOL;
echo 'here: '.__FILE__.'@'.__LINE__.' $_SERVER==<pre>'.var_export($_SERVER, true).'</pre><br>'.PHP_EOL;
echo __METHOD__.__LINE__.'$_COOKIE<pre>['.var_export($_COOKIE, true).']</pre>'.'<br>';
#echo __METHOD__.__LINE__.'$_SERVER<pre>['.var_export($_SERVER, true).']</pre>'.'<br>';
echo __METHOD__.__LINE__.'$_SERVER[HTTP_COOKIE]<pre>['.var_export(urldecode(urldecode(urldecode($_SERVER["HTTP_COOKIE"]))), true).']</pre>'.'<br>';
*/
echo 'here: '.__FILE__.'@'.__LINE__.' $forward==['.$forward.'] <br>'.PHP_EOL;
exit;
if(isset($_SERVER['HTTPS']) && 'on' == $_SERVER['HTTPS']){
header('Location: https://'.$forward);
}else{
header('Location: http://'.$forward);
}
}
/*** */
/*
http://join.camsallday.com/ttrack/Mi40LjYuNi4wLjAuMC4wLjA
*/
?>