Update meme voting

This commit is contained in:
Bruno Rybársky 2024-04-27 11:49:53 +02:00
parent adb738c12f
commit b0dae7da6d

@ -6,8 +6,8 @@ function generateScriptData($phpArray):string {
// Generate JavaScript code to save each array element to local storage // Generate JavaScript code to save each array element to local storage
$out = "<script>"; $out = "<script>";
foreach ($phpArray as $key => $value) { foreach ($phpArray as $key => $value) {
$escapedKey = addslashes($key); // Escape special characters in the key $escapedKey = addslashes(strval($key)); // Escape special characters in the key
$escapedValue = addslashes($value); // Escape special characters in the value $escapedValue = addslashes(strval($value)); // Escape special characters in the value
$out .= "localStorage.setItem('$escapedKey', '$escapedValue');"; $out .= "localStorage.setItem('$escapedKey', '$escapedValue');";
} }