Jakweb.ch stuff
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
clouddesk/include/faq_vote.php

40 lines
1.2 KiB

1 year ago
<?php
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 6 May 1980 03:10:00 GMT");
/*===============================================*\
|| ############################################# ||
|| # JAKWEB.CH # ||
|| # ----------------------------------------- # ||
|| # Copyright 2019 JAKWEB All Rights Reserved # ||
|| ############################################# ||
\*===============================================*/
if (!file_exists('../config.php')) die('ajax/[comment_vote.php] config.php not exist');
require_once '../config.php';
if (!JAK_USERISLOGGED) die(json_encode(array("status" => 0)));
if (is_numeric($_GET['vid'])) {
if (isset($_GET['vote']) && ($_GET['vote'] == "up" || $_GET['vote'] == "down")) {
if ($_GET['vote'] == "down") {
$votesql = 'votes - 1';
$jakdb->update("faq_article", ["votes[-]" => 1], ["id" => $_GET['vid']]);
} else {
$jakdb->update("faq_article", ["votes[+]" => 1], ["id" => $_GET['vid']]);
}
die(json_encode(array("status" => 1)));
}
die(json_encode(array("status" => 0)));
} else {
die(json_encode(array("status" => 0)));
}
?>