2011-03-28 14:21:28 +00:00
|
|
|
<?
|
|
|
|
$UserID = $LoggedUser['ID'];
|
|
|
|
$SimilarID = db_string($_GET['similarid']);
|
|
|
|
$ArtistID = db_string($_GET['artistid']);
|
|
|
|
$Way = db_string($_GET['way']);
|
|
|
|
|
2013-05-04 08:00:48 +00:00
|
|
|
if (!is_number($SimilarID) || !is_number($ArtistID)) {
|
2011-03-28 14:21:28 +00:00
|
|
|
error(404);
|
|
|
|
}
|
2013-05-04 08:00:48 +00:00
|
|
|
if (!in_array($Way, array('up', 'down'))) {
|
2011-03-28 14:21:28 +00:00
|
|
|
error(404);
|
|
|
|
}
|
|
|
|
|
2013-05-05 08:00:31 +00:00
|
|
|
$DB->query("
|
|
|
|
SELECT SimilarID
|
|
|
|
FROM artists_similar_votes
|
|
|
|
WHERE SimilarID='$SimilarID'
|
|
|
|
AND UserID='$UserID'
|
|
|
|
AND Way='$Way'");
|
2013-07-10 00:08:53 +00:00
|
|
|
if (!$DB->has_results()) {
|
2013-05-04 08:00:48 +00:00
|
|
|
if ($Way == 'down') {
|
2011-03-28 14:21:28 +00:00
|
|
|
$Score = 'Score-100';
|
2013-05-05 08:00:31 +00:00
|
|
|
} elseif ($Way == 'up') {
|
2011-03-28 14:21:28 +00:00
|
|
|
$Score = 'Score+100';
|
|
|
|
} else { // Nothing is impossible!
|
|
|
|
$Score = 'Score';
|
|
|
|
}
|
2013-05-05 08:00:31 +00:00
|
|
|
$DB->query("
|
|
|
|
UPDATE artists_similar_scores
|
|
|
|
SET Score=$Score
|
|
|
|
WHERE SimilarID='$SimilarID'");
|
|
|
|
$DB->query("
|
|
|
|
INSERT INTO artists_similar_votes (SimilarID, UserID, Way)
|
|
|
|
VALUES ('$SimilarID', '$UserID', '$Way')");
|
2011-03-28 14:21:28 +00:00
|
|
|
$Cache->delete_value('artist_'.$ArtistID); // Delete artist cache
|
|
|
|
}
|
|
|
|
header('Location: '.$_SERVER['HTTP_REFERER']);
|
|
|
|
?>
|