| Server IP : 104.21.21.239 / Your IP : 216.73.216.11 Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5 System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/banners/domains/stagemag/ |
Upload File : |
<?php
/**
* spam.php -- OOPSpam API spam detection
* Converted from spam.php (cfhttp → curl)
*/
require_once __DIR__ . '/functions.php';
$spamcontent = $spamcontent ?? '';
$relid = $relid ?? 0;
$reltable = $reltable ?? '';
$userId = $userId ?? 0;
$Score = 0;
$isIPBlocked = true;
$langMatch = true;
$countryMatch = false;
$numberOfSpamWords = 0;
// Determine client IP
$senderIP = '';
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$senderIP = trim(explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])[0]);
}
if ($senderIP === '') {
$senderIP = $_SERVER['REMOTE_ADDR'] ?? ($_SERVER['REMOTE_HOST'] ?? '');
}
// Build request body
$contentBody = [
'checkForLength' => true,
'senderIP' => $senderIP,
'allowedCountries' => ['it', 'us'],
'allowedLanguages' => ['en'],
'content' => $spamcontent,
];
// Send request via curl
$ch = curl_init('https://api.oopspam.com/v1/spamdetection');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'X-Api-Key: Rz0VSS6LmpA3mGNWf9PqtWjD2BMwwTK7PNFNXsi0',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode($contentBody),
CURLOPT_TIMEOUT => 30,
]);
$result = curl_exec($ch);
curl_close($ch);
if ($result && ($apiResponse = json_decode($result, true)) !== null) {
if (isset($apiResponse['Score'])) {
$Score = $apiResponse['Score'];
}
if (isset($apiResponse['Details']) && is_array($apiResponse['Details'])) {
$d = $apiResponse['Details'];
if (isset($d['isIPBlocked'])) $isIPBlocked = $d['isIPBlocked'];
if (isset($d['langMatch'])) $langMatch = $d['langMatch'];
if (isset($d['numberOfSpamWords'])) $numberOfSpamWords = $d['numberOfSpamWords'];
if (isset($d['countryMatch'])) $countryMatch = $d['countryMatch'];
}
}
// Log result
$stmt = db_write()->prepare(
"INSERT INTO oopspamResponses
(Score, isIPBlocked, langMatch, countryMatch, numberOfSpamWords, senderIP, userId, reltable, relid, spamcontent)
VALUES
(:score, :blocked, :lang, :country, :spamwords, :ip, :uid, :tbl, :rid, :content)"
);
$stmt->execute([
':score' => (int)$Score,
':blocked' => (int)$isIPBlocked,
':lang' => (int)$langMatch,
':country' => (int)$countryMatch,
':spamwords' => (string)$numberOfSpamWords,
':ip' => $senderIP,
':uid' => (int)$userId,
':tbl' => $reltable,
':rid' => (int)$relid,
':content' => $spamcontent,
]);