| 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/governmentgrants.us/vx/usa/ai-overviews/ |
Upload File : |
<?php
session_start();
include_once($_SERVER['DOCUMENT_ROOT'].'/vx/lib/ua.php');
include_once($_SERVER['DOCUMENT_ROOT'].'/vx/lib/func.php');
include_once($_SERVER['DOCUMENT_ROOT'].'/vx_/site_info.php');
include_once($_SERVER['DOCUMENT_ROOT'].'/vx/lib/mysql.php');
header('Content-Type: application/json');
if($_SERVER['REQUEST_METHOD'] !== 'POST') {
echo json_encode(['success' => false, 'error' => 'Invalid request method.']);
exit;
}
$user = $_SESSION['user'] ?? '';
if(empty($user)) {
echo json_encode(['success' => false, 'error' => 'Not logged in.']);
exit;
}
$grant_id = (int)($_POST['grant_id'] ?? 0);
$action = $_POST['action'] ?? '';
if($grant_id <= 0 || !in_array($action, ['add', 'remove'])) {
echo json_encode(['success' => false, 'error' => 'Invalid parameters.']);
exit;
}
$client_id = $db->clean($user);
$site = $db->clean($siteCode);
if($action === 'add') {
$exists = $db->query("SELECT id FROM grdb.grd_usa_saved_grants WHERE site_code = '{$site}' AND client_id = '{$client_id}' AND grants_id = {$grant_id}");
if(empty($exists)) {
$db->query("INSERT INTO grdb.grd_usa_saved_grants (site_code, client_id, grants_id, ts_added) VALUES ('{$site}', '{$client_id}', {$grant_id}, NOW())");
}
} else {
$db->query("DELETE FROM grdb.grd_usa_saved_grants WHERE site_code = '{$site}' AND client_id = '{$client_id}' AND grants_id = {$grant_id}");
}
echo json_encode(['success' => true]);