Backup Commit
This commit is contained in:
+41
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
// ERROR CODES: 50 = NO SESSION UUID SET LOGIN OR CREATE WISHLIST
|
||||
|
||||
$servername = "localhost";
|
||||
$username = "database_access";
|
||||
$password = "DataAccess1.";
|
||||
$dbname = "avali_shop";
|
||||
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
session_start();
|
||||
|
||||
$itemId = (int)$_POST["id"];
|
||||
|
||||
$uuid = $_SESSION["uuid"];
|
||||
|
||||
$sql = "SELECT * FROM wishlist_uuid WHERE uuid=\"" . $uuid . "\"";
|
||||
$result = $conn->query($sql);
|
||||
$row = $result->fetch_assoc();
|
||||
|
||||
if ($row["array"] != "") {
|
||||
$currentArray = json_decode($row["array"]);
|
||||
} else {
|
||||
$currentArray = array();
|
||||
}
|
||||
|
||||
if (!in_array($itemId, $currentArray)) {
|
||||
$currentArray[] = $itemId;
|
||||
}
|
||||
|
||||
print_r(json_encode($currentArray));
|
||||
|
||||
$sql_Update = "UPDATE `wishlist_uuid` SET `last_use`='" . date("Y-m-d H:i:s") . "',`array`='" . json_encode($currentArray) . "' WHERE uuid='" . $uuid . "'";
|
||||
$result_Update = $conn->query($sql_Update);
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user