Refactor
This commit is contained in:
parent
aa1c391166
commit
dcb0f74aa9
2 changed files with 19 additions and 16 deletions
|
@ -26,31 +26,34 @@ switch ($_SERVER['REQUEST_METHOD']) {
|
|||
case 'POST':
|
||||
if (isset($_POST['wishlist'])) {
|
||||
$wishlist = $database
|
||||
->query('SELECT *
|
||||
->query(
|
||||
'SELECT *
|
||||
FROM `wishlists_saved`
|
||||
WHERE `wishlist` = ' . Sanitiser::getNumber($_POST['wishlist']) . '
|
||||
;')
|
||||
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` (
|
||||
->query(
|
||||
'INSERT INTO `wishlists_saved` (
|
||||
`user`,
|
||||
`wishlist`
|
||||
) VALUES (
|
||||
' . $_SESSION['user']->id . ',
|
||||
' . Sanitiser::getNumber($_POST['wishlist']) . '
|
||||
)
|
||||
;');
|
||||
);'
|
||||
);
|
||||
|
||||
$response['action'] = 'created';
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* home.php
|
||||
* Blog
|
||||
*
|
||||
* @author Jay Trees <github.jay@grandel.anonaddy.me>
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue