![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/soundstudiopro.com/private_html/api/ |
<?php
/**
* DMCA Report Submission API
* Handles copyright infringement reports
*/
header('Content-Type: application/json');
session_start();
require_once __DIR__ . '/../config/database.php';
// Get POST data
$input = json_decode(file_get_contents('php://input'), true);
if (!$input) {
echo json_encode([
'success' => false,
'message' => 'Invalid input data'
]);
exit;
}
$trackId = $input['track_id'] ?? null;
$reporterName = $input['reporter_name'] ?? '';
$reporterEmail = $input['reporter_email'] ?? '';
$reporterRelationship = $input['reporter_relationship'] ?? 'other';
$infringingUrl = $input['infringing_url'] ?? '';
$description = $input['description'] ?? '';
// Validation
if (!$trackId || !is_numeric($trackId)) {
echo json_encode([
'success' => false,
'message' => 'Invalid track ID'
]);
exit;
}
if (empty($reporterName) || empty($reporterEmail) || empty($infringingUrl)) {
echo json_encode([
'success' => false,
'message' => 'Please fill in all required fields'
]);
exit;
}
if (!filter_var($reporterEmail, FILTER_VALIDATE_EMAIL)) {
echo json_encode([
'success' => false,
'message' => 'Invalid email address'
]);
exit;
}
if (!filter_var($infringingUrl, FILTER_VALIDATE_URL)) {
echo json_encode([
'success' => false,
'message' => 'Invalid URL format'
]);
exit;
}
try {
$pdo = getDBConnection();
if (!$pdo) {
throw new Exception('Database connection failed');
}
// Verify track exists
$stmt = $pdo->prepare("SELECT id, title, user_id FROM music_tracks WHERE id = ?");
$stmt->execute([$trackId]);
$track = $stmt->fetch(PDO::FETCH_ASSOC);
if (!$track) {
echo json_encode([
'success' => false,
'message' => 'Track not found'
]);
exit;
}
// Insert DMCA report
$stmt = $pdo->prepare("
INSERT INTO dmca_reports
(track_id, reporter_name, reporter_email, reporter_relationship, infringing_url, description, status)
VALUES (?, ?, ?, ?, ?, ?, 'pending')
");
$result = $stmt->execute([
$trackId,
$reporterName,
$reporterEmail,
$reporterRelationship,
$infringingUrl,
$description
]);
if ($result) {
$reportId = $pdo->lastInsertId();
// Log the report
error_log("DMCA Report submitted: ID=$reportId, Track=$trackId, Reporter=$reporterEmail");
echo json_encode([
'success' => true,
'message' => 'DMCA report submitted successfully. We will review it shortly.',
'report_id' => $reportId
]);
} else {
throw new Exception('Failed to submit report');
}
} catch (Exception $e) {
error_log("DMCA Report Error: " . $e->getMessage());
echo json_encode([
'success' => false,
'message' => 'An error occurred while submitting your report. Please try again.'
]);
}
?>