This commit is contained in:
grandeljay 2022-11-11 13:41:01 +01:00
parent aa1c391166
commit dcb0f74aa9
2 changed files with 19 additions and 16 deletions

View file

@ -26,31 +26,34 @@ switch ($_SERVER['REQUEST_METHOD']) {
case 'POST':
if (isset($_POST['wishlist'])) {
$wishlist = $database
->query('SELECT *
FROM `wishlists_saved`
WHERE `wishlist` = ' . Sanitiser::getNumber($_POST['wishlist']) . '
;')
->query(
'SELECT *
FROM `wishlists_saved`
WHERE `wishlist` = ' . Sanitiser::getNumber($_POST['wishlist']) . ';'
)
->fetch();
if ($wishlist) {
/** Delete */
$database
->query('DELETE FROM `wishlists_saved`
WHERE `wishlist` = ' . Sanitiser::getNumber($_POST['wishlist']) . '
;');
->query(
'DELETE FROM `wishlists_saved`
WHERE `wishlist` = ' . Sanitiser::getNumber($_POST['wishlist']) . ';'
);
$response['action'] = 'deleted';
} else {
/** Create */
$database
->query('INSERT INTO `wishlists_saved` (
`user`,
`wishlist`
) VALUES (
' . $_SESSION['user']->id . ',
' . Sanitiser::getNumber($_POST['wishlist']) . '
)
;');
->query(
'INSERT INTO `wishlists_saved` (
`user`,
`wishlist`
) VALUES (
' . $_SESSION['user']->id . ',
' . Sanitiser::getNumber($_POST['wishlist']) . '
);'
);
$response['action'] = 'created';
}

View file

@ -1,7 +1,7 @@
<?php
/**
* home.php
* Blog
*
* @author Jay Trees <github.jay@grandel.anonaddy.me>
*/