YaWK
24.1
Yet another WebKit
vote-up.php
Go to the documentation of this file.
1
<?php
2
include
'../../../classes/db.php'
;
3
if
(!isset(
$db
)) {
$db
= new \YAWK\db(); }
4
include
'../../../classes/sys.php'
;
5
include
'../classes/blog.php'
;
6
$voteUp
= $_POST[
'voteUp'
];
7
$itemid
= $_POST[
'itemid'
];
8
// get votes from table...
9
$res
=
$db
->query(
"SELECT voteUp FROM {blog_items} WHERE id ='"
.
$itemid
.
"'"
);
10
$votes
= mysqli_fetch_row(
$res
);
11
if
(!empty(
$votes
[0])) {
12
$votes
=
$votes
[0];
13
}
14
else
{
15
$votes
= 0;
16
}
17
18
// add vote from user to existing votes
19
$votes
=
$votes
+
$voteUp
;
20
21
// update database with new votes
22
$res
=
$db
->query(
"UPDATE {blog_items} SET voteUp = '"
.
$votes
.
"' WHERE id = '"
.
$itemid
.
"'"
);
23
if
(
$res
){
24
$html =
"Update erfolgreich!"
;
25
}
26
else
{
27
$html =
\YAWK\alert::draw
(
"danger"
,
"Ooops!"
,
"This should not happen. Your like could not be set. Please try again!"
,
""
,
"2500"
);
28
}
29
echo $html;
YAWK\alert\draw
static draw($type, $title, $text, $redirect, $delay)
Definition:
alert.php:30
$db
$db
Definition:
dismiss-notifications.php:4
$votes
$votes
Definition:
vote-up.php:10
$voteUp
$voteUp
Definition:
vote-up.php:6
$res
$res
Definition:
vote-up.php:9
$itemid
$itemid
Definition:
vote-up.php:7
yawk.io
system
plugins
blog
js
vote-up.php
Generated on Tue Jan 16 2024 21:59:01 for YaWK by
doxygen 1.9.1