| Server IP : 10.200.247.200 / Your IP : 216.73.217.19 Web Server : Apache System : Linux synergy-usa-sites 6.8.0-138-generic #138-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 31 22:41:49 UTC 2026 x86_64 User : jeremy ( 1001) PHP Version : 8.4.25 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/usa_sites/newusagrants.com/vx_old_version/lib/ |
Upload File : |
<?
/**
* /lib/json.data.php
*
* This file will handle the return of application ajax calls to /functions/ files
*
* @var mixed[] $errors An array of errors created during the processing of the PHP file of an ajax call
* @var mixed[] $data An array of results to be returned to the ajax call
* @var boolean $dataErrors If set to true the PHP file will return a 404 error and 404 error HTML, if set to false it will be ignored
*
* @copyright 2016-2021 Synergy Pro Marketing
* @author Aaron Campbell <aaron@synergymentoring.com>
* @license None, All Rights Reserved
* @package Layout
* @filesource
* @since 09.13.2017
* --- Aaron Campbell, added comments
* */
// If there are no errors return a json encoded string of the $data array
if(count($errors) == 0)
{
// all ajax data arrays will contain the 'result' value of 'success' or 'failed'
$data['result'] = "success";
echo json_encode($data);
}
else
{
// If $dataErrors is falsee but there are errors, return a json encoded string of the $errors array
if(!$dataErrors)
{
$data['result'] = "failed";
$data['errors'] = $errors;
echo json_encode($data);
}
else
{
// When $dataErrors is set to true, set header to 404 not found and print 404 HTML
header("HTTP/1.0 404 Not Found");
echo "<center>";
echo "<h1>404 Not Found</h1>";
echo "<p><a href=\"/\">click here</a></p>";
echo "</center>";
die();
}
}
?>