Gazelle/sections/reports/ajax_claim_report.php

42 lines
615 B
PHP
Raw Normal View History

2012-12-10 08:00:21 +00:00
<?php
2013-07-01 08:01:00 +00:00
if (!check_perms('site_moderate_forums') || empty($_POST['id'])) {
2012-12-10 08:00:21 +00:00
print
json_encode(
array(
'status' => 'failure'
)
);
die();
}
2013-07-01 08:01:00 +00:00
$ID = (int)$_POST['id'];
2013-07-04 08:00:56 +00:00
$DB->query("
SELECT ClaimerID
FROM reports
WHERE ID = '$ID'");
2012-12-10 08:00:21 +00:00
list($ClaimerID) = $DB->next_record();
if ($ClaimerID) {
print
json_encode(
array(
'status' => 'dupe'
)
);
2012-12-12 08:00:17 +00:00
die();
2012-12-10 08:00:21 +00:00
} else {
$UserID = $LoggedUser['ID'];
2013-07-04 08:00:56 +00:00
$DB->query("
UPDATE reports
SET ClaimerID = '$UserID'
WHERE ID = '$ID'");
2012-12-10 08:00:21 +00:00
print
json_encode(
array(
'status' => 'success',
'username' => $LoggedUser['Username']
)
);
2012-12-12 08:00:17 +00:00
die();
2013-02-22 08:00:24 +00:00
}