/home/u764571690/domains/savitrfoundation.com/public_html/finger data
NameSizeModeActions
api_process.php89370644editdlrm
get_token.php5820644editdlrm
IMG-20250623-WA0105 - Copy - Copy.jpg80830644editdlrm
IMG-20250623-WA0105 - Copy.jpg80830644editdlrm
IMG-20250623-WA0105.jpg80830644editdlrm
index.php1208440644editdlrm
secure-api.js45650644editdlrm
Edit: /home/u764571690/domains/savitrfoundation.com/public_html/finger data/api_process.php (8937B)
'Access temporarily blocked. Please try again later.']); exit; } // Clear block if time expired if (isset($_SESSION[$block_key]) && (time() - $_SESSION[$block_key]) >= API_BLOCK_DURATION) { unset($_SESSION[$block_key]); } // Per-minute rate limiting if (!isset($_SESSION[$rate_limit_key])) { $_SESSION[$rate_limit_key] = ['count' => 0, 'time' => time()]; } $rate_data = $_SESSION[$rate_limit_key]; if (time() - $rate_data['time'] > 60) { $_SESSION[$rate_limit_key] = ['count' => 0, 'time' => time()]; $rate_data = $_SESSION[$rate_limit_key]; } if ($rate_data['count'] >= API_RATE_LIMIT) { $_SESSION[$block_key] = time(); // Block for 1 hour http_response_code(429); echo json_encode(['error' => 'Rate limit exceeded. Access blocked for 1 hour.']); exit; } $_SESSION[$rate_limit_key]['count']++; // Per-hour rate limiting if (!isset($_SESSION[$hourly_limit_key])) { $_SESSION[$hourly_limit_key] = ['count' => 0, 'time' => time()]; } $hourly_data = $_SESSION[$hourly_limit_key]; if (time() - $hourly_data['time'] > 3600) { $_SESSION[$hourly_limit_key] = ['count' => 0, 'time' => time()]; $hourly_data = $_SESSION[$hourly_limit_key]; } if ($hourly_data['count'] >= API_MAX_REQUESTS_PER_HOUR) { $_SESSION[$block_key] = time(); // Block for 1 hour http_response_code(429); echo json_encode(['error' => 'Hourly limit exceeded. Access blocked for 1 hour.']); exit; } $_SESSION[$hourly_limit_key]['count']++; // Only POST allowed if ($_SERVER['REQUEST_METHOD'] !== 'POST') { http_response_code(405); echo json_encode(['error' => 'Method not allowed']); exit; } // Get and validate input $input = json_decode(file_get_contents('php://input'), true); if (!$input || !isset($input['action'])) { http_response_code(400); echo json_encode(['error' => 'Invalid request']); exit; } $action = $input['action']; // HIGH SECURITY: Token Authentication (Fixed for localhost and production) $provided_token = $input['token'] ?? $_SERVER['HTTP_X_API_TOKEN'] ?? ''; $session_id = $input['session_id'] ?? session_id(); // Generate expected token same way as get_token.php $secret = hash('sha256', 'finger_data_secure_' . date('Y-m-d') . '_xampp_htdocs'); $expected_token = hash('sha256', $secret . $session_id); if (empty($provided_token) || !hash_equals($expected_token, $provided_token)) { http_response_code(403); echo json_encode(['error' => 'Unauthorized - Invalid security token']); exit; } // Validate session if (!isset($_SESSION['api_authenticated']) || (time() - $_SESSION['api_authenticated']) > API_SESSION_TIMEOUT) { $_SESSION['api_authenticated'] = time(); } switch ($action) { case 'getProcessingParams': // Return processing parameters (protected logic) echo json_encode([ 'success' => true, 'params' => [ 'maxSize' => 280, 'speedValues' => [ 'fast' => 0.5, 'normal' => 1.0, 'slow' => 2.0 ], 'defaultZoom' => 52, 'defaultContrast' => 109, 'defaultBrightness' => 100, 'defaultSharpness' => 500, 'defaultThermalIntensity' => 500, 'pixelShakePercent' => 3 ] ]); break; case 'calculateThermalColor': // Thermal color calculation (protected algorithm) $intensity = isset($input['intensity']) ? (int)$input['intensity'] : 0; $gray = isset($input['gray']) ? (int)$input['gray'] : 0; $thermalIntensity = isset($input['thermalIntensity']) ? (int)$input['thermalIntensity'] : 500; $thermalRatio = $thermalIntensity / 500; $r = $g = $b = 0; if ($thermalRatio >= 0.5) { $t = ($thermalRatio - 0.5) / 0.5; if ($t >= 0.5) { $t2 = ($t - 0.5) / 0.5; $r = 255; $g = max(0, min(255, (1 - $t2) * 100)); $b = 0; } else { $t2 = $t / 0.5; $r = 255; $g = max(0, min(255, 100 + $t2 * 155)); $b = 0; } } else { $t = $thermalRatio / 0.5; if ($t >= 0.5) { $t2 = ($t - 0.5) / 0.5; $r = 255 - $t2 * 255; $g = 255; $b = $t2 * 255; } else { $t2 = $t / 0.5; $r = 0; $g = 255 - $t2 * 255; $b = 255; } } $intensityFactor = $gray / 255; $r = max(0, min(255, $r * $intensityFactor)); $g = max(0, min(255, $g * $intensityFactor)); $b = max(0, min(255, $b * $intensityFactor)); echo json_encode([ 'success' => true, 'color' => ['r' => (int)$r, 'g' => (int)$g, 'b' => (int)$b] ]); break; case 'calculateSharpness': // Sharpness calculation (protected algorithm) $sharpness = isset($input['sharpness']) ? (int)$input['sharpness'] : 100; $sharpnessAmount = ($sharpness - 100) / 100; if ($sharpnessAmount > 0) { if ($sharpness > 200) { $extraAmount = ($sharpness - 200) / 100; $sharpnessAmount = 1.0 + ($extraAmount * 2.5); } } else { $sharpnessAmount = max($sharpnessAmount, -0.5); } echo json_encode([ 'success' => true, 'sharpnessAmount' => $sharpnessAmount ]); break; case 'validateData': // Data validation $serial = isset($input['serial']) ? trim($input['serial']) : ''; $aadhar = isset($input['aadhar']) ? trim($input['aadhar']) : ''; $errors = []; if (empty($serial) || strlen($serial) > 20) { $errors[] = 'Invalid Serial Number'; } if (empty($aadhar) || strlen($aadhar) !== 12 || !ctype_digit($aadhar)) { $errors[] = 'Invalid Aadhar Number'; } echo json_encode([ 'success' => empty($errors), 'errors' => $errors ]); break; default: http_response_code(400); echo json_encode(['error' => 'Unknown action']); break; }